Package repast.simphony.engine.schedule
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:
ISchedulableAction
,IAction
,IActionFactory
-
-
Field Summary
Fields Modifier and Type Field Description protected IActionFactory
actionFactory
The factory used to create IActions.protected long
currentOrderIndex
Tracks the order index for adding actions.
-
Constructor Summary
Constructors Constructor Description DefaultSchedulableActionFactory()
Creates a DefaultSchedulableActionFactory that uses a DefaultActionFactory to create IActions.DefaultSchedulableActionFactory(IActionFactory actionFactory)
Creates a DefaultSchedulableActionFactory that uses the specified action factory to create IActions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISchedulableAction
createAction(Object annotatedObj, Object... parameters)
Creates an ISchedulableACtion from ScheduleMethod annotated methods in the specified annotatedObj.ISchedulableAction
createAction(ScheduleParameters scheduleParams, Object annotatedObj, Object... parameters)
Creates an ISchedulableAction from ScheduleMethod annotated methods in the specified annotatedObj.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.ISchedulableAction
createAction(ScheduleParameters scheduleParams, IAction action)
Creates an ISchedulableAction from the specified scheduling parameters and executable IAction.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.List<ISchedulableAction>
createActions(Object obj)
Creates a List of SchedulableActions from annotated methods.IActionFactory
getActionFactory()
Gets the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.
-
-
-
Field Detail
-
actionFactory
protected IActionFactory actionFactory
The factory used to create IActions.
-
currentOrderIndex
protected long currentOrderIndex
Tracks the order index for adding actions.
-
-
Constructor Detail
-
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 Detail
-
createAction
public ISchedulableAction createAction(ScheduleParameters scheduleParams, IAction action)
Creates an ISchedulableAction from the specified scheduling parameters and executable IAction.- Specified by:
createAction
in interfaceISchedulableActionFactory
- Parameters:
action
- the action to executescheduleParams
- 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 interfaceISchedulableActionFactory
- Parameters:
scheduleParams
- the scheduling datatarget
- the object on which to call the named methodmethodName
- the name of the method to callparameters
- 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 interfaceISchedulableActionFactory
- Parameters:
scheduleParams
- the scheduling datatarget
- the Iterable containing the objects on which to call the named methodmethodName
- the name of the method to callshuffle
- whether to shuffle the items in the iterable before calling the method on the objects thereinparameters
- 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 interfaceISchedulableActionFactory
- Parameters:
annotatedObj
- the object containing the annotated methodsparameters
- the parameters to pass to the method call and to use to find the method itself- Returns:
- the created ISchedulableAction
- See Also:
ScheduledMethod
-
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 interfaceISchedulableActionFactory
- Parameters:
scheduleParams
- the scheduling parameters describing start time etc.annotatedObj
- the object containing the annotated methodsparameters
- the parameters to pass to the method call and to use to find the method itself- Returns:
- the created ISchedulableAction
- See Also:
ScheduledMethod
-
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 interfaceISchedulableActionFactory
- Parameters:
obj
- the object whose methods are annotated- Returns:
- a List of ScheduableActions created from the annotated methods
- See Also:
ScheduledMethod
,IActionParameterPair
-
getActionFactory
public IActionFactory getActionFactory()
Gets the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.- Specified by:
getActionFactory
in interfaceISchedulableActionFactory
- Returns:
- the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.
-
-