Package repast.simphony.engine.schedule
Class ScheduleGroup
- java.lang.Object
-
- repast.simphony.engine.schedule.ScheduleGroup
-
- All Implemented Interfaces:
IAction
public class ScheduleGroup extends Object implements 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:
ISchedulableAction
-
-
Field Summary
Fields Modifier and Type Field Description protected ActionList
actions
List containing actions whose priority is a double _inside_ the range NEG_INFINITY, POS_INFINITY.protected int
count
The number of actions contained by this ScheduleGroupprotected List<ISchedulableAction>
executedActions
List of executed actions.protected boolean
finishing
protected ActionList
firstActions
List of actions that should be executed first.protected ActionList
firstOfLastActions
List of actions that are executed as last actions but immediately prior to those.protected ActionList
lastActions
List of actions that should be executed last.protected ActionList
randomActions
List of actions whose priority is random.
-
Constructor Summary
Constructors Constructor Description ScheduleGroup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
hasMoreToExecute()
boolean
isFinishing()
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 Detail
-
count
protected int count
The number of actions contained by this ScheduleGroup
-
actions
protected ActionList actions
List containing actions whose priority is a double _inside_ the range NEG_INFINITY, POS_INFINITY.
-
randomActions
protected ActionList randomActions
List of actions whose priority is random.
-
firstActions
protected ActionList firstActions
List of actions that should be executed first.
-
firstOfLastActions
protected ActionList firstOfLastActions
List of actions that are executed as last actions but immediately prior to those.
-
lastActions
protected ActionList lastActions
List of actions that should be executed last.
-
executedActions
protected List<ISchedulableAction> executedActions
List of executed actions. These actions will be rescheduled.
-
finishing
protected boolean finishing
-
-
Method Detail
-
addAction
public void addAction(ISchedulableAction action)
Add an IScheduleAction to this ScheduleGroup.- Parameters:
action
- the action to add
-
remove
public boolean remove(ISchedulableAction action)
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
public void reschedule(ActionQueue aQueue)
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()
-
-