Class Event
java.lang.Object
|
+--Event
- All Implemented Interfaces:
- Comparable
- Direct Known Subclasses:
- DelayedPrintJob, EndPrintJob, EndSimulation, StartPrintJob
- public abstract class Event
- extends Object
- implements Comparable
Represents an occurance within a single instant in time.
This may be the beginning or end of an action, or some change in state.
Generally used for event-driven simulations.
- Version:
- Mar 3, 2005
- Author:
- Zach Tomaszewski
|
Field Summary |
protected int |
time
|
|
Constructor Summary |
Event(int time)
Creates a new event that occurs at the given time. |
|
Method Summary |
int |
compareTo(Object o)
|
boolean |
equals(Object o)
Two objects are equal if they have the same time. |
int |
getTime()
Returns the time of this event |
String |
toString()
Returns a string containing this event's class name and its time. |
time
protected int time
Event
public Event(int time)
- Creates a new event that occurs at the given time.
Negative times are allowed (but may be incorrect,
depending on the simulation.)
- Parameters:
time - Usually the number of periodic intervals (seconds, minutes,
etc.) since the beginning of a simulation.
getTime
public int getTime()
- Returns the time of this event
equals
public boolean equals(Object o)
- Two objects are equal if they have the same time.
- Overrides:
equals in class Object
- Returns:
- true if both objects have the same time; false otherwise
compareTo
public int compareTo(Object o)
- Specified by:
compareTo in interface Comparable
toString
public String toString()
- Returns a string containing this event's class name and its time.
- Overrides:
toString in class Object