public class DEEvent
extends java.lang.Object
implements java.lang.Comparable
A tag is a tuple of a timestamp and a microstep. The timestamp is the model time when the event exists. The microstep defines the order of a sequence of (simultaneous) events that exist at the same model time.
A DE event is associated with a destination, which is either an actor or an IO port of an actor. A DE event, whose destination is an actor, is called a pure event. A pure event does not have a destination IO port. A DE event, whose destination is an IO port, is called a trigger event. A trigger event has a destination actor, which is the container of the destination IO port.
A DE event also has a depth, which is the topology information of its destinations. For a pure event, the depth is that of its destination actor. For a trigger event, the depth is that of its destination IO port. A larger value of depth indicates a lower priority when the simulator processes events with the same tag.
Two DE events can be compared to see which one happens first. The order
is defined by the relationship between their time stamps, microsteps, and
depths. See DEEventQueue
for more details. DE events can be compared
by using the compareTo() method.
This class is final to improve the simulation performance because new events get created and discarded through the whole simulation.
Green (hyzheng) |
Green (hyzheng) |
Modifier and Type | Field and Description |
---|---|
protected Actor |
_actor
The destination actor.
|
protected int |
_depth
The depth of this event.
|
protected IOPort |
_ioPort
The destination IO port.
|
protected int |
_microstep
The microstep of this event.
|
protected int |
_priority
The priority of the event (used when the timestamp, depth and
microstep cannot resolve a conflict.
|
protected Time |
_timestamp
The timestamp of the event.
|
Constructor and Description |
---|
DEEvent(Actor actor,
Time timeStamp,
int microstep,
int depth)
Construct a pure event with the specified destination actor,
timestamp, microstep, and depth.
|
DEEvent(IOPort ioPort,
Time timeStamp,
int microstep,
int depth)
Construct a trigger event with the specified destination IO port,
timestamp, microstep, and depth.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
_updateDepth(int newDepth)
Update the depth of this event if the new depth is no less than
0.
|
Actor |
actor()
Return the destination actor for this event.
|
int |
compareTo(DEEvent event)
Compare the tag and depth of this event with those of the argument
event for the order.
|
int |
compareTo(java.lang.Object event)
Compare this event with the argument event for an order.
|
int |
depth()
Return the depth of this event.
|
boolean |
equals(java.lang.Object object)
Indicate whether some other object is equal to this DE Event.
|
int |
hashCode()
Return the hash code for the event object.
|
boolean |
hasTheSameTagAndDepthAs(DEEvent event)
Return true if this event has the same tag with the specified one,
and their depths are the same.
|
boolean |
hasTheSameTagAs(DEEvent event)
Return true if this event has the same tag as the argument DE event.
|
IOPort |
ioPort()
Return the destination IO port of this event.
|
int |
microstep()
Return the microstep of this event.
|
Time |
timeStamp()
Return the timestamp.
|
java.lang.String |
toString()
Return a description of the event, including the the tag, depth,
and destination information.
|
protected Actor _actor
protected int _depth
protected IOPort _ioPort
protected int _microstep
protected int _priority
protected Time _timestamp
public DEEvent(Actor actor, Time timeStamp, int microstep, int depth) throws IllegalActionException
actor
- The destination actortimeStamp
- The time when the event occurs.microstep
- The phase of execution within a fixed time.depth
- The topological depth of the destination actor.IllegalActionException
- If the actor has a priority parameter,
but its value cannot be obtained, which should be an integer.public DEEvent(IOPort ioPort, Time timeStamp, int microstep, int depth) throws IllegalActionException
ioPort
- The destination IO port.timeStamp
- The time when the event occurs.microstep
- The phase of execution within a fixed time.depth
- The topological depth of the destination IO Port.IllegalActionException
- If the actor has a priority parameter,
but its value cannot be obtained, which should be an integer.public final Actor actor()
public final int compareTo(DEEvent event)
Their timestamps are compared first. If the two timestamps are not the same, their order defines the events' order. Otherwise, the microsteps of events are compared for the order, where an event with the smaller microstep happens earlier. If the events have the same microstep, their depths are compared. The event with a smaller depth happens earlier. If the two events have the same tag and depth, then they happen at the same time.
event
- The event to compare against.public final int compareTo(java.lang.Object event)
compareTo(DEEvent event)
for the comparison rules.
The argument event has to be an instance of DEEvent. Otherwise, a
ClassCastException will be thrown.compareTo
in interface java.lang.Comparable
event
- The event to compare against.java.lang.ClassCastException
- If the argument event is not an instance
of DEEvent.public final int depth()
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- The object with which to compare.hashCode()
public final boolean hasTheSameTagAndDepthAs(DEEvent event)
event
- The event to compare against.public boolean hasTheSameTagAs(DEEvent event)
event
- The DE event to compare against.public int hashCode()
hashCode
in class java.lang.Object
equals(Object)
public final IOPort ioPort()
public final int microstep()
public final Time timeStamp()
public java.lang.String toString()
toString
in class java.lang.Object
void _updateDepth(int newDepth)
newDepth
- The new depth for this event.