Class AbstractAction

java.lang.Object
repast.simphony.engine.schedule.AbstractAction
All Implemented Interfaces:
IAction, ISchedulableAction
Direct Known Subclasses:
DefaultAction, ThreadedAction

public abstract class AbstractAction extends Object implements ISchedulableAction
Abstract base action used by the default scheduling mechanism.
Author:
Nick Collier
  • Field Details

    • frequency

      protected Frequency frequency
      The Frequency of this AbstractAction.
    • nextTime

      protected double nextTime
      The next clock tick that this AbstractAction should be executed.
    • pType

      protected PriorityType pType
    • interval

      protected double interval
      The interval at which to execute this action.
    • priority

      protected double priority
      The priority of this AbstractAction with respect to other actions scheduled for the same clock tick.
    • nonModelAction

      protected boolean nonModelAction
      If the action is a back-end action (true) or if it is a model action (false).
    • rescheduler

      protected AbstractAction.Rescheduler rescheduler
      The Rescheduler used by this AbstractAction to reschedule it for execution.
  • Constructor Details

    • AbstractAction

      public AbstractAction(ScheduleParameters params, long orderIndex)
    • AbstractAction

      public AbstractAction(ScheduleParameters params)
      Creates an AbstractAction using the specified ScheduleParameters. The AbstractAction's scheduling data is set from the ScheduleParameters argument.
      Parameters:
      params - the scheduling data used by this AbstractAction
  • Method Details

    • getNextTime

      public double getNextTime()
      Returns the next time this AbstractAction should be executed.
      Specified by:
      getNextTime in interface ISchedulableAction
      Returns:
      the next time this AbstractAction should be executed.
    • setIsNonModelAction

      protected void setIsNonModelAction(IAction action)
    • setIsNonModelAction

      protected void setIsNonModelAction(boolean nonModelAction)
    • isNonModelAction

      public boolean isNonModelAction()
      Description copied from interface: ISchedulableAction
      This is used by the schedule to determine if the action is a model related action or a back-end action. Normal IActions use NonModelAction to specify this, but ISchedulableActions should use this method.
      Specified by:
      isNonModelAction in interface ISchedulableAction
      Returns:
      if this is a back-end type action or not
    • setFrequency

      protected void setFrequency(Frequency freq)
      Sets the frequency of this AbstractAction.
      Parameters:
      freq - the new Frequency of execution of this AbstractAction.
    • reschedule

      public void reschedule(ActionQueue queue)
      Reschedule this AbstractAction for execution.
      Specified by:
      reschedule in interface ISchedulableAction
    • addForExecution

      public void addForExecution(ScheduleGroup group)
      Add this ScheduableAction to the specified group for execution.
      Specified by:
      addForExecution in interface ISchedulableAction
      Parameters:
      group - the group to add the ISchedulableAction to.
    • getPriority

      public double getPriority()
      Gets the priority of this action. The priority refers to this AbstractAction's place in the order of execution with respect to all the other actions that will execute at the same clock tick. The range is from Double.NEGATIVE_INFINITY (execute first) to Double.POSITIVE_INFINITY (execute last). The default is ScheduleParameters.RANDOM_PRIORITY which means the priority will be randomly assigned from a uniform distribution.
      Specified by:
      getPriority in interface ISchedulableAction
      Returns:
      the priority of this AbstractAction.
    • getPriorityType

      public PriorityType getPriorityType()
      Description copied from interface: ISchedulableAction
      Gets the PriorityType of this action.
      Specified by:
      getPriorityType in interface ISchedulableAction
      Returns:
      the PriorityType of this action.
    • getOrderIndex

      public long getOrderIndex()
      Gets an index indicating where this IAction was added to a schedule w/r to all other actions added to a schedule.
      Specified by:
      getOrderIndex in interface ISchedulableAction
      Returns:
      an index indicating where this IAction was added to a schedule w/r to all other actions added to a schedule.