|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.javaewah.datastructure.PriorityQ<T>
T
- object typepublic final class PriorityQ<T>
Special-purpose priority queue. Does limited error checking and supports toss, buildHeap, poll, peek, percolateDown. It is faster than the equivalent class from java.util.
Constructor Summary | |
---|---|
PriorityQ(int maxSize,
Comparator<T> c)
Construct a priority queue with a given capacity |
Method Summary | |
---|---|
void |
buildHeap()
build the heap... |
boolean |
isEmpty()
Check whether the heap is empty. |
T |
peek()
Look at the top of the heap |
void |
percolateDown()
Signals that the element on top of the heap has been updated |
T |
poll()
Remove the element on top of the heap |
int |
size()
|
void |
toss(T t)
Add an element at the end of the queue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PriorityQ(int maxSize, Comparator<T> c)
maxSize
- capacityc
- comparatorMethod Detail |
---|
public int size()
public void toss(T t)
t
- element to be addedpublic T peek()
public void buildHeap()
public void percolateDown()
public T poll()
public boolean isEmpty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |