Package repast.simphony.batch
Class BatchRunner
- java.lang.Object
-
- repast.simphony.batch.BatchRunner
-
- All Implemented Interfaces:
RunListener
public class BatchRunner extends Object implements RunListener
Runs a simulation in batch mode.- Author:
- Nick Collier
-
-
Field Summary
Fields Modifier and Type Field Description protected Controller
controller
protected Object
monitor
protected boolean
pause
protected SweeperProducer
producer
-
Constructor Summary
Constructors Constructor Description BatchRunner()
BatchRunner(boolean interactive)
BatchRunner(boolean interactive, int runNumber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createScenario(BatchScenarioCreator creator)
SweeperProducer
getSweeperProducer()
protected boolean
keepRunning()
void
loadScenario(File scenarioDir)
protected void
notifyMonitor()
void
paused()
Invoked when the current run has been paused.protected void
printMemoryStats(String header)
void
restarted()
Invoked when the current run has been restarted after a pause.protected void
run()
void
run(File scenarioDir)
Run a pre-built scenario.void
run(BatchScenarioCreator creator)
Run a scenario created from the specified BatchScenarioCreator.void
setSweeperProducer(SweeperProducer producer)
void
started()
Invoked when the current run has been started.void
stopped()
Invoked when the current run has been stopped.protected void
waitForRun()
-
-
-
Field Detail
-
controller
protected Controller controller
-
pause
protected boolean pause
-
monitor
protected Object monitor
-
producer
protected SweeperProducer producer
-
-
Method Detail
-
getSweeperProducer
public SweeperProducer getSweeperProducer()
-
setSweeperProducer
public void setSweeperProducer(SweeperProducer producer)
-
run
public void run(File scenarioDir) throws ScenarioLoadException
Run a pre-built scenario.- Parameters:
scenarioDir
-- Throws:
org.java.plugin.PluginLifecycleException
saf.core.runtime.PluginDefinitionException
IOException
ParserConfigurationException
SAXException
ClassNotFoundException
IllegalAccessException
InstantiationException
IntrospectionException
ParameterFormatException
ScenarioLoadException
-
loadScenario
public void loadScenario(File scenarioDir) throws ScenarioLoadException
- Throws:
ScenarioLoadException
-
run
public void run(BatchScenarioCreator creator) throws ClassNotFoundException, IOException
Run a scenario created from the specified BatchScenarioCreator.- Parameters:
creator
- the creator- Throws:
ClassNotFoundException
IOException
-
createScenario
public void createScenario(BatchScenarioCreator creator) throws ClassNotFoundException, IOException
- Throws:
ClassNotFoundException
IOException
-
keepRunning
protected boolean keepRunning()
-
run
protected void run()
-
printMemoryStats
protected void printMemoryStats(String header)
-
waitForRun
protected void waitForRun()
-
notifyMonitor
protected void notifyMonitor()
-
paused
public void paused()
Invoked when the current run has been paused.- Specified by:
paused
in interfaceRunListener
-
restarted
public void restarted()
Invoked when the current run has been restarted after a pause.- Specified by:
restarted
in interfaceRunListener
-
started
public void started()
Invoked when the current run has been started.- Specified by:
started
in interfaceRunListener
-
stopped
public void stopped()
Invoked when the current run has been stopped. This will stop this thread from waiting for the current run to finish.- Specified by:
stopped
in interfaceRunListener
-
-