public class TMEvent
extends java.lang.Object
implements java.lang.Comparable
A event queue is used to sort these event, based on
- priority, and - whether it has been startedin that order.
Notice that an interrupt event (an event generated by calling fireAt() of the director) is not a TM event. They are external events that carries time stamps, implemented using the DEEvent class.
DEEvent
Constructor and Description |
---|
TMEvent(TMReceiver receiver,
Token token,
int priority,
double processingTime)
Construct an event with the specified destination receiver,
token, priority, and executionTime.
|
Modifier and Type | Method and Description |
---|---|
Actor |
actor()
Return the destination actor for this event.
|
int |
compareTo(java.lang.Object event)
Compare the order of this event with the specified event
for order.
|
int |
compareTo(TMEvent event)
Compare the tag of this event with the specified event for order.
|
boolean |
equals(java.lang.Object tmEvent)
Return true if this TMEvent has the same sequence
number as the given TMEvent.
|
int |
hashCode()
Return the hash code for this TMEvent object.
|
boolean |
hasStarted()
Return true if the processing of this event has started.
|
int |
priority()
Return the priority.
|
double |
processingTime()
Return the remaining time needed to finish processing this event.
|
TMReceiver |
receiver()
Return the destination receiver of this event.
|
void |
setPriority(int newPriority)
Set the priority of the event.
|
void |
setProcessingTime(double time)
Set the remaining processing time of the event.
|
void |
startProcessing()
Start the processing of this event.
|
void |
timeProgress(double time)
Reduce the remaining processing time of this event by a certain
amount.
|
Token |
token()
Return the token contained by this event.
|
java.lang.String |
toString()
Return a description of the event, including the contained token
(or "null" if there is none), the priority, the destination actor,
whether it has been started, and the remaining processing time.
|
public TMEvent(TMReceiver receiver, Token token, int priority, double processingTime)
receiver
- The destination receiver.token
- The transferred token.priority
- The priority of the port that contains the
destination receiver.processingTime
- The time needed to finish processing the event.java.lang.NullPointerException
- If the receiver is null or is
not contained by a port contained by an actor.public final Actor actor()
public final int compareTo(java.lang.Object event)
compareTo
in interface java.lang.Comparable
event
- The event to compare against.java.lang.ClassCastException
- If the argument is not an instance
of TMEvent.public final int compareTo(TMEvent event)
event
- The event to compare against.public boolean equals(java.lang.Object tmEvent)
equals
in class java.lang.Object
tmEvent
- The TMEvent object that this
TMEvent object is compared to.public int hashCode()
hashCode
in class java.lang.Object
public final boolean hasStarted()
public final int priority()
public final double processingTime()
public final TMReceiver receiver()
public final void setPriority(int newPriority)
newPriority
- The priority set to the event.public final void setProcessingTime(double time)
time
- The remaining processing time.public final void startProcessing()
public final void timeProgress(double time)
time
- The amount of time progressed.public final Token token()
public final java.lang.String toString()
toString
in class java.lang.Object