Class BatchScenario

java.lang.Object
repast.simphony.scenario.Scenario
repast.simphony.batch.BatchScenario
All Implemented Interfaces:
ScenarioChangedListener

public class BatchScenario extends Scenario
Allows the programmatic creation of a scenario for use in a batch run.
Author:
Nick Collier
  • Field Details

  • Constructor Details

    • BatchScenario

      public BatchScenario(Object masterContextID)
      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

      public void prepareWatchee(String className, String fieldName, String classpath)
      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 watch
      fieldName - the name of the field to watch
      classpath - the classpath on which to find the watcher and watched classes. The separator must be appropriate for the OS.
    • addDataLoader

      public <T extends ContextBuilder> void addDataLoader(Object contextTypeID, T loader)
      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 with
      loader - the loader to add to the scenario
    • createRegistry

      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

      public ModelInitializer getModelInitializer()
      Gets a custom ModelInitializer, if any, supplied by the user.
      Overrides:
      getModelInitializer in class Scenario
      Returns:
      a custom RunInitializer, if any, supplied by the user.
    • setUserInitializer

      public void setUserInitializer(ModelInitializer userInit)
      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

      public void setParameterSweeper(ParameterSweeper sweeper)
    • getParameterSweeper

      public ParameterSweeper getParameterSweeper()