Package repast.simphony.engine.schedule
Class ScheduleGroup
java.lang.Object
repast.simphony.engine.schedule.ScheduleGroup
- All Implemented Interfaces:
IAction
A collection of ISchedulableActions. This class assumes that the actions are
scheduled to execute at the same tick. A ScheduleGroup will order the
execution of its actions according to their priority and then execute them in
the proper order. This would be done by adding the appropriate actions to
this ScheduleGroup, calling sort() and then calling execute().
- Version:
- $Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
- Author:
- Nick Collier
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected ActionList
List containing actions whose priority is a double _inside_ the range NEG_INFINITY, POS_INFINITY.protected int
The number of actions contained by this ScheduleGroupprotected List<ISchedulableAction>
List of executed actions.protected boolean
protected ActionList
List of actions that should be executed first.protected ActionList
List of actions that are executed as last actions but immediately prior to those.protected ActionList
List of actions that should be executed last.protected ActionList
List of actions whose priority is random. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(ISchedulableAction action) Add an IScheduleAction to this ScheduleGroup.void
clear()
Clears this ScheduleGroup of any ISchedulableActions it may containvoid
execute()
Executes all the ISchedulableAction in this ScheduleGroup.boolean
boolean
boolean
remove
(ISchedulableAction action) Removes the specified action from this ScheduleGroup.void
reschedule
(ActionQueue aQueue) Reschedules all the ISchedulableActions contained by this ScheduleGroup.void
setFinishing
(boolean finishing) int
size()
Returns the number of ISchedulableActions in this ScheduleGroup.void
sort()
Sorts the DefaultActions in this ScheduleGroup according to their priority.
-
Field Details
-
count
protected int countThe number of actions contained by this ScheduleGroup -
actions
List containing actions whose priority is a double _inside_ the range NEG_INFINITY, POS_INFINITY. -
randomActions
List of actions whose priority is random. -
firstActions
List of actions that should be executed first. -
firstOfLastActions
List of actions that are executed as last actions but immediately prior to those. -
lastActions
List of actions that should be executed last. -
executedActions
List of executed actions. These actions will be rescheduled. -
finishing
protected boolean finishing
-
-
Constructor Details
-
ScheduleGroup
public ScheduleGroup()
-
-
Method Details
-
addAction
Add an IScheduleAction to this ScheduleGroup.- Parameters:
action
- the action to add
-
remove
Removes the specified action from this ScheduleGroup.- Parameters:
action
- the action to remove- Returns:
- whether or not an action was removed from this group.
-
clear
public void clear()Clears this ScheduleGroup of any ISchedulableActions it may contain -
size
public int size()Returns the number of ISchedulableActions in this ScheduleGroup.- Returns:
- the number of ISchedulableActions in this ScheduleGroup.
-
hasMoreToExecute
public boolean hasMoreToExecute() -
execute
public void execute()Executes all the ISchedulableAction in this ScheduleGroup. -
reschedule
Reschedules all the ISchedulableActions contained by this ScheduleGroup. -
sort
public void sort()Sorts the DefaultActions in this ScheduleGroup according to their priority. Those actions with a numeric priority are ordered w/r to each other. Those actions with random priority are randomly ordered w/r to the numeric actions. After sort(), a call to execute will execute the actions in the appropriate order. -
setFinishing
public void setFinishing(boolean finishing) -
isFinishing
public boolean isFinishing()
-