public static class IndirectDoublePriorityQueues.SynchronizedIndirectDoublePriorityQueue<K> extends java.lang.Object implements IndirectDoublePriorityQueue<K>
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
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.
|
java.util.Comparator<? super K> |
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 index)
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).
|
java.util.Comparator<? super K> |
secondaryComparator()
Returns the secondary comparator of this queue.
|
int |
secondaryFirst()
Returns the first element of this queue with respect to the secondary comparator.
|
int |
secondaryFront(int[] a)
Retrieves the secondary front of the queue in a given array (optional operation).
|
int |
secondaryLast()
Returns the last element of this queue with respect to the secondary comparator (optional operation).
|
int |
size()
Returns the number of elements in this queue.
|
public static final long serialVersionUID
public void enqueue(int index)
IndirectPriorityQueue
enqueue
in interface IndirectPriorityQueue<K>
index
- the element to enqueue.public int dequeue()
IndirectPriorityQueue
dequeue
in interface IndirectPriorityQueue<K>
public int first()
IndirectPriorityQueue
first
in interface IndirectPriorityQueue<K>
public int last()
IndirectPriorityQueue
last
in interface IndirectPriorityQueue<K>
public boolean contains(int index)
IndirectPriorityQueue
contains
in interface IndirectPriorityQueue<K>
index
- an index possibly in the queue.public int secondaryFirst()
IndirectDoublePriorityQueue
secondaryFirst
in interface IndirectDoublePriorityQueue<K>
public int secondaryLast()
IndirectDoublePriorityQueue
secondaryLast
in interface IndirectDoublePriorityQueue<K>
public boolean isEmpty()
IndirectPriorityQueue
isEmpty
in interface IndirectPriorityQueue<K>
public int size()
IndirectPriorityQueue
size
in interface IndirectPriorityQueue<K>
public void clear()
IndirectPriorityQueue
clear
in interface IndirectPriorityQueue<K>
public void changed()
IndirectPriorityQueue
changed
in interface IndirectPriorityQueue<K>
public void allChanged()
IndirectPriorityQueue
allChanged
in interface IndirectPriorityQueue<K>
public void changed(int i)
IndirectPriorityQueue
Note that the specified element must belong to this queue.
changed
in interface IndirectPriorityQueue<K>
i
- the element that has changed.public boolean remove(int i)
IndirectPriorityQueue
remove
in interface IndirectPriorityQueue<K>
i
- the element to be removed.public java.util.Comparator<? super K> comparator()
IndirectPriorityQueue
null
if it uses its elements' natural ordering.comparator
in interface IndirectPriorityQueue<K>
null
if it uses its elements' natural ordering.public java.util.Comparator<? super K> secondaryComparator()
IndirectDoublePriorityQueue
secondaryComparator
in interface IndirectDoublePriorityQueue<K>
IndirectDoublePriorityQueue.secondaryFirst()
public int secondaryFront(int[] a)
IndirectDoublePriorityQueue
secondaryFront
in interface IndirectDoublePriorityQueue<K>
a
- an array large enough to hold the secondary front (e.g., at least long as the reference array).a
).IndirectPriorityQueue.front(int[])
public int front(int[] a)
IndirectPriorityQueue
The 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.
front
in interface IndirectPriorityQueue<K>
a
- an array large enough to hold the front (e.g., at least long as the reference array).a
).