Interface ISchedule

All Superinterfaces:
IAction
All Known Subinterfaces:
IGraphSchedule
All Known Implementing Classes:
DefaultGraphSchedule, Schedule

public interface ISchedule extends IAction
Interface for objects that manage the execution of actions according to a simulation clock. The clock, measured in "ticks", is incremeneted at the completion of the execution of all the IActions scheduled for execution at that clock tick. Incrementing the clock consists of setting the clock to that time at which the next set of IAction-s are to be executed. The entire list of IAction-s is managed as a priority queue.
Version:
$Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
Author:
Nick Collier
See Also:
  • Method Details

    • schedule

      ISchedulableAction schedule(ScheduleParameters scheduleParams, IAction action)
      Schedules the specified IAction for execution according to the specified schedule parameters.
      Parameters:
      scheduleParams - the scheduling parameters specifying start time etc.
      action - the action to schedule for execution
      Returns:
      the actual action that was scheduled for execution.
    • scheduleIterable

      ISchedulableAction scheduleIterable(ScheduleParameters scheduleParams, Iterable target, String methodName, boolean shuffle, Object... methodParams)
      Schedules the named method call on each object returned by specified target with the specified parameters.
      Parameters:
      scheduleParams - the scheduling parameters specifying start time etc.
      target - the Iterable containing the objects to call the method on
      methodName - the name of the method to call
      shuffle - whether to shuffle the items in the iterable before calling the method on the objects therein
      methodParams - the parameters of the method named for execution
      Returns:
      the actual action that was scheduled for execution.
    • schedule

      ISchedulableAction schedule(ScheduleParameters scheduleParams, Object target, String methodName, Object... methodParams)
      Schedules the named method call on the specified target with the specified parameters.
      Parameters:
      scheduleParams - the scheduling parameters specifying start time etc.
      target - the object on which to call the named method
      methodName - the name of the method to call
      methodParams - the parameters of the method named for execution
      Returns:
      the actual action that was scheduled for execution.
    • schedule

      ISchedulableAction schedule(Object annotatedObj, Object... parameters)
      Schedules the best matching ScheduleMethod annotated method for execution. The ScheduledMethod annotation tags the method as one that should be scheduled for execution and also provides the scheduling parameters for the scheduling of that method. The specified parameters will be passed to that method on execution. The method will be selected by choosing the annotated method whose parameters best match the specified parameters.
      Parameters:
      annotatedObj - the object whose annotated method should scheduled
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the actual action scheduled for execution.
      See Also:
    • createAction

      ISchedulableAction createAction(ScheduleParameters scheduleParams, Object annotatedObj, Object... parameters)
      Schedules the best matching ScheduleMethod annotated method for execution. The ScheduledMethod annotation tags the method as one that should be scheduled for execution. The specified parameters will be passed to that method on execution. The method will be selected by choosing the annotated method whose parameters best match the specified parameters. Any ScheduleParameters derived from the ScheduledMethod annotation will be ignored and replaced by the specified ScheduleParameters.
      Parameters:
      scheduleParams - the scheduling parameters describing start time etc.
      annotatedObj - the object containing the annotated methods
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the actual action scheduled for execution.
      See Also:
    • schedule

      List<ISchedulableAction> schedule(Object obj)
      Schedules for execution any methods in the specified object that have been annotated with the ScheduledMethod annotation. The ScheduledMethod annotation tags the method as one that should be scheduled for execution and also provides the scheduling parameters for the scheduling of that method.
      Parameters:
      obj - the object whose annotated methods should scheduled
      Returns:
      a List of the actual action scheduled for execution. An object may have more than one of its methods annotated for scheduling execution and so a list is returned.
    • removeAction

      boolean removeAction(ISchedulableAction action)
      Removes the specified action from this Schedule. Actions should not be scheduled for removal at the same tick in which they are executing. In those cases, removeAction will always return false.
      Parameters:
      action - the ISchedulableAction to remove
      Returns:
      whether or not the action was removed.
    • execute

      void execute()
      Executes the schedule by, at the very least, executing all the actions scheduled for execution at the current clock tick.
      Specified by:
      execute in interface IAction
    • getTickCount

      double getTickCount()
      Gets the current tick count. This is the current value of the simulation clock.
      Returns:
      the current tick count.
    • getTickCountInTimeQuantity

      javax.measure.Quantity<?> getTickCountInTimeQuantity()
      Gets the current tick count in user time units. This is the current value of the simulation clock in user time units.
      Returns:
      the current tick count in user time units.
    • getTimeQuantity

      javax.measure.Quantity<?> getTimeQuantity()
      Gets the current user time units.
      Returns:
      the current user time units.
    • setTimeQuantity

      void setTimeQuantity(javax.measure.Quantity<?> newUnits)
      Sets the current user time units.
      Parameters:
      newUnits - the new user time units.
    • getActionCount

      int getActionCount()
      Gets the number of currently scheduled actions.
      Returns:
      the number of currently scheduled actions.
    • getModelActionCount

      int getModelActionCount()
      Returns the number of actions that do not have a NonModelAction annotation, attached to them along with the number of ISchedulableActions whose ISchedulableAction.isNonModelAction() method returns false.
      Returns:
      the number of actions that are model actions, not back-end actions
    • executeEndActions

      void executeEndActions()
      Executes all the actions scheduled to execute at the end of the model run.
    • setFinishing

      void setFinishing(boolean finishing)
      Sets whether or not the simultation is finishing, which means that this schedule will no longer allow actions to be scheduled or rescheduled. This is used to execute the back-end actions one final time after the model actions have been completed.
      Parameters:
      finishing - if the schedule is to be in finishing mode
      See Also:
    • isFinishing

      boolean isFinishing()
      Returns whether or not the simultation is finishing, which means that this schedule will no longer allow actions to be scheduled or rescheduled. This is used to execute the back-end actions one final time after the model actions have been completed.
      Returns:
      if the schedule is in finishing mode
      See Also: