|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- the element type for elements queuedN
- the priority type for priorities of the elementspublic interface PriorityQueue<E,N extends java.lang.Number>
This class represents a priority queue, that is a queue in which elements can
be held and from which they can be retrieved by priority. For this purpose,
each element has a numeric priority associated with it that determines when
in relation to the other elements in the queue this element should be
retrieved. Priorities are Number
s here.
If there are several elements in the queue that have the same priority their order can be managed by adding to the front or the end of the list of elements at that priority. Similarly, retrieval can be from the front or the end of the list of elements with the same priority.
Method Summary | |
---|---|
void |
addElementFirst(E elt,
N priority)
This function adds the given element at the given priority to this PriorityQueue. |
void |
addElementLast(E elt,
N priority)
This function adds the given element at the given priority to this PriorityQueue. |
boolean |
containsElementAt(E elt,
N priority)
This function tests whether the given element is currently in this queue at the given priority. |
E |
getHighestFirst()
This function returns the element in this PriorityQueue that has the highest priority. |
E |
getHighestLast()
This function returns the element in this PriorityQueue that has the highest priority. |
E |
getLowestFirst()
This function returns the element in this PriorityQueue that has the lowest priority. |
E |
getLowestLast()
This function returns the element in this PriorityQueue that has the lowest priority. |
boolean |
isEmpty()
This function tests whether this PriorityQueue is empty. |
int |
length()
This function returns the size of this PriorityQueue. |
boolean |
removeElementAt(E elt,
N priority)
This function attempts to remove the given element at the given priority from this PriorityQueue. |
E |
removeHighestFirst()
This function removes and returns the element in this PriorityQueue that has the highest priority. |
E |
removeHighestLast()
This function removes and returns the element in this PriorityQueue that has the highest priority. |
E |
removeLowestFirst()
This function removes and returns the element in this PriorityQueue that has the lowest priority. |
E |
removeLowestLast()
This function removes and returns the element in this PriorityQueue that has the lowest priority. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
void addElementFirst(E elt, N priority)
This function adds the given element at the given priority to this PriorityQueue. If there are already elements queued at this priority, the new element will be queued at the front.
elt
- the element to be added to this PriorityQueuepriority
- the priority with which the element is to be queuedvoid addElementLast(E elt, N priority)
This function adds the given element at the given priority to this PriorityQueue. If there are already elements queued at this priority, the new element will be queued at the end.
elt
- the element to be added to this PriorityQueuepriority
- the priority with which the element is to be queuedboolean isEmpty()
This function tests whether this PriorityQueue is empty.
int length()
This function returns the size of this PriorityQueue.
E getLowestFirst() throws java.util.NoSuchElementException
This function returns the element in this PriorityQueue that has the lowest priority. If there are several elements queued at that priority, the element at the front of the list is retrieved. An exception is thrown if there is no such element, i.e. if this PriorityQueue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE getLowestLast() throws java.util.NoSuchElementException
This function returns the element in this PriorityQueue that has the lowest priority. If there are several elements queued at that priority, the element at the end of the list is retrieved. An exception is thrown if there is no such element, i.e. if this PriorityQueue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE getHighestFirst() throws java.util.NoSuchElementException
This function returns the element in this PriorityQueue that has the highest priority. If there are several elements queued at that priority, the element at the front of the list is retrieved. An exception is thrown if there is no such element, i.e. if this PriorityQueue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE getHighestLast() throws java.util.NoSuchElementException
This function returns the element in this PriorityQueue that has the highest priority. If there are several elements queued at that priority, the element at the end of the list is retrieved. An exception is thrown if there is no such element, i.e. if this PriorityQueue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyboolean containsElementAt(E elt, N priority)
This function tests whether the given element is currently in this queue at the given priority.
elt
- the element to be tested forpriority
- the priority at which it should be queued
E removeLowestFirst() throws java.util.NoSuchElementException
This function removes and returns the element in this PriorityQueue that has the lowest priority. If there are several elements queued at that priority, the element at the front of the list is retrieved. An exception is thrown if there is no such element, i.e. if this priority queue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE removeLowestLast() throws java.util.NoSuchElementException
This function removes and returns the element in this PriorityQueue that has the lowest priority. If there are several elements queued at that priority, the element at the end of the list is retrieved. An exception is thrown if there is no such element, i.e. if this priority queue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE removeHighestFirst() throws java.util.NoSuchElementException
This function removes and returns the element in this PriorityQueue that has the highest priority. If there are several elements queued at that priority, the element at the front of the list is retrieved. An exception is thrown if there is no such element, i.e. if this priority queue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyE removeHighestLast() throws java.util.NoSuchElementException
This function removes and returns the element in this PriorityQueue that has the highest priority. If there are several elements queued at that priority, the element at the end of the list is retrieved. An exception is thrown if there is no such element, i.e. if this priority queue is empty.
java.util.NoSuchElementException
- if this PriorityQueue is emptyboolean removeElementAt(E elt, N priority)
This function attempts to remove the given element at the given priority from this PriorityQueue. Whether the removal was successful is returned.
elt
- the element to be removed from this PriorityQueuepriority
- the priority at which the element is currently queued
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |