|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MaxPriorityQueue
MaxPriorityQueue
maintains a Collection
of
Object
s, each with an associated priority.
Implementations should make the peekMax
and
removeMax
operations efficient. Implementations
need not implement the Object-addition operations of the
Collection
interface, since they do not associate each
added Object
with a priority.
Method Summary | |
---|---|
void |
changePriority(Object item,
int delta)
Change the priority of this element by the specified delta. |
Object |
deleteMax()
Returns and removes the Object in
this with the highest priority. |
int |
getPriority(Object item)
Returns the priority currently associated with this item. |
boolean |
insert(Object item,
int priority)
Inserts item into this, assigning it priority
priority . |
Object |
peekMax()
Returns the Object in this with the
highest priority. |
int |
setPriority(Object item,
int newPriority)
Changes the priority of this Object
to the new, specified value, and returns the old value |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Method Detail |
---|
boolean insert(Object item, int priority)
item
into this, assigning it priority
priority
.
item
- Object
being insertedpriority
- Priority of item
Object peekMax()
Object
in this
with the
highest priority.
Object deleteMax()
Object
in
this
with the highest priority.
int getPriority(Object item)
int setPriority(Object item, int newPriority)
Object
to the new, specified value, and returns the old value
void changePriority(Object item, int delta)
setPriority(item, getPriority(item)+delta).
It might save time in some implementations.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |