PriorityQueueNode
for the purpose of maintaining the index in the priority queue.
Modifier and Type | Class and Description |
---|---|
private class |
Modifier and Type | Field and Description |
---|---|
private final Comparator | |
private static final PriorityQueueNode[] | |
private T[] | |
private int |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
private void | |
private void | |
public void | clear()
Overrides java. Implements java. |
public void | clearIgnoringIndexes()
Implements io. PriorityQueue without calling
PriorityQueueNode#priorityQueueIndex(DefaultPriorityQueue) or explicitly removing references to them to
allow them to be garbage collected.
|
public boolean | contains(Object
element whose presence in this collection is to be tested o)Overrides java. Implements java. true if this collection contains the specified element.
|
private boolean | |
public boolean | containsTyped(T node)
Implements io. contains(Object) but typed using generics.
|
public boolean | isEmpty()
Overrides java. Implements java. true if this collection contains no elements.
|
public Iterator | iterator()
Implements abstract java. Implements java. |
public boolean | offer(T
the element to add e)Implements java. |
public T | peek()
Implements java. null if this queue is empty.
|
public T | poll()
Implements java. null if this queue is empty.
|
public void | priorityChanged(T
An object which is in this queue and the priority may have changed. node)Implements io. node has changed.
|
public boolean | remove(Object
element to be removed from this collection, if present o)Overrides java. Implements java. |
public boolean | removeTyped(T node)
Implements io. remove(Object) but typed using generics.
|
public int | size()
Implements abstract java. Implements java. |
public Object[] | toArray()
Overrides java. Implements java. |
public <X> X[] | toArray(X[]
the array into which the elements of this collection are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose. a)Overrides java. Implements java. |
comparator | back to summary |
---|---|
private final Comparator<T> comparator |
EMPTY_ARRAY | back to summary |
---|---|
private static final PriorityQueueNode[] EMPTY_ARRAY |
queue | back to summary |
---|---|
private T[] queue |
size | back to summary |
---|---|
private int size |
DefaultPriorityQueue | back to summary |
---|---|
public DefaultPriorityQueue(Comparator<T> comparator, int initialSize)
|
bubbleDown | back to summary |
---|---|
private void bubbleDown(int k, T node) |
bubbleUp | back to summary |
---|---|
private void bubbleUp(int k, T node) |
clear | back to summary |
---|---|
public void clear() Overrides java. Implements java. Doc from java. Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
|
clearIgnoringIndexes | back to summary |
---|---|
public void clearIgnoringIndexes() Implements io. Doc from io. Removes all of the elements from this
|
contains | back to summary |
---|---|
public boolean contains(Object o) Overrides java. Implements java. Doc from java. Returns |
contains | back to summary |
---|---|
private boolean contains(PriorityQueueNode node, int i) |
containsTyped | back to summary |
---|---|
public boolean containsTyped(T node) Implements io. Doc from io. Same as
|
isEmpty | back to summary |
---|---|
public boolean isEmpty() Overrides java. Implements java. Doc from java. Returns
|
iterator | back to summary |
---|---|
public Iterator Implements abstract java. Implements java. This iterator does not return elements in any particular order.
|
offer | back to summary |
---|---|
public boolean offer(T e) Implements java. Doc from java. Inserts the specified element into this queue if it is possible to do
so immediately without violating capacity restrictions.
When using a capacity-restricted queue, this method is generally
preferable to
|
peek | back to summary |
---|---|
public T peek() Implements java. Doc from java. Retrieves, but does not remove, the head of this queue,
or returns
|
poll | back to summary |
---|---|
public T poll() Implements java. Doc from java. Retrieves and removes the head of this queue,
or returns
|
priorityChanged | back to summary |
---|---|
public void priorityChanged(T node) Implements io. Doc from io. Notify the queue that the priority for
|
remove | back to summary |
---|---|
public boolean remove(Object o) Overrides java. Implements java. Doc from java. Removes a single instance of the specified element from this
collection, if it is present (optional operation). More formally,
removes an element
|
removeTyped | back to summary |
---|---|
public boolean removeTyped(T node) Implements io. Doc from io. Same as
|
size | back to summary |
---|---|
public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this collection. If this collection
contains more than
|
toArray | back to summary |
---|---|
public Object[] toArray() Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this collection.
If this collection makes any guarantees as to what order its elements
are returned by its iterator, this method must return the elements in
the same order. The returned array's runtime component type is The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
|
toArray | back to summary |
---|---|
public <X> X[] toArray(X[] a) Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection. If this collection fits in the specified array with room to spare
(i.e., the array has more elements than this collection), the element
in the array immediately following the end of the collection is set to
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
|
Modifier and Type | Field and Description |
---|---|
private int |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public boolean | |
public T | |
public void | remove()
Overrides default java. |
index | back to summary |
---|---|
private int index |
PriorityQueueIterator | back to summary |
---|---|
private PriorityQueueIterator() |
hasNext | back to summary |
---|---|
public boolean hasNext() Implements java. Doc from java. Returns
|
next | back to summary |
---|---|
public T next() Implements java. Doc from java. Returns the next element in the iteration.
|
remove | back to summary |
---|---|
public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
|