bcds.tools
Class PQItemWithNumericKey<E>

java.lang.Object
  extended by bcds.tools.PQItemWithNumericKey<E>
All Implemented Interfaces:
java.lang.Comparable<PQItemWithNumericKey<E>>

public class PQItemWithNumericKey<E>
extends java.lang.Object
implements java.lang.Comparable<PQItemWithNumericKey<E>>

An item that can be inserted into a priority queue, where the priority is defined by a numeric key. The key is internally stored as a double.

Author:
Juan Segovia S.

Constructor Summary
PQItemWithNumericKey(E elem, double key)
          Creates saving the reference to elem and copying the key.
 
Method Summary
 int compareTo(PQItemWithNumericKey<E> b)
          Compares the keys of this item with that of the instance b.
 E getData()
          Returns the reference to the data element stored in this object.
 double getKey()
          Returns the key of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PQItemWithNumericKey

public PQItemWithNumericKey(E elem,
                            double key)
Creates saving the reference to elem and copying the key.

Method Detail

compareTo

public int compareTo(PQItemWithNumericKey<E> b)
Compares the keys of this item with that of the instance b.

Specified by:
compareTo in interface java.lang.Comparable<PQItemWithNumericKey<E>>

getData

public E getData()
Returns the reference to the data element stored in this object.


getKey

public double getKey()
Returns the key of this object.