|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LongPriorityQueue
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 object has a priority associated with it that determines when
in relation to the other elements in the queue this element should be
retrieved. Priorities are long
s here.
If there are several elements in the queue that have the same priority their order can be managed by adding them to the front or the end of the list of elements at that priority. Similarly, retrival can be from the front or the end of the list of elements with the same priority.
Method Summary | |
---|---|
void |
addElementAtEnd(java.lang.Object object,
long priority)
This function adds the given object at the given priority to this priority queue. |
void |
addElementAtFront(java.lang.Object object,
long priority)
This function adds the given object at the given priority to this priority queue. |
boolean |
containsElementAt(java.lang.Object object,
long priority)
This function tests whether the given element is currently in this queue at the given priority. |
java.util.Iterator |
elements()
This function returns an iterator of the elements in this priority queue. |
java.lang.Object |
getHighestEnd()
This function returns the element in this priority queue that has the highest priority. |
java.lang.Object |
getHighestFront()
This function returns the element in this priority queue that has the highest priority. |
java.lang.Object |
getLowestEnd()
This function returns the element in this priority queue that has the lowest priority. |
java.lang.Object |
getLowestFront()
This function returns the element in this priority queue that has the lowest priority. |
boolean |
isEmpty()
This function tests whether this priority queue is empty. |
int |
length()
This function returns the size of this priority queue. |
boolean |
removeElementAt(java.lang.Object object,
long priority)
This function attempts to remove the given object at the given priority from this priority queue. |
java.lang.Object |
removeHighestEnd()
This function removes and returns the element in this priority queue that has the highest priority. |
java.lang.Object |
removeHighestFront()
This function removes and returns the element in this priority queue that has the highest priority. |
java.lang.Object |
removeLowestEnd()
This function removes and returns the element in this priority queue that has the lowest priority. |
java.lang.Object |
removeLowestFront()
This function removes and returns the element in this priority queue that has the lowest priority. |
Method Detail |
---|
void addElementAtFront(java.lang.Object object, long priority)
This function adds the given object at the given priority to this priority queue. If there are already elements queued at this priority, the new element will be queued at the front.
object
- the Object
to be added to this
LongPriorityQueue
priority
- the priority with which the element is to be queuedvoid addElementAtEnd(java.lang.Object object, long priority)
This function adds the given object at the given priority to this priority queue. If there are already elements queued at this priority, the new element will be queued at the end.
object
- the Object
to be added to this
LongPriorityQueue
priority
- the priority with which the element is to be queuedboolean isEmpty()
This function tests whether this priority queue is empty.
true
if and only if this LongPriorityQueue
contains no elementsint length()
This function returns the size of this priority queue.
LongPriorityQueue
boolean containsElementAt(java.lang.Object object, long priority)
This function tests whether the given element is currently in this queue at the given priority.
object
- the Object
to be tested forpriority
- the priority at which it should be queued
java.lang.Object getLowestFront() throws java.util.NoSuchElementException
This function returns the element in this priority queue 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.
Object
that has the lowest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object getLowestEnd() throws java.util.NoSuchElementException
This function returns the element in this priority queue 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.
Object
that has the lowest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object getHighestFront() throws java.util.NoSuchElementException
This function returns the element in this priority queue 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.
Object
that has the highest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object getHighestEnd() throws java.util.NoSuchElementException
This function returns the element in this priority queue 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.
Object
that has the highest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object removeLowestFront() throws java.util.NoSuchElementException
This function removes and returns the element in this priority queue 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.
Object
that has the lowest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object removeLowestEnd() throws java.util.NoSuchElementException
This function removes and returns the element in this priority queue 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.
Object
that has the lowest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object removeHighestFront() throws java.util.NoSuchElementException
This function removes and returns the element in this priority queue 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.
Object
that has the highest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyjava.lang.Object removeHighestEnd() throws java.util.NoSuchElementException
This function removes and returns the element in this priority queue 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.
Object
that has the highest priority in this
LongPriorityQueue
java.util.NoSuchElementException
- if this LongPriorityQueue
is
emptyboolean removeElementAt(java.lang.Object object, long priority)
This function attempts to remove the given object at the given priority from this priority queue. Whether the removal was successful is returned.
object
- the Object
to be removed from this
LongPriorityQueue
priority
- the priority at which the element is currently queued
true
if and only if the object was indeed removed
from the queuejava.util.Iterator elements()
This function returns an iterator of the elements in this priority queue.
Iterator
for this LongPriorityQueue
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |