|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.usp.ime.klava.segmentit.structures.PriorityQueue<T>
T - the type of elements held in this queuepublic class PriorityQueue<T>
Implements a priority queue, using a First In, First Out policy and priorities given by non-negative integer numbers. Smaller priority numbers represents higher priorities.
| Constructor Summary | |
|---|---|
PriorityQueue(int maxPriority)
Creates an priority queue to store elements with priorities up to maxPriority. |
|
| Method Summary | |
|---|---|
void |
add(T element,
int priority)
Appends the specified element to the queue with the given priority. |
void |
clear()
Removes all of the elements from this queue. |
int |
getMinPriority()
Returns the priority of the element with the highest prSmaller priority numbers represents higher priorities.iority. |
boolean |
isEmpty()
Returns true if this queue contains no elements. |
T |
remove()
Returns the element with the highest priority, removing it. |
void |
remove(T element,
int priority)
Removes the first occurrence of the specified element with the given priority, if it is present. |
int |
size()
Returns the number of elements in this queue. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PriorityQueue(int maxPriority)
maxPriority.
maxPriority - the maximum priority given to an element in this queue| Method Detail |
|---|
public T remove()
null if this
queue is emptypublic int getMinPriority()
-1 if this queue is empty
public void add(T element,
int priority)
element - element to be appended to this queuepriority - priority given to the element to be appended
public void remove(T element,
int priority)
element - element to be removed from this queuepriority - priority of the element to be removedpublic boolean isEmpty()
true if this queue contains no elements.
true if this queue contains no elementspublic int size()
public void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||