|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.util.PriorityQueueRVM
public class PriorityQueueRVM
This class implements a priority queue using the standard (balanced partially-ordered tree, i.e., "heap") algorithm. Smaller priority objects are in the front of the queue.
| Nested Class Summary | |
|---|---|
private static class |
PriorityQueueRVM.PriorityQueueNode
A local class that holds the nodes of the priority tree |
| Field Summary | |
|---|---|
private int |
numElements
the number of elements actually in the queue |
private PriorityQueueRVM.PriorityQueueNode[] |
queue
the queue, we use elements 1..queue.length |
| Constructor Summary | |
|---|---|
protected |
PriorityQueueRVM()
|
| Method Summary | |
|---|---|
Object |
deleteMin()
Remove and return the front (minimum) object |
void |
insert(double _priority,
Object _data)
Insert the object passed with the priority value passed |
protected boolean |
isEmpty()
Checks if the queue is empty |
int |
numElements()
Determines number of elements in the queue |
private void |
reheapify(int startingElement)
Starting at the position passed, swap with parent until heap condition is satisfied, i.e., bubble up |
double |
rootValue()
Return the priority of front object without removing it |
String |
toString()
Prints the contents of the queue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private PriorityQueueRVM.PriorityQueueNode[] queue
private int numElements
| Constructor Detail |
|---|
protected PriorityQueueRVM()
| Method Detail |
|---|
public final int numElements()
protected final boolean isEmpty()
private void reheapify(int startingElement)
startingElement - the position to start at
public void insert(double _priority,
Object _data)
_priority - the priority of the inserted object_data - the object to insertpublic Object deleteMin()
public final double rootValue()
public String toString()
toString in class Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||