|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectengine_lsd.PriorityQueue
public class PriorityQueue
Implements a priority queue via a binary heap.
Field Summary | |
---|---|
private State[] |
array
|
private int |
currentSize
|
private static int |
DEFAULT_CAPACITY
|
Constructor Summary | |
---|---|
PriorityQueue()
Construct the priority queue |
Method Summary | |
---|---|
void |
clear()
Make the priority queue logically empty. |
private void |
doubleArray()
Internal method to extend array. |
State |
get()
Remove the smallest item from the priority queue. |
boolean |
isEmpty()
Test if the priority queue is logically empty. |
State |
look()
Find the smallest item in the priority queue. |
private void |
percolateDown(int hole)
Internal method to percolate down in the heap. |
void |
put(State x)
Insert into the priority queue. |
int |
size()
Returns size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int DEFAULT_CAPACITY
private int currentSize
private State[] array
Constructor Detail |
---|
public PriorityQueue()
Method Detail |
---|
public void put(State x)
x
- the item to insert.public State look()
public State get()
public boolean isEmpty()
public int size()
public void clear()
private void percolateDown(int hole)
hole
- the index at which the percolate begins.private void doubleArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |