public abstract class SimulationController extends AbstractModel implements Runnable, EventScheduler, Serializable
Report
objects in the simulation.Modifier and Type | Field and Description |
---|---|
protected int |
batch
The index of the current simulation.
|
protected boolean |
isRunning |
protected boolean |
listenersInitialised |
protected String |
modelDescription
A human-readable description of the model that can
be presented to the user of the model, e.g.
|
protected int |
numSimulations
The total number of simulations to run.
|
protected ArrayList<Report> |
reports
The reports that will collect data on the simulations.
|
protected Simulation |
simulation
The underlying simulation.
|
protected SimulationFactory |
simulationFactory
The simulationFactory is responsible for initialising
the simulation at the beginning of each run.
|
protected int |
slowSleepInterval |
deleteQueue, genericListeners, specificListeners
Constructor and Description |
---|
SimulationController() |
Modifier and Type | Method and Description |
---|---|
void |
addReport(Report report) |
protected abstract void |
constructSimulation() |
void |
fireEvent(SimEvent event) |
String |
getModelDescription() |
int |
getNumSimulations()
Fetch the total number of simulations to run in this batch.
|
Population |
getPopulation()
Fetch the Population of the current simulation.
|
ArrayList<Report> |
getReports() |
Simulation |
getSimulation() |
SimulationFactory |
getSimulationFactory() |
SimulationTime |
getSimulationTime()
Query the simulation time in the currently running simulation.
|
int |
getSlowSleepInterval() |
boolean |
isRunning() |
void |
run()
Run the batch of simulations in sequence.
|
void |
runSingleSimulation()
Run a single simulation.
|
protected void |
setListeners()
Establish any listening relationships that are required prior
to launching a new simulation.
|
void |
setModelDescription(String modelDescription) |
void |
setNumSimulations(int numSimulations)
Configure the number of independent simulations to run as
part of a Monte-carlo experiment.
|
void |
setReports(ArrayList<Report> reports)
Configure the reports for this simulation.
|
void |
setSimulation(Simulation simulation) |
void |
setSimulationFactory(SimulationFactory simulationInitialiser)
Configure the initialiser for this simulation.
|
void |
setSlowSleepInterval(int slowSleepInterval) |
void |
slow(int slowSleepInterval)
Slow down the simulation by sleeping for the specified
interval in between simulation steps.
|
protected void |
tearDownSimulation()
Remove listeners prior to reconstructing the simulation object.
|
void |
terminate()
Terminate all simulations.
|
protected void |
wireReports()
Establish the listening relationships for Report objects.
|
protected void |
wireSimulation()
Configure the listener relationships for the simulation object.
|
addListener, addListener, clearListeners, clone, notifyGenericListeners, notifySpecificListeners, processDeleteQueue, removeListener
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListener, addListener, removeListener
protected int batch
protected int numSimulations
protected Simulation simulation
protected SimulationFactory simulationFactory
protected boolean listenersInitialised
protected boolean isRunning
protected int slowSleepInterval
protected String modelDescription
public void run()
public void runSingleSimulation()
public SimulationTime getSimulationTime()
getSimulationTime
in interface EventScheduler
public void fireEvent(SimEvent event)
fireEvent
in interface EventScheduler
fireEvent
in class AbstractModel
public void terminate()
public Population getPopulation()
public void setReports(ArrayList<Report> reports)
reports
- Report
public void addReport(Report report)
public int getNumSimulations()
public void setNumSimulations(int numSimulations)
numSimulations
- public Simulation getSimulation()
public void setSimulation(Simulation simulation)
public SimulationFactory getSimulationFactory()
public void setSimulationFactory(SimulationFactory simulationInitialiser)
simulationInitialiser
- SimulationFactory
public int getSlowSleepInterval()
public void setSlowSleepInterval(int slowSleepInterval)
public void slow(int slowSleepInterval)
slowSleepInterval
- public boolean isRunning()
protected void setListeners()
protected void wireReports()
protected void wireSimulation()
protected void tearDownSimulation()
public String getModelDescription()
public void setModelDescription(String modelDescription)
protected abstract void constructSimulation()
Copyright © 2014. All rights reserved.