|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Presentable
com.xj.anylogic.engine.Utilities
com.xj.anylogic.engine.Experiment<ROOT>
com.xj.anylogic.engine.ExperimentSimulation<ROOT>
ROOT - class of root objectpublic abstract class ExperimentSimulation<ROOT extends ActiveObject>
The simplest possible experiment consisting of a single simulation
run. One should implement the createRoot() method in a subclass to set a
particular model to this experiment.
A typical usage pattern is here:
public class MyExperiment extends ExperimentSimulation {
public ActiveObject createRoot( Engine engine ) {
MyMain root = new MyMain( engine, null, null );
//set parameters of root if needed
...
return root;
}
public void setup( JApplet applet ) {
Engine eng = getEngine();
//set engine stop time, time mode, etc.
...
Presentation p = new Presentation( ex, null );
p.start();
//set presentation size, configure toolbar, etc.
...
}
public static void main( String[] args ) {
MyExperiment ex = new MyExperiment();
ex.setName( "My Experiment" );
ex.setup( null );
}
}
Code for an applet that runs such experiment would look like this:
public class MyApplet extends JApplet {
MyExperiment ex;
public void init() {
ex = new MyExperiment();
ex.setName( "My Experiment" );
ex.setup( this );
}
public void destroy() {
ex.stop();
}
}
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.Experiment |
|---|
ERROR, FINISHED, IDLE, modelExecutionCommandQueue, mutexModelActionQueue, OPEN_RESULTS, OPEN_SNAPSHOT, PAUSE, PAUSED, PLEASE_WAIT, RUN, RUNNING, SAVE_RESULTS, SAVE_SNAPSHOT, STEP, STOP |
| Fields inherited from class com.xj.anylogic.engine.Utilities |
|---|
AM, APRIL, AUGUST, DAY, DECEMBER, FEBRUARY, FRIDAY, HOUR, infinity, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK, YEAR |
| Constructor Summary | |
|---|---|
ExperimentSimulation()
Creates the experiment and a new simulation engine that will be used for all simulations. |
|
| Method Summary | |
|---|---|
void |
customRunPause_xjal(boolean absoluteTime,
double t)
Deprecated. this method shouldn't be called by user and may be removed/renamed in the next release |
com.xj.anylogic.engine.internal.ActiveView |
ep_xjal()
This method shouldn't be accessed by user is public due to technical reasons |
void |
finish()
Sets a flag that, when tested by the engine, causes it to finish after completing the current event execution. |
Engine |
getEngine()
Returns the engine executing the model. |
double |
getProgress()
Returns the progress of the experiment: in this case it is the same as the progress of the current simulation run. |
double |
getRunTimeSeconds()
Returns the real duration of the experiment in seconds, excluding pause times, in this case it is same as duration of the simulation run. |
int |
getState()
Returns the current state of the experiment. |
void |
pause()
Pauses the model execution. |
void |
registerPresentation_xjal(Presentation presentation)
This method isn't designed to be called by user. |
void |
run()
Runs the model from the current state. |
abstract void |
setupRootParameters(ROOT root,
boolean callOnChangeActions)
Is called to setup parameters of root active object. |
void |
step()
Performs one step of the model execution. |
void |
stop()
Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data. |
| Methods inherited from class com.xj.anylogic.engine.Experiment |
|---|
close, createRoot, error, getCommandLineArguments, getMutexRead_xjal, getMutexWrite_xjal, getName, getPresentation, getRunCount, getSnapshotFileName, getStep, getWindowHeight, getWindowWidth, initDefaultRandomNumberGenerator, isCommandEnabled, isLoadRootFromSnapshot, onBeforeSimulationRun, onDestroy_xjal, onDestroy, onEngineFinished, onError, reset, setCommandLineArguments_xjal, setLoadRootFromSnapshot, setName, setup, setupEngine |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExperimentSimulation()
| Method Detail |
|---|
public Engine getEngine()
getEngine in class Presentablepublic int getState()
getState in class Experiment<ROOT extends ActiveObject>public double getProgress()
getProgress in class Experiment<ROOT extends ActiveObject>public double getRunTimeSeconds()
getRunTimeSeconds in class Experiment<ROOT extends ActiveObject>public void run()
run in class Experiment<ROOT extends ActiveObject>
@Deprecated
public void customRunPause_xjal(boolean absoluteTime,
double t)
public void step()
step in class Experiment<ROOT extends ActiveObject>public void pause()
pause in class Experiment<ROOT extends ActiveObject>Engine.pause()public void finish()
Engine.finish()public void stop()
stop in class Experiment<ROOT extends ActiveObject>Engine.stop()
public abstract void setupRootParameters(ROOT root,
boolean callOnChangeActions)
root - the root active object instancecallOnChangeActions - if true this method should
use set_* methods of root to setup
parameters, otherwise parameter values should be simply
assigned to the fields of rootpublic final com.xj.anylogic.engine.internal.ActiveView ep_xjal()
public void registerPresentation_xjal(Presentation presentation)
Experiment
registerPresentation_xjal in class Experiment<ROOT extends ActiveObject>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||