Class 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 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
    • Constructor Detail

      • ScheduleGroup

        public ScheduleGroup()
    • 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.
        Specified by:
        execute in interface IAction
      • 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()