|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.util.ListPriorityQueue
A ListPriorityQueue is an implementation of the PriorityQueue interface using a java.util.ArrayList.
Inner Class Summary | |
class |
ListPriorityQueue.Entry
|
Field Summary | |
protected java.util.Comparator |
comparator
comparator is the comparator for priorities in this priority queue. |
protected java.util.ArrayList |
entries
entries is the list of entries for this priority queue. |
Constructor Summary | |
protected |
ListPriorityQueue()
This constructor is disabled. |
|
ListPriorityQueue(java.util.Comparator c)
new ListPriorityQueue(c) returns a priority queue that uses c for comparing priorities. |
Method Summary | |
void |
add(java.lang.Object dat,
java.lang.Object pri)
pq.add(dat, pri) adds dat to pq with priority pri. |
protected int |
addIndex(java.lang.Object pri)
addIndex(pri) returns the index at which pri should be added to this priority queue. |
void |
clear()
pq.clear() removes all entries from pq. |
java.lang.Object |
data()
pq.data() returns the highest priority data in pq. |
java.util.Iterator |
iterator()
pq.iterator() returns an iterator for the entries of pq. |
boolean |
more()
pq.more() returns true if there are more entries in pq. |
java.lang.Object |
priority()
pq.priority() returns the priority of the highest priority entry in pq. |
void |
remove()
pq.remove() removes the highest priority entry from pq. |
int |
size()
pq.size() returns the number of entries in pq. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.util.ArrayList entries
protected java.util.Comparator comparator
Constructor Detail |
protected ListPriorityQueue()
public ListPriorityQueue(java.util.Comparator c)
Method Detail |
public boolean more()
public int size()
public void add(java.lang.Object dat, java.lang.Object pri)
public java.lang.Object data()
Precondition: pq.more() is true
public java.lang.Object priority()
Precondition: pq.more() is true
public void remove()
Precondition: pq.more() is true
public void clear()
public java.util.Iterator iterator()
protected int addIndex(java.lang.Object pri)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |