Package io.github.ai4ci.flow
Class SimulationExecutor
java.lang.Object
java.lang.Thread
io.github.ai4ci.util.PauseableThread
io.github.ai4ci.flow.SimulationExecutor
- All Implemented Interfaces:
Runnable
Executes a single simulation to completion under supervision by the monitor.
The monitor
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionSimulationExecutor
(SimulationMonitor mon, Outbreak outbreak, StateExporter exporter, int toStep) -
Method Summary
Methods inherited from class io.github.ai4ci.util.PauseableThread
halt, isWaiting, pause, run, unpause
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
SimulationExecutor
public SimulationExecutor(SimulationMonitor mon, Outbreak outbreak, StateExporter exporter, int toStep)
-
-
Method Details
-
setup
public void setup()Description copied from class:PauseableThread
Run on thread once at the start. Can setup thread local resources. Constructor can be used to set up shared resources.- Specified by:
setup
in classPauseableThread
-
doLoop
public void doLoop()Description copied from class:PauseableThread
Repeatedly called while the thread is not paused or halting. This can interact with resources shared with other threads but needs to be synchronised on them (or use non blocking). This operates equivalent to a `while (!isComplete()) {doLoop();}`- Specified by:
doLoop
in classPauseableThread
-
isComplete
public boolean isComplete()Description copied from class:PauseableThread
Signify the thread loop is complete and proceed to shutdown. This is checked even if the thread is paused.- Specified by:
isComplete
in classPauseableThread
-
shutdown
public void shutdown(boolean completedNormally) Description copied from class:PauseableThread
Shutdown the thread. This must close down any resources and exit without error.- Specified by:
shutdown
in classPauseableThread
- Parameters:
completedNormally
- did the loop complete or was the thread halted?
-
status
- Overrides:
status
in classPauseableThread
-