Class Event

java.lang.Object
microsim.event.Event
All Implemented Interfaces:
Comparable<Event>
Direct Known Subclasses:
CollectionTargetEvent, EventGroup, SingleTargetEvent, SystemEvent

public abstract class Event extends Object implements Comparable<Event>
  • Field Details

    • time

      protected double time
    • ordering

      protected int ordering
    • loop

      protected double loop
  • Constructor Details

    • Event

      public Event()
  • Method Details

    • setTimeOrderingAndLoopPeriod

      public void setTimeOrderingAndLoopPeriod(double atTime, int withOrdering, double withLoop)
      Set the time, ordering and loop period of the event
      Parameters:
      atTime - - the absolute time for the event to be fired
      withOrdering - - the ordering of the event to be fired. If two or more events share an absolute time, their order can be specified using the ordering integer - an event with a lower ordering value will be fired earlier. If two or more events have equal absolute time and ordering, the first event that was scheduled will be fired first.
      withLoop - - the time period between repeated firing of the event. If this parameter is set to 0, this event will not be fired more than once.
    • fireEvent

      public abstract void fireEvent() throws SimulationException
      Throws:
      SimulationException
    • compareTo

      public int compareTo(Event e)
      Determines the natural ordering of events. As such it determines the order in which events are fired from the schedule. If two events have different time fields, the event with the lower time field is fired before the event with the higher time field. If two events have time fields with equal value, their ordering fields will determine the order in which the events are fired, with lower ordering values fired before high ordering values. If ordering fields are also equal, the first event that was scheduled will be fired first.
      Specified by:
      compareTo in interface Comparable<Event>
    • setTimeAtNextLoop

      public void setTimeAtNextLoop()
      Schedule event at the next loop time. NOTE - this method does not change the ordering of the event. Use the setOrdering(int) method if this is necessary.
    • getTime

      public double getTime()
      Get the next firing absolute time.
    • getLoop

      public double getLoop()
      Get the loop length.
    • getOrdering

      public int getOrdering()
      Get the ordering of the event's next firing.