Package repast.simphony.engine.schedule
Class DefaultSchedulableActionFactory
java.lang.Object
repast.simphony.engine.schedule.DefaultSchedulableActionFactory
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionprotected IActionFactory
The factory used to create IActions.protected long
Tracks the order index for adding actions. -
Constructor Summary
ConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptioncreateAction
(Object annotatedObj, Object... parameters) Creates an ISchedulableACtion from ScheduleMethod annotated methods in the specified annotatedObj.createAction
(ScheduleParameters scheduleParams, Object annotatedObj, Object... parameters) Creates an ISchedulableAction from ScheduleMethod annotated methods in the specified annotatedObj.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.createAction
(ScheduleParameters scheduleParams, IAction action) Creates an ISchedulableAction from the specified scheduling parameters and executable IAction.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.createActions
(Object obj) Creates a List of SchedulableActions from annotated methods.Gets the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.
-
Field Details
-
actionFactory
The factory used to create IActions. -
currentOrderIndex
protected long currentOrderIndexTracks the order index for adding actions.
-
-
Constructor Details
-
DefaultSchedulableActionFactory
public DefaultSchedulableActionFactory()Creates a DefaultSchedulableActionFactory that uses a DefaultActionFactory to create IActions. -
DefaultSchedulableActionFactory
Creates a DefaultSchedulableActionFactory that uses the specified action factory to create IActions.
-
-
Method Details
-
createAction
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
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:
-
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:
-
createActions
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:
-
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.
-