|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.engine.BaseController
uchicago.src.sim.engine.BatchController
public class BatchController
A controller for running a simulation over multiple runs.
See SimInit for more on how to run a
simulation in batch mode. BatchController should not be
created by a user under normal circumstances.
SimInit| Field Summary | |
|---|---|
protected boolean |
autoRecording
whether or not the controller is automatically recording the parameters of the model |
protected long |
batchCount
|
protected java.util.ArrayList |
batchListeners
|
protected java.util.ArrayList |
dynNameList
|
protected boolean |
finished
|
protected java.util.ArrayList |
nameList
|
protected java.util.Hashtable |
nameParam
|
protected java.lang.String[] |
pArray
|
protected DataRecorder |
recorder
|
protected boolean |
stopped
|
| Fields inherited from class uchicago.src.sim.engine.BaseController |
|---|
done, doStep, executeBegin, exitOnExit, go, isGui, listenerList, model, monitor, params, pauseActionsExecuted, pauseAt, pauseAtAction, pauseSim, persistentObj, runFinished, runThread, schedule, simRun, sleepValue, time |
| Constructor Summary | |
|---|---|
BatchController(ParameterSetter parameters)
Creates a BatchController with the specified model parameters. |
|
| Method Summary | |
|---|---|
void |
addBatchListener(BatchListener listener)
adds a batch listener to this batch controller |
void |
begin()
Begins the batch runs |
boolean |
doWriteHeader(java.lang.String fileName)
Deprecated. now uses the persistent object mechanism. |
void |
endSim()
shuts down a simulation even if it is in the middle of a run |
void |
exitSim()
Exits the entire simulation. |
protected void |
fireBatchEvent(BatchEvent evt)
|
long |
getRunCount()
Gets the number of the current batch run |
void |
incrementBatchCount()
Increment the batchCount. |
boolean |
isAutoRecording()
This determines if the BatchController will automatically record the parameters from the model at the end of a simulation run. |
boolean |
isBatch()
Is this a batch run. |
boolean |
isGUI()
If this is a GUI controller, always false. |
void |
onTickCountUpdate()
This fires a tick changed batch event every tick |
void |
removeBatchListener(BatchListener listener)
removes a batch listener from this controller |
void |
setAutoRecording(boolean autoRecording)
This determines if the BatchController will automatically record the parameters from the model at the end of a simulation run. |
void |
setModel(SimModel model)
Sets the model to be controlled by this BatchController. |
void |
setWriteHeader(java.lang.String filename,
boolean val)
Deprecated. |
void |
simEventPerformed(SimEvent evt)
Called by a source on which this is a listener when a SimEvent is performed. |
void |
start()
Starts an individual run of the simulation |
void |
stopRun()
Stops an individual run of the simulation, increments the parameters appropriately, and if necessary starts another run. |
| Methods inherited from class uchicago.src.sim.engine.BaseController |
|---|
addSimEventListener, beginModel, fireSimEvent, getCellDepth, getCellHeight, getCellWidth, getCurrentTime, getDefaultModelParameters, getExitOnExit, getModel, getModelParameters, getPauseAt, getPersistentObj, getRandomSeed, getSchedule, notifyMonitor, pauseSim, putPersistentObj, removeSimEventListener, setCellDepth, setCellHeight, setCellWidth, setExitOnExit, setPauseAt, setRandomSeed, setSchedule, setupSchedule, startSim, stopSim |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String[] pArray
protected long batchCount
protected java.util.ArrayList nameList
protected java.util.ArrayList dynNameList
protected java.util.Hashtable nameParam
protected java.util.ArrayList batchListeners
protected volatile boolean finished
protected boolean stopped
protected DataRecorder recorder
protected boolean autoRecording
| Constructor Detail |
|---|
public BatchController(ParameterSetter parameters)
parameters - the parameters with which to run the simulation| Method Detail |
|---|
public void setModel(SimModel model)
setModel in interface IControllersetModel in class BaseControllermodel - the model to be controlled by this BatchControllerpublic long getRunCount()
public boolean doWriteHeader(java.lang.String fileName)
fileName - the name of the file whose header should or should not
be written.
public void setWriteHeader(java.lang.String filename,
boolean val)
filename - the name of the file whose header should or should not
be writtenval - true if the header should be written, otherwise falsepublic void onTickCountUpdate()
onTickCountUpdate in class BaseControllerpublic void begin()
public void start()
public boolean isAutoRecording()
public void setAutoRecording(boolean autoRecording)
autoRecording - whether or not to automatically record the parameterspublic void stopRun()
public void simEventPerformed(SimEvent evt)
SimEvent is performed. This only listens for stop
events and stops the sim when it receives the event.
public void endSim()
public void exitSim()
IController
protected void fireBatchEvent(BatchEvent evt)
public void incrementBatchCount()
public void addBatchListener(BatchListener listener)
listener - the listener to removepublic void removeBatchListener(BatchListener listener)
listener - the listener to removepublic boolean isBatch()
isBatch in interface IControllerisBatch in class BaseControllerpublic boolean isGUI()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||