Package repast.simphony.scenario
Class Scenario
- java.lang.Object
-
- repast.simphony.scenario.Scenario
-
- All Implemented Interfaces:
ScenarioChangedListener
- Direct Known Subclasses:
BatchScenario
public class Scenario extends Object implements ScenarioChangedListener
Encapsulates a repast simphony scenario.- Author:
- Nick Collier
-
-
Field Summary
Fields Modifier and Type Field Description protected ContextData
context
static ControllerAction
DEFAULT_MASTER_PARENT
protected boolean
dirty
protected File
file
protected List<ControllerAction>
masterActions
protected UserPathData
modelData
protected String
modelInitName
protected File
modelPluginPath
protected List<ParameterSetter>
paramSweepers
protected ControllerRegistry
registry
static String
SCENARIO_FILE_NAME
-
Constructor Summary
Constructors Constructor Description Scenario(File file, ContextData context, UserPathData modelData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMasterControllerAction(ControllerAction action)
Adds the specified ControllerAction to the master context.void
addParameterSetter(ParameterSetter paramInit)
ContextData
getContext()
ControllerRegistry
getControllerRegistry()
Collection<ControllerAction>
getMasterControllerActions()
Gets all the user added master controller actions.UserPathData
getModelData()
ModelInitializer
getModelInitializer()
Instantiates and returns the first ModelInitializer found in the user's model classpath.String
getModelInitName()
File
getModelPluginPath()
Collection<ParameterSetter>
getParameterSetters()
File
getScenarioDirectory()
Gets the scenario directory.boolean
isDirty()
Gets whether or not this scenario is dirty, i.e.void
removeMasterControllerAction(ControllerAction action)
Removes the specified ControllerAction to the master context.void
removeParameterSetter(ParameterSetter paramSetter)
void
scenarioChanged(ScenarioChangedEvent evt)
Called whenever the Scenario has changed.void
setControllerRegistry(ControllerRegistry registry)
void
setDirty(boolean dirty)
Set the dirty flag on this scenario.void
setModelInitName(String modelInitName)
void
setModelPluginPath(File modelPluginPath)
void
setScenarioDirectory(File dir)
Sets the scenario directory.
-
-
-
Field Detail
-
DEFAULT_MASTER_PARENT
public static final ControllerAction DEFAULT_MASTER_PARENT
-
SCENARIO_FILE_NAME
public static final String SCENARIO_FILE_NAME
- See Also:
- Constant Field Values
-
file
protected File file
-
context
protected ContextData context
-
modelData
protected UserPathData modelData
-
paramSweepers
protected List<ParameterSetter> paramSweepers
-
masterActions
protected List<ControllerAction> masterActions
-
registry
protected ControllerRegistry registry
-
modelInitName
protected String modelInitName
-
modelPluginPath
protected File modelPluginPath
-
dirty
protected boolean dirty
-
-
Constructor Detail
-
Scenario
public Scenario(File file, ContextData context, UserPathData modelData)
-
-
Method Detail
-
getContext
public ContextData getContext()
-
getModelData
public UserPathData getModelData()
-
getModelInitializer
public ModelInitializer getModelInitializer() throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException
Instantiates and returns the first ModelInitializer found in the user's model classpath. If a ModelInitializer is not found, this will return an empty one.- Returns:
- the first ModelInitializer found in the user's model classpath. If a ModelInitializer is not found, this will return an empty one.
- Throws:
IOException
- on file errorsClassNotFoundException
- if there some error when creating the classes.IllegalAccessException
InstantiationException
-
getScenarioDirectory
public File getScenarioDirectory()
Gets the scenario directory.- Returns:
- the scenario directory.
-
setScenarioDirectory
public void setScenarioDirectory(File dir)
Sets the scenario directory.
-
addParameterSetter
public void addParameterSetter(ParameterSetter paramInit)
-
removeParameterSetter
public void removeParameterSetter(ParameterSetter paramSetter)
-
getParameterSetters
public Collection<ParameterSetter> getParameterSetters()
-
addMasterControllerAction
public void addMasterControllerAction(ControllerAction action)
Adds the specified ControllerAction to the master context.- Parameters:
action
- the action to add
-
removeMasterControllerAction
public void removeMasterControllerAction(ControllerAction action)
Removes the specified ControllerAction to the master context.- Parameters:
action
- the action to remove
-
getMasterControllerActions
public Collection<ControllerAction> getMasterControllerActions()
Gets all the user added master controller actions.- Returns:
- all the user added master controller actions.
-
setControllerRegistry
public void setControllerRegistry(ControllerRegistry registry)
-
getControllerRegistry
public ControllerRegistry getControllerRegistry()
-
getModelInitName
public String getModelInitName()
-
setModelInitName
public void setModelInitName(String modelInitName)
-
getModelPluginPath
public File getModelPluginPath()
-
setModelPluginPath
public void setModelPluginPath(File modelPluginPath)
-
isDirty
public boolean isDirty()
Gets whether or not this scenario is dirty, i.e. its current state is not saved.- Returns:
- true if this scenario is dirty, otherwise false.
-
setDirty
public void setDirty(boolean dirty)
Set the dirty flag on this scenario.
-
scenarioChanged
public void scenarioChanged(ScenarioChangedEvent evt)
Description copied from interface:ScenarioChangedListener
Called whenever the Scenario has changed.- Specified by:
scenarioChanged
in interfaceScenarioChangedListener
-
-