Package microsim.event
Class Event
java.lang.Object
microsim.event.Event
- All Implemented Interfaces:
Comparable<Event>
- Direct Known Subclasses:
CollectionTargetEvent,EventGroup,SingleTargetEvent,SystemEvent
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDetermines the natural ordering of events.abstract voiddoublegetLoop()Get the loop length.intGet the ordering of the event's next firing.doublegetTime()Get the next firing absolute time.voidSchedule event at the next loop time.voidsetTimeOrderingAndLoopPeriod(double atTime, int withOrdering, double withLoop) Set the time, ordering and loop period of the 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 firedwithOrdering- - 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
- Throws:
SimulationException
-
compareTo
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:
compareToin interfaceComparable<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.
-