|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--brutil.PriorityQueueHeapArray
| Constructor Summary | |
PriorityQueueHeapArray()
|
|
| Method Summary | |
boolean |
decreaseKey(HandlePQ h,
int newkey)
Look at the (key, value) pair referenced by Handle h. |
void |
doubleArray(int counter)
Doubles the array size |
HandlePQ |
extractMin()
Extract the (key, value) pair associated with the smallest key in the queue and return its "value" object. |
int |
handleGetKey(HandlePQ h)
Get the key of the (key, value) pair associated with a given Handle. |
java.lang.Object |
handleGetValue(HandlePQ h)
Get the value object of the (key, value) pair associated with a given Handle. |
HandlePQ |
insert(int key,
java.lang.Object value)
Insert a pair (key, value) into the queue, and return a Handle to this pair so that we can find it later in constant time. |
boolean |
isEmpty()
Return true if there are no elements in the Priority Queue |
HandlePQ |
min()
Return the HandlePQ object with the smallest key in the queue. |
java.lang.String |
toString()
Returns all the elements in the PriorityQueue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public PriorityQueueHeapArray()
| Method Detail |
public HandlePQ insert(int key,
java.lang.Object value)
key - the key value of the objectvalue - the object to be stored in the queuepublic HandlePQ min()
public HandlePQ extractMin()
public boolean decreaseKey(HandlePQ h,
int newkey)
h - the HandlePQ whose key value needs to be modifiednewKey - the new valuepublic int handleGetKey(HandlePQ h)
h - the handlePQ object whose key value is neededpublic java.lang.Object handleGetValue(HandlePQ h)
h - the HandlePQ wrapper object that holds the inserted objectpublic void doubleArray(int counter)
public boolean isEmpty()
public java.lang.String toString()
toString in class java.lang.Object
|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||