Class EvoLudo
- All Implemented Interfaces:
MersenneTwister.Chronometer, CLOProvider
- Direct Known Subclasses:
EvoLudoGWT
EvoLudoJRE and GWT specific code to
EvoLudoGWT. Two distinct
implementations are required e.g. because of significant differences in
input/output routines.- Author:
- Christoph Hauert
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe interface to execute commands in a manner that is agnostic to the implementation details regarding GWT or JRE environments. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ModelThe active modelprotected Module<?> The active module.protected List<ChangeListener> List of change listeners that get notified when the model changes.protected StringThe command line options (raw string provided in URL, HTML tag, TextArea or command line)protected final CLOControllerController for command line option parsing.final CLOptionCommand-line option controlling the number of model runs.final CLOptionCommand-line option controlling the RNG seed.static final StringThe copyright string.protected static final doubleDelay decrement for speed sliderSliderstatic final doubleInitial delay between subsequent updates for speed sliderSliderstatic final doubleMaximum delay between subsequent updates for speed sliderSliderstatic final doubleMinimum delay between subsequent updates for speed sliderSliderfinal intUniqueIDof EvoLudo instance.private static intThe loggers of each EvoLudo lab instance need to have unique names to keep the logs separate.(package private) static booleanThe flag to indicate whether EvoLudo is running in a web browser (or ePub) using javascript generated by GWT or in the java JRE.protected booleanThe flag to indicate whether the active model is running.protected booleanThe flag to indicate whether running of the model is suspended.protected final LifecycleControllerController for lifecycle listeners.protected LoggerThe logger for keeping track of and reporting events and issues.The lookup table for all available modules.protected ChangeListener.PendingActionThe action that is pending (if any).protected booleanThe flag to indicate whether a reset of the active model has been requested.protected RNGDistributionThe shared random number generator to ensure reproducibility of results.protected final RunControllerController for run listeners.protected List<SampleListener> List of change listeners that get notified when the model changes.protected inttimeout for layout process of snapshots in msec.protected final StateEncoderResponsible for encoding/restoring state and handling version reporting. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ChangeListener newListener) Add a change listener to the list of listeners that get notified when the model changes.voidaddCLOProvider(CLOProvider provider) Registercloas a provider of command line options.voidaddLifecycleListener(LifecycleListener newListener) Add a lifecycle listener to the list of listeners that get notified when the model reaches lifecycle milestones.voidAddmoduleto lookup table of modules using the module's key.voidaddRunListener(RunListener newListener) Add a run listener to the list of listeners that get notified about model run state changes.voidaddSampleListener(SampleListener newListener) Add a change listener to the list of listeners that get notified when the model changes.voidcollectCLO(CLOParser prsr) All providers of command line options must implement this method to collect their options.abstract Network2DcreateNetwork2D(AbstractGeometry geometry) Generate 2D network.abstract Network3DcreateNetwork3D(AbstractGeometry geometry) Generate 3D network.voiddebug()Advances the EvoLudo model by a single debugging step.voidDecrease delay between subsequent updates by fixed factor.Encode current state of EvoLudo model as XML string (plist format).abstract voidexecute(EvoLudo.Directive directive) Executedirectivein JRE or GWT environments.abstract voidExport the current state of the engine using the appropriate means available in the current environment (GWT/JRE).voidReport error and stop model execution, if running.voidCalled whenever the state of the model has changed.voidCalled after the model has been re-initialized.voidCalled whenever a new model has finished loading.voidCalled after the model completed its relaxation.voidCalled after the model has been reset.voidCalled whenever the model starts its calculations.booleanfireModelSample(boolean success) Called after the population has reached an absorbing state (or has converged to an equilibrium state).voidCalled after the population has reached an absorbing state (or has converged to an equilibrium state).voidCalled whenever a new model has finished loading.voidCalled whenever a new module has finished loading.voidCalled after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the--restorecommand line argument.voidCalled whenever the current module has finished unloading.voidCalled whenever the settings of the model have changed.getCLO()Get the raw command line options, as provided in URL, HTML tag, settings TextArea or command line.Format, encode and output help on command line options.Access the module command line option.intgetDelay()Get delay between subsequent updates.abstract StringgetGit()Gets current git version of code base.abstract StringGets the compilation date of the current git version.Get version of JRE (if not running in browser).Note: Instead of sharing logging system, EvoLudo could implement helper routines for logging notifications.getModel()Get the active model.Module<?> Gets the activeModule.getRNG()Get the shared random number generator to ensure the reproducibility of results.intGets the timeout for the layout process of snapshots in msec.String[]Get the command line options split into an array with option names followed by their arguments (if applicable).Return version string of current model.abstract PDESupervisorhirePDESupervisor(PDE charge) Hire supervisor for managing PDE calculations.voidIncrease delay between subsequent updates by fixed factor.booleanCheck if the active model is running.booleanCheck whether the current model is suspended.voidNotification from GUI that layout process has finished.voidSet model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models.booleanloadModule(String newModuleKey) Load new module with keynewModuleKey.voidLoad all available modules.voidConvenience method to log errors of simulations.voidlogMessage(String msg) Convenience method to log messages of simulations.abstract voidlogProgress(String msg) Utility method to log progress of simulations.voidlogWarning(String msg) Convenience method to log warnings of simulations.final booleanCheck consistency of parameters in all populations.final voidInitialize all populations and notify all listeners.final voidmodelInit(boolean quiet) Initialize all populations and notify all listeners if requested.final booleanAdvance model by one step (reportFrequpdates) and notify all listeners.final booleanmodelNextDone(boolean cont) Called after the calculations of the next state of the model have finished.final booleanRelax model bytimeRelaxsteps and notify all listeners when done.final booleanmodelRelax(boolean quiet) Relax model bytimeRelaxsteps and notify all listeners if requested.final voidReset all populations and notify all listeners.final voidmodelReset(boolean quiet) Reset all populations and notify all listeners if requested.abstract voidnext()Advances the EvoLudo model by a single step.booleanCalled after parameters have changed.intparseCLO()Parse command line options.protected intPre-process and parse array of command line arguments.protected String[]preprocessCLO(String[] cloarray) Pre-process array of command line arguments.voidprev()Attempts to backtrack a single step of the EvoLudo model.(package private) voidHelper to process pending actions.voidremoveChangeListener(ChangeListener obsoleteListener) Remove the change listener from the list of listeners that get notified when the model changes.voidremoveCLOProvider(CLOProvider provider) Unregistercloas a provider of command line options.voidremoveLifecycleListener(LifecycleListener obsoleteListener) Remove the lifecycle listener from the list of listeners that get notified when the model reaches lifecycle milestones.voidremoveRunListener(RunListener obsoleteListener) Remove the run listener from the list of listeners that get notified when the model run state changes.voidremoveSampleListener(SampleListener obsoleteListener) Remove the change listener from the list of listeners that get notified when the model changes.voidRequests aChangeListener.PendingActionto be processed on the next opportunity.voidrequestAction(ChangeListener.PendingAction action, boolean now) Requests aChangeListener.PendingActionto be processed on the next opportunity.voidRequest full reparsing of the command line options.voidrequiresReset(boolean reset) Request reset the active model, e.g.abstract booleanRestore state of EvoLudo model from saved plist, which encodes engine state.booleanrestoreState(Plist plist) Restore state of EvoLudo model from pre-processed plist, which encodes engine state (seeencodeState()).abstract voidrun()Start the EvoLudo model and calculate the dynamics one step at a time.voidSet the raw command line options, as shown e.g.voidsetDelay(int delay) Set delay between subsequent updates.voidsetSuspended(boolean suspend) Set the flag indicating whether the model is suspended.abstract voidshowHelp()Show help on command line options.voidRun simulation.voidStart or stop EvoLudo model.voidstop()Requests halting of a runningModelon the next opportunity.voidUnload model framework.voidunloadModel(boolean quiet) Unload model framework and, if requested, notifies all registeredLifecycleListeners.voidUnload current module to free up resources.voidConcluding words for report (currently JRE only).voidWrite header of report tooutput(currently JRE only).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CLOProvider
adjustCLOMethods inherited from interface MersenneTwister.Chronometer
elapsedTimeMsec
-
Field Details
-
isGWT
static boolean isGWTThe flag to indicate whether EvoLudo is running in a web browser (or ePub) using javascript generated by GWT or in the java JRE. Special characters in strings can result in headaches when running in an ePub (or, worse still, in XHTML pages).truewhen running as GWT application;falsefor JRE applications. -
IDcounter
private static int IDcounterThe loggers of each EvoLudo lab instance need to have unique names to keep the logs separate. UseIDcounterto generate uniqueID's. -
ID
public final int IDUniqueIDof EvoLudo instance.- See Also:
-
logger
The logger for keeping track of and reporting events and issues. -
rng
The shared random number generator to ensure reproducibility of results.- See Also:
-
modules
-
activeModel
The active model -
resetRequested
protected boolean resetRequestedThe flag to indicate whether a reset of the active model has been requested. This is necessary after certain parameter changes. For example, changing the population size (seeIBSPopulation.nPopulation) requires a reset to (re)generate population geometries and initialize traits. -
cloController
Controller for command line option parsing. -
cloSeed
Command-line option controlling the RNG seed. -
cloRun
Command-line option controlling the number of model runs. -
lifecycleController
Controller for lifecycle listeners. -
runController
Controller for run listeners. -
changeListeners
List of change listeners that get notified when the model changes. -
sampleListeners
List of change listeners that get notified when the model changes. -
clo
The command line options (raw string provided in URL, HTML tag, TextArea or command line) -
DELAY_MIN
public static final double DELAY_MINMinimum delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_MAX
public static final double DELAY_MAXMaximum delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_INIT
public static final double DELAY_INITInitial delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_INCR
-
isSuspended
protected boolean isSuspendedThe flag to indicate whether running of the model is suspended. For example while parameters are being applied. If the changes do not require a reset of the model the calculations are resumed after new parameters are applied. Also used when command line options are set to immediately start running after loading (seeCLOController.cloRun). -
activeModule
The active module. -
isRunning
protected boolean isRunningThe flag to indicate whether the active model is running. -
pendingAction
The action that is pending (if any). -
COPYRIGHT
-
stateEncoder
Responsible for encoding/restoring state and handling version reporting. -
snapLayoutTimeout
protected int snapLayoutTimeouttimeout for layout process of snapshots in msec.
-
-
Constructor Details
-
EvoLudo
protected EvoLudo()Create an instance of the EvoLudo controller. EvoLudo manages different module/model implementations and the connection between simulations/numerical calculations and the GUI interface as well as the execution environment. This includes logging (verbosity and output channels), restoring previously saved engine states as well saving the current state of the engine, export its data or graphical snapshots.
-
-
Method Details
-
logProgress
Utility method to log progress of simulations. For implementation details seeEvoLudoJREandEvoLudoGWT- Parameters:
msg- progress message
-
logMessage
Convenience method to log messages of simulations.- Parameters:
msg- information message
-
logWarning
Convenience method to log warnings of simulations.- Parameters:
msg- warning message
-
logError
Convenience method to log errors of simulations.- Parameters:
msg- error message
-
getRNG
Get the shared random number generator to ensure the reproducibility of results. This is the only RNG that MUST be used for all calculation, i.e. must be shared with all models including distributions (e.g. for mutations, migration...)Important:
- Must be used for any random numbers related to the modelling.
- Must not be used for anything else, e.g. shared with layout procedures for networks (although it may be desirable to set a seed for the layout routines in a consistent manner if one was set for the simulations, to also ensure visual reproducibility).
- If the number of random numbers drawn changes, any corresponding test fails almost certainly. Tests pass only if the results are identical.
- Returns:
- the one and only random number generator for modelling
- See Also:
-
createNetwork2D
Generate 2D network. This is the factory method to provide different implementations for GWT and JRE. More specifically, the layouting process in GWT uses scheduling (asynchronous execution) to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.- Parameters:
geometry- the geometry backing the 2D network- Returns:
- new instance of a 2D network
-
createNetwork3D
Generate 3D network. This is the factory method to provide different implementations for GWT and JRE. More specifically, the layouting process in GWT uses scheduling (asynchronous execution) to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.Note: The
java3dpackage is obsolete. At present no 3D implementation for java exists.- Parameters:
geometry- the geometry backing the 3D network- Returns:
- new instance of a 3D network
-
loadModel
Set model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models. Notifies all registeredLifecycleListeners of any changes.- Parameters:
type- the type ofModelto load
-
getModel
-
requiresReset
public void requiresReset(boolean reset) Request reset the active model, e.g. after change of parameters.- Parameters:
reset-trueif reset is requested
-
requestParseCLO
public void requestParseCLO()Request full reparsing of the command line options. This is necessary if the command line options have changed in a fundamental way, for example if the number of traits in a module has changed. -
addLifecycleListener
Add a lifecycle listener to the list of listeners that get notified when the model reaches lifecycle milestones.- Parameters:
newListener- the new lifecycle listener
-
removeLifecycleListener
Remove the lifecycle listener from the list of listeners that get notified when the model reaches lifecycle milestones.- Parameters:
obsoleteListener- the listener to remove from list of lifecycle listeners
-
addRunListener
Add a run listener to the list of listeners that get notified about model run state changes.- Parameters:
newListener- the new run listener
-
removeRunListener
Remove the run listener from the list of listeners that get notified when the model run state changes.- Parameters:
obsoleteListener- the listener to remove from list of run listeners
-
addChangeListener
Add a change listener to the list of listeners that get notified when the model changes.- Parameters:
newListener- the new change listener
-
removeChangeListener
Remove the change listener from the list of listeners that get notified when the model changes.- Parameters:
obsoleteListener- the listener to remove from the list of change listeners
-
addSampleListener
Add a change listener to the list of listeners that get notified when the model changes.- Parameters:
newListener- the new change listener
-
removeSampleListener
Remove the change listener from the list of listeners that get notified when the model changes.- Parameters:
obsoleteListener- the listener to remove from the list of change listeners
-
unloadModel
public void unloadModel()Unload model framework. Notifies all registeredLifecycleListeners. -
unloadModel
public void unloadModel(boolean quiet) Unload model framework and, if requested, notifies all registeredLifecycleListeners.- Parameters:
quiet- set totrueto skip notifying listeners
-
modelCheck
public final boolean modelCheck()Check consistency of parameters in all populations.Note: in multi-species interactions optimizations seem sensible only if all populations involved approve of them.
- Returns:
trueif reset is required
-
modelReset
public final void modelReset()Reset all populations and notify all listeners. -
modelReset
public final void modelReset(boolean quiet) Reset all populations and notify all listeners if requested.Note: if
quiet == truestatistics are preserved.- Parameters:
quiet- set totrueto skip notifying listeners
-
modelInit
public final void modelInit()Initialize all populations and notify all listeners. -
modelInit
public final void modelInit(boolean quiet) Initialize all populations and notify all listeners if requested. In contrast tomodelReset(boolean)this method does not re-generate the population structures.- Parameters:
quiet- set totrueto skip notifying listeners
-
modelRelax
public final boolean modelRelax()Relax model bytimeRelaxsteps and notify all listeners when done. If model converged during relaxation notify listeners that model has stopped.- Returns:
trueif converged- See Also:
-
modelRelax
public final boolean modelRelax(boolean quiet) Relax model bytimeRelaxsteps and notify all listeners if requested.- Parameters:
quiet- set totrueto skip notifying listeners- Returns:
trueif converged- See Also:
-
modelNext
public final boolean modelNext()Advance model by one step (reportFrequpdates) and notify all listeners.- Returns:
trueif not converged, i.e. ifmodelNext()can be called again.
-
modelNextDone
public final boolean modelNextDone(boolean cont) Called after the calculations of the next state of the model have finished. For GWT this method serves as a callback for the asynchronous model computations. For JRE this runs in a separate thread from the GUI andmodelNext()directly calls this.- Parameters:
cont-falseif converged or halting time reached- Returns:
trueif not converged, i.e. ifmodelNext()can be called again.
-
paramsDidChange
public boolean paramsDidChange()Called after parameters have changed. Checks new settings and resets population(s) (and/or GUI) if necessary.- Returns:
trueif reset was necessary
-
getCLO
Get the raw command line options, as provided in URL, HTML tag, settings TextArea or command line.- Returns:
- command line options
-
getSplitCLO
Get the command line options split into an array with option names followed by their arguments (if applicable).- Returns:
- array command line options and arguments
-
setCLO
Set the raw command line options, as shown e.g. in the settings TextArea.- Parameters:
clo- the new command line option string
-
isSuspended
public boolean isSuspended()Check whether the current model is suspended.- Returns:
trueif model is suspended
-
setSuspended
public void setSuspended(boolean suspend) Set the flag indicating whether the model is suspended. A suspended model resumes execution as soon as possible. For example after a new set parameters has been checked.- Parameters:
suspend-trueto indicate that model is suspended.
-
setDelay
public void setDelay(int delay) Set delay between subsequent updates.- Parameters:
delay- in milliseconds
-
getDelay
public int getDelay()Get delay between subsequent updates.- Returns:
- the delay in milliseconds
-
increaseDelay
public void increaseDelay()Increase delay between subsequent updates by fixed factor. -
decreaseDelay
public void decreaseDelay()Decrease delay between subsequent updates by fixed factor. -
loadModule
Load new module with keynewModuleKey. If necessary first unload current module. Upon successful loading of a new module the method returnstrue. IfnewModuleKeyis not found but an active module is present, the active module is kept and the method returnstrue. Without an active module the method returnsfalse.- Parameters:
newModuleKey- the key of the module to load- Returns:
- false if
newModuleKeynot found and no active module present; true otherwise
-
unloadModule
public void unloadModule()Unload current module to free up resources.Implementation note:
Called fromloadModule(java.lang.String)to first unload the active module or triggered by GWT'sEvoLudoWeb.onUnload(), i.e. when unloading the GWT application. -
getModule
-
getCloModuleOption
Access the module command line option.- Returns:
- the module option
-
addModule
Addmoduleto lookup table of modules using the module's key. If a GUI is present, add GUI as a listener ofmoduleto get notified about state changes.- Parameters:
module- the module to add to lookup table
-
execute
Executedirectivein JRE or GWT environments.- Parameters:
directive- the directive to execute in appropriate GWT or JRE manners
-
isRunning
public boolean isRunning()Check if the active model is running.- Returns:
trueif model is running
-
layoutComplete
public void layoutComplete()Notification from GUI that layout process has finished. Opportunity for taking snapshots. -
stop
public void stop()Requests halting of a runningModelon the next opportunity. -
run
public abstract void run()Start the EvoLudo model and calculate the dynamics one step at a time. -
next
public abstract void next()Advances the EvoLudo model by a single step. Called when pressing the 'Step' button, the 'n' or 'right-arrow' key. -
startStop
public void startStop()Start or stop EvoLudo model. If model is running wait until next update is completed to prevent unexpected side effects. -
prev
public void prev()Attempts to backtrack a single step of the EvoLudo model. Called when pressing the 'Prev' button, the 'p' or 'left-arrow' key. -
debug
public void debug()Advances the EvoLudo model by a single debugging step. Called when pressing the 'Debug' button or 'D' key. -
simulation
public void simulation()Run simulation. Currently only implemented by EvoLudoJRE. Returns control to caller only if the arguments inclodo not match requirements for running a simulation.- See Also:
-
requestAction
Requests aChangeListener.PendingActionto be processed on the next opportunity. If model is not running the action is processed immediately.- Parameters:
action- the action requested
-
requestAction
Requests aChangeListener.PendingActionto be processed on the next opportunity. If model is not running ornowis set totruethe action is processed immediately.- Parameters:
action- the action requestednow-trueto processes action immediately
-
fireModuleLoaded
public void fireModuleLoaded()Called whenever a new module has finished loading. Notifies all registeredLifecycleListeners. -
fireModuleUnloaded
public void fireModuleUnloaded()Called whenever the current module has finished unloading. Notifies all registeredLifecycleListeners. -
fireModuleRestored
public void fireModuleRestored()Called after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the--restorecommand line argument. Notifies all registeredLifecycleListeners.- See Also:
-
fireModelLoaded
public void fireModelLoaded()Called whenever a new model has finished loading. Notifies all registeredLifecycleListeners. -
fireModelUnloaded
public void fireModelUnloaded()Called whenever a new model has finished loading. Notifies all registeredLifecycleListeners. -
fireModelRunning
public void fireModelRunning()Called whenever the model starts its calculations. Fires only when starting to run. Notifies all registeredRunListeners. -
fireModelChanged
public void fireModelChanged()Called whenever the state of the model has changed. For example, to trigger the update of the state displayed in the GUI. Processes pending actions and notifies all registeredRunListeners.- See Also:
-
processPendingAction
void processPendingAction()Helper to process pending actions. Delegates toRunControllerbut exposed for subclasses that need to hook additional behavior. -
fireModelSample
public boolean fireModelSample(boolean success) Called after the population has reached an absorbing state (or has converged to an equilibrium state). Notifies all registeredRunListeners.- Parameters:
success-trueif sample completed successfully- Returns:
trueto continue with next sample- See Also:
-
fireSettingsChanged
public void fireSettingsChanged()Called whenever the settings of the model have changed. For example, to trigger the range of values or markers in the GUI. Notifies all registeredRunListeners.- See Also:
-
fireModelInit
public void fireModelInit()Called after the model has been re-initialized. Notifies all registeredRunListeners. -
fireModelReset
public void fireModelReset()Called after the model has been reset. Notifies all registeredRunListeners. -
fireModelRelaxed
public void fireModelRelaxed()Called after the model completed its relaxation. Notifies all registeredRunListeners. -
fireModelStopped
public void fireModelStopped()Called after the population has reached an absorbing state (or has converged to an equilibrium state). Notifies all registeredRunListeners. -
getLogger
Note: Instead of sharing logging system, EvoLudo could implement helper routines for logging notifications. However, when logging notifications with a severity ofLevel.WARNINGor higher the default logging message includes the name of the calling routine and hence would always refer to the (unhelpful) helper routines.- Returns:
- logger of this EvoLudo controller
-
hirePDESupervisor
Hire supervisor for managing PDE calculations. This is the factory method provide different implementations For GWT and JRE. More specifically, GWT uses asynchronous execution to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.- Parameters:
charge- the PDE model to supervise- Returns:
- supervisor for coordinating PDE calculations
- See Also:
-
getVersion
Return version string of current model. Version must include reference to git commit to ensure reproducibility of results.- Returns:
- the version string
-
getJavaVersion
Get version of JRE (if not running in browser).- Returns:
- the java version string
-
getGit
Gets current git version of code base.- Returns:
- the git version string
-
getGitDate
Gets the compilation date of the current git version.- Returns:
- the git compilation date as a string
-
getSnapLayoutTimeout
public int getSnapLayoutTimeout()Gets the timeout for the layout process of snapshots in msec.- Returns:
- timeout in msec
-
writeHeader
public void writeHeader()Write header of report tooutput(currently JRE only). The information should include items like the version of the EvoLudo code, the current date and the string of command line options for reproducibility. -
exportState
public abstract void exportState()Export the current state of the engine using the appropriate means available in the current environment (GWT/JRE).- See Also:
-
encodeState
Encode current state of EvoLudo model as XML string (plist format).- Returns:
- encoded state
-
restoreFromFile
public abstract boolean restoreFromFile()Restore state of EvoLudo model from saved plist, which encodes engine state.- Returns:
trueon successfully restoring state- See Also:
-
restoreState
Restore state of EvoLudo model from pre-processed plist, which encodes engine state (seeencodeState()).Note: the appropriate model must already have been loaded and the command line arguments specified with the key
CLOin theplistmust also have been processed already.In JRE the options in
plistare merged with any other command line arguments (albeit the ones inplisthave priority to minimize the chance of complications). In GWTrestoreState(Plist)is overridden to first deal with the command line arguments.- Parameters:
plist- the lookup table with key value pairs- Returns:
trueon successfully restoring state
-
addCLOProvider
Registercloas a provider of command line options. Initialize command line parser if necessary.- Parameters:
provider- the option provider to add
-
removeCLOProvider
Unregistercloas a provider of command line options.- Parameters:
provider- the option provider to remove
-
preprocessCLO
Pre-process array of command line arguments. Some arguments need priority treatment. Examples include the options--module,--verboseor--restore.--module- load module and remove option
--verbose- set verbosity level effective immediately. This ensures that issues when parsing the remaining command line options are already properly reported
- Parameters:
cloarray- array of command line arguments- Returns:
- pre-processed array of command line options
- See Also:
-
parseCLO
public int parseCLO()Parse command line options.- Returns:
- the number of issues that have occurred durin parsing
- See Also:
-
parseCLO
Pre-process and parse array of command line arguments.- Parameters:
cloarray- string array of command line arguments- Returns:
- the number of issues that have occurred durin parsing
- See Also:
-
getCLOHelp
Format, encode and output help on command line options.- Returns:
- the help string
-
showHelp
public abstract void showHelp()Show help on command line options. -
collectCLO
All providers of command line options must implement this method to collect their options.Each command line option is (uniquely) identified by it's name (see
CLOption.getName()), which corresponds to the long version of the option. If an attempt is made to add an option with a name that already exists, theparserissues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and callsuper.collectCLO(CLOParser)at the end such that subclasses are able to override command line options specified in a parental class.Override this method in subclasses to add further command line options. Subclasses must make sure that they include a call to super.
Note: In contrast to other providers of command line options, the EvoLudo class delegates collection to the controller which maintains the shared parser.
- Specified by:
collectCLOin interfaceCLOProvider- Parameters:
prsr- the reference to parser that manages command line options- See Also:
-
fatal
Report error and stop model execution, if running.IMPORTANT: Does not return control to caller.
- Parameters:
msg- the error message
-
loadModules
public void loadModules()Load all available modules. Specific modules are the responsibility of the caller.
-