| Modifier and Type | Field and Description |
|---|---|
| pack-priv final T[] | |
| pack-priv final Comparator | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| public | PriorityQ(final int
capacity maxSize, final Comparator<T> comparator c)Construct a priority queue with a given capacity |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private int | |
| public boolean | |
| public T | |
| public void | |
| private void | |
| public T | |
| public int | |
| public void |
| a | back to summary |
|---|---|
| pack-priv final T[] a | |
| comp | back to summary |
|---|---|
| pack-priv final Comparator<T> comp | |
| lastIndex | back to summary |
|---|---|
| pack-priv int lastIndex | |
| PriorityQ | back to summary |
|---|---|
| public PriorityQ(final int maxSize, final Comparator<T> c) Construct a priority queue with a given capacity
| |
| buildHeap | back to summary |
|---|---|
| public void buildHeap() build the heap... | |
| compare | back to summary |
|---|---|
| private int compare(T a, T b) | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Check whether the heap is empty.
| |
| peek | back to summary |
|---|---|
| public T peek() Look at the top of the heap
| |
| percolateDown | back to summary |
|---|---|
| public void percolateDown() Signals that the element on top of the heap has been updated | |
| percolateDown | back to summary |
|---|---|
| private void percolateDown(int i) | |
| poll | back to summary |
|---|---|
| public T poll() Remove the element on top of the heap
| |
| size | back to summary |
|---|---|
public int size()
| |
| toss | back to summary |
|---|---|
| public void toss(final T t) Add an element at the end of the queue
| |