Package microsim.event
Class Event
- java.lang.Object
-
- microsim.event.Event
-
- All Implemented Interfaces:
java.lang.Comparable<Event>
- Direct Known Subclasses:
CollectionTargetEvent
,EventGroup
,SingleTargetEvent
,SystemEvent
public abstract class Event extends java.lang.Object implements java.lang.Comparable<Event>
-
-
Constructor Summary
Constructors Constructor Description Event()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(Event e)
Determines the natural ordering of events.abstract void
fireEvent()
double
getLoop()
Get the loop length.int
getOrdering()
Get the ordering of the event's next firing.double
getTime()
Get the next firing absolute time.void
setTimeAtNextLoop()
Schedule event at the next loop time.void
setTimeOrderingAndLoopPeriod(double atTime, int withOrdering, double withLoop)
Set the time, ordering and loop period of the event
-
-
-
Method Detail
-
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
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 interfacejava.lang.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.
-
-