Package repast.simphony.engine.schedule
Class DefaultActionFactory
java.lang.Object
repast.simphony.engine.schedule.DefaultActionFactory
- All Implemented Interfaces:
IActionFactory
Default factory for producing IActions to be executed by a Schedule.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateAction
(Object annotatedObj, Object... parameters) Creates an IActionParameterPair from annotated methods in the specified annotatedObj.createAction
(Object target, String methodName, Object... parameters) Creates an IAction that will call the named method on the specified target using the specified parameters.createAction
(IAction action) Creates an IAction to execute the specified IAction.createActionForIterable
(Iterable target, String methodName, boolean shuffle, Object... parameters) Creates an IAction that will call the named method on each object in the specified target using the specified parameters.createActions
(Object obj) Creates a List of IActionParameterPair-s from annotated methods.
-
Constructor Details
-
DefaultActionFactory
public DefaultActionFactory()
-
-
Method Details
-
createAction
Creates an IAction to execute the specified IAction. This default implementation simply returns the parameter.- Specified by:
createAction
in interfaceIActionFactory
- Parameters:
action
- the IAction that the created IAction will execute- Returns:
- the created IAction
-
createAction
Creates an IAction that will call the named method on the specified target using the specified parameters.- Specified by:
createAction
in interfaceIActionFactory
- Parameters:
target
- the object on which to call the name methodmethodName
- the name of the method to callparameters
- the parameters of the method- Returns:
- an IAction that will call the named method on the specified target using the specified parameters.
-
createActionForIterable
public IAction createActionForIterable(Iterable target, String methodName, boolean shuffle, Object... parameters) Creates an IAction that will call the named method on each object in the specified target using the specified parameters.- Specified by:
createActionForIterable
in interfaceIActionFactory
- Parameters:
target
- the object on which to call the name 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 of the method- Returns:
- an IAction that will call the named method on the specified target using the specified parameters.
-
createAction
Creates an IActionParameterPair from annotated methods in the specified annotatedObj. The IAction 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 interfaceIActionFactory
- 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:
- an IActionParameterPair containing the best matching IAction and its ScheduleParameters.
- See Also:
-
createActions
Creates a List of IActionParameterPair-s 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 interfaceIActionFactory
- Parameters:
obj
- the object whose methods are annotated- Returns:
- a List of IAction together with their scheduling parameter data created from annotated methods.
- See Also:
-