Package repast.simphony.batch
Class BatchScenario
java.lang.Object
repast.simphony.scenario.Scenario
repast.simphony.batch.BatchScenario
- All Implemented Interfaces:
ScenarioChangedListener
Allows the programmatic creation of a scenario for use in a batch run.
- Author:
- Nick Collier
-
Field Summary
Fields inherited from class repast.simphony.scenario.Scenario
context, DEFAULT_MASTER_PARENT, dirty, file, masterActions, modelData, modelInitName, modelPluginPath, paramSweepers, registry, SCENARIO_FILE_NAME
-
Constructor Summary
ConstructorDescriptionBatchScenario
(File scenarioDir, ContextData contextData, UserPathData modelData, Object masterContextID) BatchScenario
(Object masterContextID) Creates a BatchScenario with the specified master context id. -
Method Summary
Modifier and TypeMethodDescription<T extends ContextBuilder>
voidaddDataLoader
(Object contextTypeID, T loader) Adds a data loader to this scenario.createRegistry
(RunEnvironmentBuilder builder) Creates a ControllerRegistry from this BatchScenario.Gets a custom ModelInitializer, if any, supplied by the user.void
prepareWatchee
(String className, String fieldName, String classpath) Prepare the specified field in the specified class for watching.void
setParameterSweeper
(ParameterSweeper sweeper) void
setUserInitializer
(ModelInitializer userInit) Sets a ModelInitializer that will be run when the scenario is loaded.Methods inherited from class repast.simphony.scenario.Scenario
addMasterControllerAction, addParameterSetter, getContext, getControllerRegistry, getMasterControllerActions, getModelData, getModelInitName, getModelPluginPath, getParameterSetters, getScenarioDirectory, isDirty, removeMasterControllerAction, removeParameterSetter, scenarioChanged, setControllerRegistry, setDirty, setModelInitName, setModelPluginPath, setScenarioDirectory
-
Field Details
-
parameterSweeper
-
userInit
-
-
Constructor Details
-
BatchScenario
Creates a BatchScenario with the specified master context id.- Parameters:
masterContextID
-
-
BatchScenario
public BatchScenario(File scenarioDir, ContextData contextData, UserPathData modelData, Object masterContextID)
-
-
Method Details
-
prepareWatchee
Prepare the specified field in the specified class for watching. If this is not done, any watcher annotations will not work.- Parameters:
className
- the name of the class to watchfieldName
- the name of the field to watchclasspath
- the classpath on which to find the watcher and watched classes. The separator must be appropriate for the OS.
-
addDataLoader
Adds a data loader to this scenario. The data loader will be associated with the specific context. If the contextTypeID refers to the master context, then this data loader is responsible for creating the master context and its children. If the contextTypeID refers to a subcontext type, then the data loader is responsible for creating the children of any contexts of that type.- Parameters:
contextTypeID
- the context type to associate the data loader withloader
- the loader to add to the scenario
-
createRegistry
public ControllerRegistry createRegistry(RunEnvironmentBuilder builder) throws ClassNotFoundException, IOException Creates a ControllerRegistry from this BatchScenario. This registry is then used to do the actual batch runs.- Parameters:
builder
- used to create the run enviroment and passed to a user's model initializer, if any- Returns:
- a ControllerRegistry created from this BatchScenario.
- Throws:
ClassNotFoundException
- if this BatchScenario is unable process (read annotations etc.) the agent classes.IOException
-
getModelInitializer
Gets a custom ModelInitializer, if any, supplied by the user.- Overrides:
getModelInitializer
in classScenario
- Returns:
- a custom RunInitializer, if any, supplied by the user.
-
setUserInitializer
Sets a ModelInitializer that will be run when the scenario is loaded. This is optional and need not be set unless a custom initializer is desired.- Parameters:
userInit
- a customized ModelInitializer
-
setParameterSweeper
-
getParameterSweeper
-