Class ScheduleParameters

java.lang.Object
repast.simphony.engine.schedule.ScheduleParameters

public class ScheduleParameters extends Object
Parameters describing when an action should be scheduled. Use the static create* methods to create the appropriate ScheduleParameter object.
Version:
$Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
Author:
Nick Collier
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Constant representing end of simulation as the tick at which to execute the actions.
    static final double
     
    static final double
     
    static final double
    Constant representing no duration.
    static final double
    Constant representing random priority.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ScheduleParameters(double start, Frequency frequency, double interval, double priority, PriorityType pType, double duration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createAtEnd(double priority)
    Creates a ScheduleParameters appropriate for scheduling an action to occur at the end of the simulation.
    createNormalProbabilityOneTime(double meanStart, double sdStart, double priority)
    Creates a one time schedule event that is based on a mean start time and standard deviation start time.
    createNormalProbabilityRepeating(double meanStart, double sdStart, double meanInterval, double sdInterval, double priority)
    Creates a repeating schedule event that is based on a mean start/interval time and standard deviation start/interval time.
    createOneTime(double start)
    Creates a ScheduleParameters appropriate for scheduling a non-repeating action.
    createOneTime(double start, double priority)
    Creates a ScheduleParameters appropriate for scheduling a non-repeating action.
    createOneTime(double start, double priority, double duration)
    Creates a ScheduleParameters appropriate for scheduling a non-repeating action.
    createOneTime(double start, PriorityType type)
    Creates a ScheduleParameters for scheduling a non-repeating action of the specified PriorityType.
    createPoissonProbabilityOneTime(double mean, double priority)
    Creates a one time schedule event that is based on a Poisson distribution with the input argument providing the mean to the distribution.
    createPoissonProbabilityRepeating(double mean, double meanRepeating, double priority)
    Creates a repeating schedule event that is based on a Poisson distribution with the input arguments providing the mean to the distribution and repeating meaning interval.
    createRepeating(double start, double interval)
    Creates a ScheduleParameters appropriate for scheduling a repeating action.
    createRepeating(double start, double interval, double priority)
    Creates a ScheduleParameters appropriate for scheduling a repeating action.
    createRepeating(double start, double interval, double priority, double duration)
    Creates a ScheduleParameters appropriate for scheduling a repeating action.
    createRepeating(double start, double interval, PriorityType priorityType)
    Creates a ScheduleParameters appropriate for scheduling a repeating action of the first, last, random, or first of last priority type.
    createUniformProbabilityOneTime(double minStart, double maxStart, double priority)
    Creates a one time schedule event that is based on a uniform distribution with arguments delineating the minimum and maximum of that distribution.
    createUniformProbabilityRepeating(double minStart, double maxStart, double minInterval, double maxInterval, double priority)
    Creates a repeating schedule event that is based on a uniform distribution with arguments delineating the minimum and maximum of that distribution and repeating interval.
    boolean
    Checks if this ScheduleParamters equals the passed in object.
    double
    Gets the scheduled duration.
    Gets the scheduled Frequency of execution.
    double
    Gets the interval at which to repeat the execution of an action.
    double
    Gets the priority to schedule an action with.
    Gets the priority type of this ScheduleParameter.
    double
    Gets the scheduled starting time for an action.
    int
    Gets the hash code for this schedule parameters.
    static boolean
    Gets whether or not the specified parameters are scheduled with a Random priority.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NO_DURATION

      public static final double NO_DURATION
      Constant representing no duration.
      See Also:
    • END

      public static final double END
      Constant representing end of simulation as the tick at which to execute the actions.
      See Also:
    • RANDOM_PRIORITY

      public static final double RANDOM_PRIORITY
      Constant representing random priority.
      See Also:
    • FIRST_PRIORITY

      public static final double FIRST_PRIORITY
      See Also:
    • LAST_PRIORITY

      public static final double LAST_PRIORITY
      See Also:
  • Constructor Details

    • ScheduleParameters

      protected ScheduleParameters(double start, Frequency frequency, double interval, double priority, PriorityType pType, double duration)
  • Method Details

    • isRandomPriority

      public static boolean isRandomPriority(ScheduleParameters params)
      Gets whether or not the specified parameters are scheduled with a Random priority.
      Parameters:
      params -
      Returns:
      true if the specified parameters are scheduled with a random priority, otherwise false.
    • createRepeating

      public static ScheduleParameters createRepeating(double start, double interval)
      Creates a ScheduleParameters appropriate for scheduling a repeating action. The action will start at the specified time, and repeat at the specified interval.
      Parameters:
      start - the start time
      interval - the interval at which the execution of the action should repeat
      Returns:
      a ScheduleParameters appropriate for scheduling a repeating action
    • createRepeating

      public static ScheduleParameters createRepeating(double start, double interval, PriorityType priorityType)
      Creates a ScheduleParameters appropriate for scheduling a repeating action of the first, last, random, or first of last priority type. The action will repeat at the specified interval. Use ScheduleParameters createRepeating(double start, double interval, double priority) to schedule an action with a numeric priority.
      Parameters:
      start - the start time
      interval - the interval at which the execution of the action should repeat
      priorityType - the priority type of the action
      Returns:
      a ScheduleParameters appropriate for scheduling a repeating action
    • createNormalProbabilityOneTime

      public static ScheduleParameters createNormalProbabilityOneTime(double meanStart, double sdStart, double priority)
      Creates a one time schedule event that is based on a mean start time and standard deviation start time.
      Parameters:
      meanStart - mean start time
      sdStart - standard deviation start time
      priority - the priority of the scheduled task
      Returns:
      a schedule parameters object based on a mean(x) and std(x) probability .
    • createUniformProbabilityOneTime

      public static ScheduleParameters createUniformProbabilityOneTime(double minStart, double maxStart, double priority)
      Creates a one time schedule event that is based on a uniform distribution with arguments delineating the minimum and maximum of that distribution.
      Parameters:
      minStart - the minimum start time, but not included in the distribution
      maxStart - the maximum start time, but not included in the distribution
      priority - the priority of the scheduled task
      Returns:
      a schedule parameters object based on minimum and maximum uniform probability.
    • createPoissonProbabilityOneTime

      public static ScheduleParameters createPoissonProbabilityOneTime(double mean, double priority)
      Creates a one time schedule event that is based on a Poisson distribution with the input argument providing the mean to the distribution.
      Parameters:
      mean - the mean of the Poisson distribution
      Returns:
      a schedule parameters object based a Poisson probability.
    • createPoissonProbabilityRepeating

      public static ScheduleParameters createPoissonProbabilityRepeating(double mean, double meanRepeating, double priority)
      Creates a repeating schedule event that is based on a Poisson distribution with the input arguments providing the mean to the distribution and repeating meaning interval.
      Parameters:
      mean - the mean of the Poisson distribution
      meanRepeating - the mean of the repeating interval
      Returns:
      a schedule parameters object based on Poisson probabilities.
    • createNormalProbabilityRepeating

      public static ScheduleParameters createNormalProbabilityRepeating(double meanStart, double sdStart, double meanInterval, double sdInterval, double priority)
      Creates a repeating schedule event that is based on a mean start/interval time and standard deviation start/interval time.
      Parameters:
      meanStart - mean start time
      sdStart - standard deviation start time
      meanInterval - mean interval time
      sdInterval - standard deviation interval time
      priority - the priority of the scheduled task
      Returns:
      a schedule parameters object based on mean(x) and std(x) probabilities .
    • createUniformProbabilityRepeating

      public static ScheduleParameters createUniformProbabilityRepeating(double minStart, double maxStart, double minInterval, double maxInterval, double priority)
      Creates a repeating schedule event that is based on a uniform distribution with arguments delineating the minimum and maximum of that distribution and repeating interval.
      Parameters:
      minStart - the minimum start time, but not included in the distribution
      maxStart - the maximum start time, but not included in the distribution
      minInterval - the minimum interval time, but not included in the distribution
      maxInterval - the maximum interval time, but not included in the distribution
      priority - the priority of the scheduled task
      Returns:
      a schedule parameters object based on minimum and maximum uniform probabilities.
    • createRepeating

      public static ScheduleParameters createRepeating(double start, double interval, double priority)
      Creates a ScheduleParameters appropriate for scheduling a repeating action. The action will start at the specified time, repeat at the specified interval, and have the specified priority. Priority refers the order in which an action is executed with respect to other actions scheduled for the same clock tick.
      Parameters:
      start - the start time
      interval - the interval at which the execution of the action should repeat
      priority - the execution priority of an action with respect to other actions scheduled for the same clock tick. A higher number means a higher priority. So an action with a priority of 3 will occur before an action with priority of -2. Special values are: ScheduleParameters.FIRST_PRIORITY which will schedule the action to execute first; ScheduleParameters.LAST_PRIORITY which will scheduled the action to execute last; and ScheduleParameters.RANDOM_PRIORITY which will schedule the action to execute in random order, but not before any "first" actions and not "after" any last actions. Actions whose priority is same are executed in the order they are added to the schedule.
      Returns:
      a ScheduleParameters appropriate for scheduling a repeating action
    • createRepeating

      public static ScheduleParameters createRepeating(double start, double interval, double priority, double duration)
      Creates a ScheduleParameters appropriate for scheduling a repeating action. The action will start at the specified time, repeat at the specified interval, and have the specified priority. Priority refers the order in which an action is executed with respect to other actions scheduled for the same clock tick. The action will run in the background for the specified duration.
      Parameters:
      start - the start time
      interval - the interval at which the execution of the action should repeat
      priority - the execution priority of an action with respect to other actions scheduled for the same clock tick. A higher number means a higher priority. So an action with a priority of 3 will occur before an action with priority of -2. Special values are: ScheduleParameters.FIRST_PRIORITY which will schedule the action to execute first; ScheduleParameters.LAST_PRIORITY which will scheduled the action to execute last; and ScheduleParameters.RANDOM_PRIORITY which will schedule the action to execute in random order, but not before any "first" actions and not "after" any last actions. Actions whose priority is same are executed in the order they are added to the schedule.
      duration - the number of clock ticks the action can run in the background before it behaves like a normally scheduled action
      Returns:
      a ScheduleParameters appropriate for scheduling a repeating action
    • createOneTime

      public static ScheduleParameters createOneTime(double start)
      Creates a ScheduleParameters appropriate for scheduling a non-repeating action. The action will start at the specified time.
      Parameters:
      start - the start time
      Returns:
      a ScheduleParameters appropriate for scheduling a non-repeating action
    • createOneTime

      public static ScheduleParameters createOneTime(double start, PriorityType type)
      Creates a ScheduleParameters for scheduling a non-repeating action of the specified PriorityType. This method is appropriate for scheduling one time with a priority of first, last, random, and first of last. Use createOneTime(double, double) to schedule a one time action with numeric priority.
      Parameters:
      start - the start type
      type - the type of priority the action should have.
      Returns:
      the created ScheduleParameters.
    • createOneTime

      public static ScheduleParameters createOneTime(double start, double priority)
      Creates a ScheduleParameters appropriate for scheduling a non-repeating action. The action will start at the specified time and have the specified priority. Priority refers the order in which an action is executed with respect to other actions scheduled for the same clock tick.
      Parameters:
      start - the start time
      priority - the execution priority of an action with respect to other actions scheduled for the same clock tick. A higher number means a higher priority. So an action with a priority of 3 will occur before an action with priority of -2. Special values are: ScheduleParameters.FIRST_PRIORITY which will schedule the action to execute first; ScheduleParameters.LAST_PRIORITY which will scheduled the action to execute last; and ScheduleParameters.RANDOM_PRIORITY which will schedule the action to execute in random order, but not before any "first" actions and not "after" any last actions. Actions whose priority is same are executed in the order they are added to the schedule.
      Returns:
      a ScheduleParameters appropriate for scheduling a non-repeating action
    • createOneTime

      public static ScheduleParameters createOneTime(double start, double priority, double duration)
      Creates a ScheduleParameters appropriate for scheduling a non-repeating action. The action will start at the specified time, and have the specified priority. Priority refers the order in which an action is executed with respect to other actions scheduled for the same clock tick. The action will run in the background for the specified duration.
      Parameters:
      start - the start time
      priority - the execution priority of an action with respect to other actions scheduled for the same clock tick. A higher number means a higher priority. So an action with a priority of 3 will occur before an action with priority of -2. Special values are: ScheduleParameters.FIRST_PRIORITY which will schedule the action to execute first; ScheduleParameters.LAST_PRIORITY which will scheduled the action to execute last; and ScheduleParameters.RANDOM_PRIORITY which will schedule the action to execute in random order, but not before any "first" actions and not "after" any last actions. Actions whose priority is same are executed in the order they are added to the schedule.
      duration - the number of clock ticks the action can run in the background before it behaves like a normally scheduled action
      Returns:
      a ScheduleParameters appropriate for scheduling a repeating action
    • createAtEnd

      public static ScheduleParameters createAtEnd(double priority)
      Creates a ScheduleParameters appropriate for scheduling an action to occur at the end of the simulation.
      Parameters:
      priority - the execution priority of an action with respect to other actions scheduled for the same clock tick. A higher number means a higher priority. So an action with a priority of 3 will occur before an action with priority of -2. Special values are: ScheduleParameters.FIRST_PRIORITY which will schedule the action to execute first; ScheduleParameters.LAST_PRIORITY which will scheduled the action to execute last; and ScheduleParameters.RANDOM_PRIORITY which will schedule the action to execute in random order, but not before any "first" actions and not "after" any last actions. Actions whose priority is same are executed in the order they are added to the schedule.
      Returns:
      a ScheduleParameters appropriate for scheduling an action to occur at the end of the simulation.
    • getStart

      public double getStart()
      Gets the scheduled starting time for an action.
      Returns:
      the scheduled starting time.
    • getPriorityType

      public PriorityType getPriorityType()
      Gets the priority type of this ScheduleParameter.
      Returns:
      the priority type of this ScheduleParameter.
    • getPriority

      public double getPriority()
      Gets the priority to schedule an action with.
      Returns:
      the priority to schedule an action with.
    • getInterval

      public double getInterval()
      Gets the interval at which to repeat the execution of an action. A non-repeating action will return 0.
      Returns:
      the interval at which to repeat the execution of an action. A non-repeating action will return 0.
    • getFrequency

      public Frequency getFrequency()
      Gets the scheduled Frequency of execution.
      Returns:
      the scheduled Frequency of execution.
    • getDuration

      public double getDuration()
      Gets the scheduled duration.
      Returns:
      the scheduled duration.
    • hashCode

      public int hashCode()
      Gets the hash code for this schedule parameters.
      Overrides:
      hashCode in class Object
      Returns:
      this schedule parameters hash code
    • equals

      public boolean equals(Object obj)
      Checks if this ScheduleParamters equals the passed in object. The passed object is equal to this one if all its parameters (start, end, etc.) are equal to this one.
      Overrides:
      equals in class Object
      Returns:
      if the object is equal to the current one as defined above
    • toString

      public String toString()
      Overrides:
      toString in class Object