Class DefaultSchedulableActionFactory

java.lang.Object
repast.simphony.engine.schedule.DefaultSchedulableActionFactory
All Implemented Interfaces:
ISchedulableActionFactory

public class DefaultSchedulableActionFactory extends Object implements ISchedulableActionFactory
Default implementation of an ISchedulableActionFactory. This creates IActions using a IActionFactory and then uses those IActions in conjunction with ScheduleParameters to create ScheduableActions.
Version:
$Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
Author:
Nick Collier
See Also:
  • Field Details

    • actionFactory

      protected IActionFactory actionFactory
      The factory used to create IActions.
    • currentOrderIndex

      protected long currentOrderIndex
      Tracks the order index for adding actions.
  • Constructor Details

    • DefaultSchedulableActionFactory

      public DefaultSchedulableActionFactory()
      Creates a DefaultSchedulableActionFactory that uses a DefaultActionFactory to create IActions.
    • DefaultSchedulableActionFactory

      public DefaultSchedulableActionFactory(IActionFactory actionFactory)
      Creates a DefaultSchedulableActionFactory that uses the specified action factory to create IActions.
  • Method Details

    • createAction

      public ISchedulableAction createAction(ScheduleParameters scheduleParams, IAction action)
      Creates an ISchedulableAction from the specified scheduling parameters and executable IAction.
      Specified by:
      createAction in interface ISchedulableActionFactory
      Parameters:
      action - the action to execute
      scheduleParams - the scheduling data
      Returns:
      the created ISchedulableAction
    • createAction

      public ISchedulableAction createAction(ScheduleParameters scheduleParams, Object target, String methodName, Object... parameters)
      Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the target object with the specified parameters.
      Specified by:
      createAction in interface ISchedulableActionFactory
      Parameters:
      scheduleParams - the scheduling data
      target - the object on which to call the named method
      methodName - the name of the method to call
      parameters - the parameters to pass to the method
      Returns:
      the created ISchedulableAction
    • createActionForIterable

      public ISchedulableAction createActionForIterable(ScheduleParameters scheduleParams, Iterable target, String methodName, boolean shuffle, Object... parameters)
      Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the objects returned by target object with the specified parameters.
      Specified by:
      createActionForIterable in interface ISchedulableActionFactory
      Parameters:
      scheduleParams - the scheduling data
      target - the Iterable containing the objects on which to call the named method
      methodName - the name of the method to call
      shuffle - whether to shuffle the items in the iterable before calling the method on the objects therein
      parameters - the parameters to pass to the method
      Returns:
      the created ISchedulableAction
    • createAction

      public ISchedulableAction createAction(Object annotatedObj, Object... parameters)
      Creates an ISchedulableACtion from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution.
      Specified by:
      createAction in interface ISchedulableActionFactory
      Parameters:
      annotatedObj - the object containing the annotated methods
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the created ISchedulableAction
      See Also:
    • createAction

      public ISchedulableAction createAction(ScheduleParameters scheduleParams, Object annotatedObj, Object... parameters)
      Creates an ISchedulableAction from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution. The method will be executed according to the specified ScheduleParameters. The scheduling parameters derived from the annotation will be ignored.
      Specified by:
      createAction in interface ISchedulableActionFactory
      Parameters:
      scheduleParams - the scheduling parameters describing start time etc.
      annotatedObj - the object containing the annotated methods
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the created ISchedulableAction
      See Also:
    • createActions

      public List<ISchedulableAction> createActions(Object obj)
      Creates a List of SchedulableActions from annotated methods. The list is created from the methods in the specified object that are annotated by the ScheduledMethod annotation.
      Specified by:
      createActions in interface ISchedulableActionFactory
      Parameters:
      obj - the object whose methods are annotated
      Returns:
      a List of ScheduableActions created from the annotated methods
      See Also:
    • getActionFactory

      public IActionFactory getActionFactory()
      Gets the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.
      Specified by:
      getActionFactory in interface ISchedulableActionFactory
      Returns:
      the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.