public static class IndirectPriorityQueues.EmptyIndirectPriorityQueue extends Object implements IndirectPriorityQueue
This class may be useful to implement your own in case you subclass
IndirectPriorityQueue.
| Modifier and Type | Method and Description |
|---|---|
void |
allChanged()
Notifies this queue that the all elements have changed (optional operation).
|
void |
changed()
Notifies this queue that the first element has changed (optional operation).
|
void |
changed(int i)
Notifies this queue that the specified element has changed (optional operation).
|
void |
clear()
Removes all elements from this queue.
|
Comparator<?> |
comparator()
Returns the comparator associated with this queue, or
null if it uses its elements' natural ordering. |
boolean |
contains(int index)
Checks whether a given index belongs to this queue (optional operation).
|
int |
dequeue()
Dequeues the first element from this queue.
|
void |
enqueue(int i)
Enqueues a new element.
|
int |
first()
Returns the first element of this queue.
|
int |
front(int[] a)
Retrieves the front of this queue in a given array (optional operation).
|
boolean |
isEmpty()
Checks whether this queue is empty.
|
int |
last()
Returns the last element of this queue, that is, the element the would be dequeued last (optional operation).
|
boolean |
remove(int i)
Removes the specified element from this queue (optional operation).
|
int |
size()
Returns the number of elements in this queue.
|
public void enqueue(int i)
IndirectPriorityQueueenqueue in interface IndirectPriorityQueuei - the element to enqueue.public int dequeue()
IndirectPriorityQueuedequeue in interface IndirectPriorityQueuepublic boolean isEmpty()
IndirectPriorityQueueThis default implementation checks whether IndirectPriorityQueue.size() is zero.
isEmpty in interface IndirectPriorityQueuepublic int size()
IndirectPriorityQueuesize in interface IndirectPriorityQueuepublic boolean contains(int index)
IndirectPriorityQueueThis default implementation just throws an UnsupportedOperationException.
contains in interface IndirectPriorityQueueindex - an index possibly in the queue.public void clear()
IndirectPriorityQueueclear in interface IndirectPriorityQueuepublic int first()
IndirectPriorityQueuefirst in interface IndirectPriorityQueuepublic int last()
IndirectPriorityQueueThis default implementation just throws an UnsupportedOperationException.
last in interface IndirectPriorityQueuepublic void changed()
IndirectPriorityQueueThis default implementation just calls IndirectPriorityQueue.changed(int) with argument IndirectPriorityQueue.first().
changed in interface IndirectPriorityQueuepublic void allChanged()
IndirectPriorityQueueThis default implementation just throws an UnsupportedOperationException.
allChanged in interface IndirectPriorityQueuepublic Comparator<?> comparator()
IndirectPriorityQueuenull if it uses its elements' natural ordering.comparator in interface IndirectPriorityQueuenull if it uses its elements' natural ordering.public void changed(int i)
IndirectPriorityQueueNote that the specified element must belong to this queue.
This default implementation just throws an UnsupportedOperationException.
changed in interface IndirectPriorityQueuei - the element that has changed.public boolean remove(int i)
IndirectPriorityQueueThis default implementation just throws an UnsupportedOperationException.
remove in interface IndirectPriorityQueuei - the element to be removed.public int front(int[] a)
IndirectPriorityQueueThe front of an indirect queue is the set of indices whose associated elements in the reference array are equal to the element associated to the first index. These indices can be always obtain by dequeueing, but this method should retrieve efficiently such indices in the given array without modifying the state of this queue.
This default implementation just throws an UnsupportedOperationException.
front in interface IndirectPriorityQueuea - an array large enough to hold the front (e.g., at least long as the reference array).a).