com.cogent
Class HeapElement

java.lang.Object
  |
  +--com.cogent.HeapElement
All Implemented Interfaces:
java.lang.Comparable

class HeapElement
extends java.lang.Object
implements java.lang.Comparable

Wrapper class to allow a Event and a priority to enter the queue. Implements Comparable to allow the priority queue's heap to work


Field Summary
private  SimEvent myEvent
           
private  long myPriority
           
 
Constructor Summary
HeapElement(SimEvent argEvent, long argPriority)
          Constructs a heap element from an event and a priority
 
Method Summary
 int compareTo(java.lang.Object o1)
          This method satisfies the Comparable interface and provides for an ordering between this element and the parameter.
 SimEvent getEvent()
          Get the associated SimEvent
 long getPriority()
          Get the associate priority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myEvent

private SimEvent myEvent

myPriority

private long myPriority
Constructor Detail

HeapElement

public HeapElement(SimEvent argEvent,
                   long argPriority)
Constructs a heap element from an event and a priority

Parameters:
argEvent - the SimEvent to insert into the queue
argPriority - the associated priority
Method Detail

getEvent

public SimEvent getEvent()
Get the associated SimEvent

Returns:
the SimEvent

getPriority

public long getPriority()
Get the associate priority

Returns:
the priority associated with the event

compareTo

public int compareTo(java.lang.Object o1)
This method satisfies the Comparable interface and provides for an ordering between this element and the parameter. For Events, we want to compare priorites.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o1 - Object to compare to
Returns:
1 if this object is greater than o1, 0 if they are equal, -1 if o1 is greater