Package microsim.event
Class Event
java.lang.Object
microsim.event.Event
- All Implemented Interfaces:
Comparable<Event>
- Direct Known Subclasses:
CollectionTargetEvent
,EventGroup
,SingleTargetEvent
,SystemEvent
An abstract class that describes the structure of a simulation event.
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
Get the loop length.protected int
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.protected double
Get the next firing absolute time. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Determines the natural ordering of events.abstract void
void
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
-
Field Details
-
time
protected double timeGet the next firing absolute time. -
ordering
protected int orderingIf 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 event that was scheduled first will be fired first in the schedule (determined comparing the eventNumber field). -
loop
protected double loopGet the loop length.
-
-
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
- 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:
compareTo
in interfaceComparable<Event>
- Parameters:
e
- Another object of the same type to compare to.- Throws:
NullPointerException
- whene
isnull
.
-
setTimeAtNextLoop
public void setTimeAtNextLoop()Schedule event at the next loop time.- Implementation Note:
- This method does not change the ordering of the event. Use the setOrdering(int) method if this is necessary.
-