com.mhhe.clrs2e
Class Heap.Handle

java.lang.Object
  |
  +--com.mhhe.clrs2e.Heap.Handle
All Implemented Interfaces:
java.lang.Comparable
Enclosing class:
Heap

protected static class Heap.Handle
extends java.lang.Object
implements java.lang.Comparable

Nested class for handles within a heap. To be used by the subclasses MinHeapPriorityQueue and MaxHeapPriorityQueue. Handle objects are stored in the heap's array, and they are opaque objects given by MinHeapPriorityQueue and MaxHeapPriorityQueue to users of priority queues.


Field Summary
protected  int index
          Index into the heap array.
protected  com.mhhe.clrs2e.DynamicSetElement info
          The information actually stored.
 
Constructor Summary
protected Heap.Handle(int index, com.mhhe.clrs2e.DynamicSetElement info)
          Initializes a Handle.
 
Method Summary
 int compareTo(java.lang.Object e)
          Compares the DynamicSetElement stored in this Handle to that stored in another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

protected int index
Index into the heap array.


info

protected com.mhhe.clrs2e.DynamicSetElement info
The information actually stored.

Constructor Detail

Heap.Handle

protected Heap.Handle(int index,
                      com.mhhe.clrs2e.DynamicSetElement info)
Initializes a Handle.

Parameters:
index - Index into the heap's array.
info - Information stored.
Method Detail

compareTo

public int compareTo(java.lang.Object e)
Compares the DynamicSetElement stored in this Handle to that stored in another.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
e - The other Handle object.
Returns:
A negative integer if this Handle's DynamicSetElement is less; 0 if the objects are equal; a positive integer if this Handle's DynamicSetElement is greater.