javaslam.util
Class PriorityQueue.QueueElement

java.lang.Object
  |
  +--javaslam.util.PriorityQueue.QueueElement
All Implemented Interfaces:
Comparable
Enclosing class:
PriorityQueue

protected class PriorityQueue.QueueElement
extends Object
implements Comparable

An item in a priority queue.


Field Summary
 Object item
          The actual item.
 Comparable priority
          The priority of the item.
 
Constructor Summary
PriorityQueue.QueueElement(Object item, Comparable priority)
          Constructor.
 
Method Summary
 int compareTo(Object o)
          Compares this object with the specified object for order.
 boolean equals(Object o)
          Returns true if two elements are the same, which is true only when the corresponding items are equal.
 int hashCode()
          Returns the hash code of this element's item.
 String toString()
          Returns a string representation of this queue element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

item

public Object item
The actual item.


priority

public Comparable priority
The priority of the item.

Constructor Detail

PriorityQueue.QueueElement

public PriorityQueue.QueueElement(Object item,
                                  Comparable priority)
Constructor.

Method Detail

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The order of two queue elements is exactly the order of their respective priorities.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

equals

public boolean equals(Object o)
Returns true if two elements are the same, which is true only when the corresponding items are equal.

Overrides:
equals in class Object
Parameters:
o - the Object to be compared.
Returns:
true if two elements are the same.

hashCode

public int hashCode()
Returns the hash code of this element's item.

Overrides:
hashCode in class Object
Returns:
the hash code of this element's item.

toString

public String toString()
Returns a string representation of this queue element.

Overrides:
toString in class Object