Class EvoLudoGWT
- All Implemented Interfaces:
MersenneTwister.Chronometer
,CLOProvider
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from class EvoLudo
EvoLudo.ColorModelType, EvoLudo.Directive
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal CLOption
Command line option to mimic ePub modes and to disable device capabilities.final CLOption
Command line option to request that the EvoLudo model signals the completion of of the layouting procedure for taking snapshots, e.g.private final Duration
Create timer to measure execution times since instantiation.boolean
true
if ePub has keyboard deviceboolean
true
if ePub has mouse deviceboolean
true
if ePub has touch deviceboolean
true
if standalone EvoLudo lab in ePub(package private) Element
The reference to the fullscreen element.protected ContextMenuCheckBoxItem
The field to store the fullscreen context menu.(package private) EvoLudoWeb
The reference to the GUI.boolean
true
if part of an ePubboolean
true
if container document is XHTML(package private) EvoLudo.Directive
The field to store the command to execute after parsing the command line options.protected double
The generation at which to request a snapshot.(package private) double
The number of samples after which to stop.private ContextMenuCheckBoxItem
The context menu item for symmetrical diffusion (only applies to PDE models).(package private) Timer
Timer for running models.private ContextMenuCheckBoxItem
The context menu item to reverse time.Fields inherited from class EvoLudo
activeModel, activeModule, catGlobal, catGUI, catModel, catModule, catSimulation, changeListeners, clo, cloDelay, cloHelp, cloModel, cloModule, cloRNG, cloRun, cloSeed, cloTraitColorScheme, cloTrajectoryColor, cloVerbose, colorModelType, COPYRIGHT, cpu, cpuMean, cpuSamples, cpuVar, delay, DELAY_INIT, DELAY_MAX, DELAY_MIN, hasTouch, ID, isGWT, isRunning, isSuspended, logger, milestoneListeners, modules, parser, pendingAction, rng, snapLayoutTimeout
-
Constructor Summary
ConstructorsConstructorDescriptionEvoLudoGWT
(EvoLudoWeb gui) Construct EvoLudo controller for GWT applications (web or ePub). -
Method Summary
Modifier and TypeMethodDescriptionvoid
collectCLO
(CLOParser prsr) All providers of command line options must implement this method to collect their options.createNetwork2D
(Geometry geometry) Generate 2D network.createNetwork3D
(Geometry geometry) Generate 3D network.void
Use JSNI helper methods to query and detect features of the execution environment.int
Calculate elapsed time since instantiation in milliseconds.void
execute
(EvoLudo.Directive directive) Executedirective
in JRE or GWT environments.void
Export the current state of the engine using the appropriate means available in the current environment (GWT/JRE).void
Called after the model has been reset.void
Called after the population has reached an absorbing state (or has converged to an equilibrium state).void
Called whenever the current module has finished unloading.getGit()
Gets current git version of code base.Gets the compilation date of the current git version.void
guiReady()
Called when the GUI has finished loading and the dimensions of all elements are known.hirePDESupervisor
(PDE charge) Hire supervisor for managing PDE calculations.void
Notification from GUI that layout process has finished.void
logProgress
(String msg) GWT uses the config channel of the logger to report progressvoid
next()
Advances the EvoLudo model by a single step.boolean
parseCLO
(EvoLudo.Directive command) Parse command line options and set thecommand
to execute after parsing completed.void
Opportunity to contribute entries to the context menu for models.protected String[]
preprocessCLO
(String[] cloarray) Pre-process array of command line arguments.(package private) void
Helper method for handling model changed events and processes pending actions.boolean
Restore state of EvoLudo model from saved plist, which encodes engine state.void
run()
Start the EvoLudo model and calculate the dynamics one step at a time.private void
Schedule the next sample.private void
Schedule the next step.void
setDelay
(int delay) Set delay between subsequent updates.void
setFullscreen
(boolean fullscreen) Enter or exit fullscreen mode.void
setFullscreenElement
(Element element) Set the fullscreen element.void
showHelp()
Show help on command line options.Methods inherited from class EvoLudo
addChangeListener, addCLOProvider, addMilestoneListener, addModule, createIBS, createODE, createPDE, createSDE, debug, decreaseDelay, dumpEnd, dumpParameters, encodeState, endCPUSample, fatal, fireModelChanged, fireModelInit, fireModelLoaded, fireModelRelaxed, fireModelRunning, fireModelUnloaded, fireModuleLoaded, fireModuleRestored, fireSettingsChanged, getCLO, getCLOHelp, getColorModelType, getDelay, getJavaVersion, getLogger, getModel, getModule, getRNG, getSnapLayoutTimeout, getSplitCLO, getVersion, increaseDelay, isRunning, isSuspended, loadModel, loadModule, logError, logMessage, logWarning, modelCheck, modelInit, modelInit, modelNext, modelNextDone, modelRelax, modelRelax, modelReset, modelReset, paramsDidChange, parseCLO, parseCLO, prev, removeChangeListener, removeCLOProvider, removeMilestoneListener, requestAction, requestAction, requestParseCLO, requiresReset, resetCPUSample, restoreState, setCLO, setColorModelType, setSuspended, simulation, startCPUSample, startStop, stop, unloadModel, unloadModel, unloadModule
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface CLOProvider
adjustCLO
-
Field Details
-
isXML
public boolean isXMLtrue
if container document is XHTML -
isEPub
public boolean isEPubtrue
if part of an ePub -
ePubStandalone
public boolean ePubStandalonetrue
if standalone EvoLudo lab in ePub -
ePubHasMouse
public boolean ePubHasMousetrue
if ePub has mouse device -
ePubHasTouch
public boolean ePubHasTouchtrue
if ePub has touch device -
ePubHasKeys
public boolean ePubHasKeystrue
if ePub has keyboard device -
snapshotAt
protected double snapshotAtThe generation at which to request a snapshot. -
statisticsAt
double statisticsAtThe number of samples after which to stop. If negative no limit is set. -
elapsedTime
Create timer to measure execution times since instantiation. -
gui
EvoLudoWeb guiThe reference to the GUI. -
notifyGUI
EvoLudo.Directive notifyGUIThe field to store the command to execute after parsing the command line options. -
timer
Timer timerTimer for running models. -
timeReverseMenu
The context menu item to reverse time. -
symDiffMenu
The context menu item for symmetrical diffusion (only applies to PDE models). -
fullscreenMenu
The field to store the fullscreen context menu. -
fullscreenElement
Element fullscreenElementThe reference to the fullscreen element. -
cloGUIFeatures
Command line option to mimic ePub modes and to disable device capabilities.Note: for development/debugging only; should be disabled in production
-
cloSnap
Command line option to request that the EvoLudo model signals the completion of of the layouting procedure for taking snapshots, e.g. withcapture-website
.
-
-
Constructor Details
-
EvoLudoGWT
Construct EvoLudo controller for GWT applications (web or ePub).- Parameters:
gui
- the reference to the GUI
-
-
Method Details
-
logProgress
GWT uses the config channel of the logger to report progress- Specified by:
logProgress
in classEvoLudo
- Parameters:
msg
- progress message
-
execute
Description copied from class:EvoLudo
Executedirective
in JRE or GWT environments. -
parseCLO
Parse command line options and set thecommand
to execute after parsing completed.- Parameters:
command
- the command to execute after parsing- Returns:
true
if parsing was successful
-
showHelp
public void showHelp()Description copied from class:EvoLudo
Show help on command line options. -
guiReady
public void guiReady()Called when the GUI has finished loading and the dimensions of all elements are known. -
layoutComplete
public void layoutComplete()Description copied from class:EvoLudo
Notification from GUI that layout process has finished. Opportunity for taking snapshots.- Overrides:
layoutComplete
in classEvoLudo
-
run
public void run()Description copied from class:EvoLudo
Start the EvoLudo model and calculate the dynamics one step at a time. -
next
public void next()Description copied from class:EvoLudo
Advances the EvoLudo model by a single step. Called when pressing the 'Step' button, the 'n' or 'right-arrow' key. -
scheduleSample
private void scheduleSample()Schedule the next sample. -
scheduleStep
private void scheduleStep()Schedule the next step. -
fireModuleUnloaded
public void fireModuleUnloaded()Description copied from class:EvoLudo
Called whenever the current module has finished unloading. Notifies all registeredMilestoneListener
s.- Overrides:
fireModuleUnloaded
in classEvoLudo
-
fireModelReset
public void fireModelReset()Description copied from class:EvoLudo
Called after the model has been reset. Notifies all registeredMilestoneListener
s.- Overrides:
fireModelReset
in classEvoLudo
-
fireModelStopped
public void fireModelStopped()Description copied from class:EvoLudo
Called after the population has reached an absorbing state (or has converged to an equilibrium state). Notifies all registeredMilestoneListener
s.- Overrides:
fireModelStopped
in classEvoLudo
-
processPendingAction
void processPendingAction()Description copied from class:EvoLudo
Helper method for handling model changed events and processes pending actions.- Overrides:
processPendingAction
in classEvoLudo
- See Also:
-
preprocessCLO
Pre-process array of command line arguments. Some arguments need priority treatment. Examples include the options--module
,--verbose
or--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
The command line arguments stored in a typical
.plist
file -- in particular when generated by the--export
option -- includes this very option. Since JavaScript (GWT) contracts do not permit access to the users file system without explicit user interaction the--export
does not make sense. However, it would still be useful to be able to restore the state of such a file in the browser through drag'n'drop. Here we simply check if--export
was provided on the command line and discard it if found.- Overrides:
preprocessCLO
in classEvoLudo
- Parameters:
cloarray
- array of command line arguments- Returns:
- pre-processed array of command line options
- See Also:
-
elapsedTimeMsec
public int elapsedTimeMsec()Description copied from class:EvoLudo
Calculate elapsed time since instantiation in milliseconds.Hide GWT/JRE differences in measuring execution time.
- Specified by:
elapsedTimeMsec
in interfaceMersenneTwister.Chronometer
- Specified by:
elapsedTimeMsec
in classEvoLudo
- Returns:
- time in milliseconds
- See Also:
-
hirePDESupervisor
Description copied from class:EvoLudo
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.- Specified by:
hirePDESupervisor
in classEvoLudo
- Parameters:
charge
- the PDE model to supervise- Returns:
- supervisor for coordinating PDE calculations
- See Also:
-
createNetwork2D
Description copied from class:EvoLudo
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.- Specified by:
createNetwork2D
in classEvoLudo
- Parameters:
geometry
- the geometry backing the 2D network- Returns:
- new instance of a 2D network
-
createNetwork3D
Description copied from class:EvoLudo
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
java3d
package is obsolete. At present no 3D implementation for java exists.- Specified by:
createNetwork3D
in classEvoLudo
- Parameters:
geometry
- the geometry backing the 3D network- Returns:
- new instance of a 3D network
-
getGit
Description copied from class:EvoLudo
Gets current git version of code base. -
getGitDate
Description copied from class:EvoLudo
Gets the compilation date of the current git version.- Specified by:
getGitDate
in classEvoLudo
- Returns:
- the git compilation date as a string
-
setDelay
public void setDelay(int delay) Description copied from class:EvoLudo
Set delay between subsequent updates. -
detectGUIFeatures
public void detectGUIFeatures()Use JSNI helper methods to query and detect features of the execution environment.- See Also:
-
populateContextMenu
Opportunity to contribute entries to the context menu for models. this needs to be quarantined in order to not interfere with java simulations.- Parameters:
menu
- the context menu where entries can be added
-
setFullscreenElement
Set the fullscreen element.- Parameters:
element
- the element to set as fullscreen
-
setFullscreen
public void setFullscreen(boolean fullscreen) Enter or exit fullscreen mode.- Parameters:
fullscreen
-true
to enter fullscreen
-
restoreFromFile
public boolean restoreFromFile()Restore state of EvoLudo model from saved plist, which encodes engine state.Called by
Restore...
context menu inAbstractView
.- Specified by:
restoreFromFile
in classEvoLudo
- Returns:
true
on successfully restoring state- See Also:
-
exportState
public void exportState()Export the current state of the engine using the appropriate means available in the current environment (GWT/JRE).Note: nudges web browser to download the current state and save it in a file named "evoludo.plist". Export (context menu) suppressed in ePubs.
- Specified by:
exportState
in classEvoLudo
- See Also:
-
collectCLO
Description copied from class:EvoLudo
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, theparser
issues 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 maintains a reference to the parser (
prsr
andparser
must be identical).- Specified by:
collectCLO
in interfaceCLOProvider
- Overrides:
collectCLO
in classEvoLudo
- Parameters:
prsr
- the reference to parser that manages command line options- See Also:
-