Package ptolemy.actor.util
Class TimedEvent
- java.lang.Object
-
- ptolemy.actor.util.TimedEvent
-
- All Implemented Interfaces:
java.lang.Comparable<TimedEvent>
- Direct Known Subclasses:
HlaTimedEvent
,PteraDirector.TimedEvent
public class TimedEvent extends java.lang.Object implements java.lang.Comparable<TimedEvent>
This class aggregates an instance of Time and an Object, and provides a CQComparator as an inner class.- Since:
- Ptolemy II 0.4
- Version:
- $Id$
- Author:
- Edward A. Lee and Haiyang Zheng
- See Also:
CQComparator
,Time
- Pt.AcceptedRating:
- Red (liuj)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TimedEvent.TimeComparator
This class implements the CQComparator interface.
-
Constructor Summary
Constructors Constructor Description TimedEvent(Time time, java.lang.Object obj)
Construct an event with the specified time stamp and contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(TimedEvent timedEvent)
Compare two TimedEvents by comparing their timestamps.boolean
equals(java.lang.Object timedEvent)
Return true if this TimedEvent object has the same timeStamp and eventObject as the given TimedEvent object.int
hashCode()
Return the hash code for the TimedEvent object.java.lang.String
toString()
Display timeStamp and contents.
-
-
-
Field Detail
-
timeStamp
public Time timeStamp
The time stamp.
-
contents
public java.lang.Object contents
The event object.
-
-
Constructor Detail
-
TimedEvent
public TimedEvent(Time time, java.lang.Object obj)
Construct an event with the specified time stamp and contents.- Parameters:
time
- The time stamp.obj
- The contents.
-
-
Method Detail
-
toString
public java.lang.String toString()
Display timeStamp and contents.- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object timedEvent)
Return true if this TimedEvent object has the same timeStamp and eventObject as the given TimedEvent object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
timedEvent
- The TimedEvent object that this TimedEvent object is compared to.- Returns:
- True if the two TimedEvent objects have the same time stamp and event object.
-
compareTo
public int compareTo(TimedEvent timedEvent)
Compare two TimedEvents by comparing their timestamps.- Specified by:
compareTo
in interfacejava.lang.Comparable<TimedEvent>
- Parameters:
timedEvent
- The event to compare against.- Returns:
- The integer -1, 0, or 1 if this is less than, equal to, or greater than the argument.
-
hashCode
public int hashCode()
Return the hash code for the TimedEvent object. If two TimedEvent objects contains the same timestamp, and event object, then they will have the same hashCode.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code for this TimedEvent object.
-
-