|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generic min-priority queue (smaller priority value = higher priority).
Method Summary | |
void |
decreasePriority(java.lang.Object item,
java.lang.Comparable priority)
Decreases the priority of the given item to the given priority value if the new priority is less than the old, does nothing otherwise. |
java.lang.Object |
deleteMinPriority()
Removes the first item with smallest priority value from this queue, and returns this item. |
java.lang.Object |
getMinPriority()
Returns the first item with smallest priority value in this queue. |
void |
insert(java.lang.Object item,
java.lang.Comparable priority)
Adds the given item with the given priority value to this queue. |
boolean |
isEmpty()
Returns true if the queue is empty and false otherwise. |
Method Detail |
public boolean isEmpty()
public java.lang.Object getMinPriority()
java.lang.NullPointerException
- if this queue is emptypublic java.lang.Object deleteMinPriority()
java.lang.NullPointerException
- if this queue is emptypublic void insert(java.lang.Object item, java.lang.Comparable priority)
item
- the item to add to this queuepriority
- the priority value for item
java.lang.NullPointerException
- if item == null or priority == nullpublic void decreasePriority(java.lang.Object item, java.lang.Comparable priority)
item
- whose priority will be decreasedpriority
- the new priority value for item
java.lang.NullPointerException
- if item == null or priority == null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |