jist.runtime
Class Event.EventComparator

java.lang.Object
  extended by jist.runtime.Event.EventComparator
All Implemented Interfaces:
java.util.Comparator
Enclosing class:
Event

public static class Event.EventComparator
extends java.lang.Object
implements java.util.Comparator

Comparator used to compare two events in terms of their timestamp. Used by the event queue to order the events in order of their simulation time.

Since:
JIST1.0
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Constructor Summary
Event.EventComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two Event objects in time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

Event.EventComparator

public Event.EventComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare two Event objects in time. Note that this does not conform to the usual interface: only returns -1 and 1 (1 is returned in place of the usual 0 - performance).

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - first event
o2 - second event
Returns:
o1.time before e2.time ? -1 : 1