|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object be.ac.ulg.montefiore.run.totem.util.PriorityQueue
public class PriorityQueue
Priority queue with integers
Creation date: 22-Jun.-2004
Field Summary | |
---|---|
protected PriorityQueueObjectInt[] |
heap
|
protected long |
keyComps
|
protected java.util.HashMap |
pos
|
protected int |
size
|
Constructor Summary | |
---|---|
PriorityQueue(int capacity)
Constructor |
Method Summary | |
---|---|
void |
add(PriorityQueueObjectInt elem)
Adds an object to the queue. |
void |
display()
|
long |
getKeyComps()
|
PriorityQueueObjectInt |
next()
Get the object with the minimum key in the queue |
protected void |
remove(PriorityQueueObjectInt elem)
|
PriorityQueueObjectInt |
removeNext()
Removes and returns the next object from the queue |
protected void |
siftup(int p,
int q)
|
int |
size()
Get the size of the queue |
void |
update(PriorityQueueObjectInt elem)
Updates the Object with the same id in the queue Decreases the value of elem's key and then performs sift-down until elem has been relocated to the correct position in the binary heap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PriorityQueueObjectInt[] heap
protected java.util.HashMap pos
protected int size
protected long keyComps
Constructor Detail |
---|
public PriorityQueue(int capacity)
capacity
- the maximum queue capacityMethod Detail |
---|
public PriorityQueueObjectInt next()
next
in interface PriorityQueueIFInt
public void add(PriorityQueueObjectInt elem)
add
in interface PriorityQueueIFInt
elem
- the object to addpublic PriorityQueueObjectInt removeNext()
removeNext
in interface PriorityQueueIFInt
public void update(PriorityQueueObjectInt elem)
update
in interface PriorityQueueIFInt
elem
- The object to update in the queuepublic int size()
size
in interface PriorityQueueIFInt
protected void remove(PriorityQueueObjectInt elem)
protected void siftup(int p, int q)
public void display()
public long getKeyComps()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |