|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.util.PriorityQueue
PriorityQueue is a (blocking) priority queue. One of these will be used to store updates (and it will be read by the update thread) and the other stores query/success/fail messages for the location algorithm thread. Objects with small priorities come out first.
Field Summary | |
---|---|
static boolean |
DEBUG
|
Constructor Summary | |
---|---|
PriorityQueue(int initial_capacity)
The constructor creates a new priority queue. |
Method Summary | |
---|---|
int |
capacity()
returns the current capacity of the heap. |
boolean |
check()
|
boolean |
empty()
returns the number of objects currently in the queue (0 means empty). |
Object |
extract(boolean blocking)
extract() returns the object with the smallest priority in the queue and removes it from the queue. |
boolean |
insert(Object o,
long prio,
boolean blocking)
inserts an object with the given priority. |
int |
maxSize()
returns the maximum size of the heap. |
void |
print(int n)
|
void |
printPrios()
|
boolean |
remove(Object o)
removes the given object from the priority queue. returns true if the object was found and removed, false otherwise. |
boolean |
removeAll(Object o)
removes every instance the given object from the priority queue. |
int |
size()
returns the number of objects currently in the queue (0 means empty). |
Object |
topObject(boolean blocking)
topObject() returns the smallest priority object in the queue, or null if the queue is empty and blocking is not set. |
long |
topPriority(boolean blocking)
topPriority() returns the smallest priority in the queue, or 0 if the queue is empty and blocking is not set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DEBUG
Constructor Detail |
public PriorityQueue(int initial_capacity)
initial_capacity
- the initial capacity of the heap.Method Detail |
public int size()
public boolean empty()
public int maxSize()
public int capacity()
public boolean insert(Object o, long prio, boolean blocking)
blocking
- ignored.public boolean remove(Object o)
public boolean removeAll(Object o)
public long topPriority(boolean blocking)
public Object topObject(boolean blocking)
public Object extract(boolean blocking)
public boolean check()
public void print(int n)
public void printPrios()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |