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.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

time

protected int time
Constructor Detail

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.
Method Detail

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