public class PartialOrderPriorityQueue<T> extends AbstractQueue<T> implements Queue<T>
Constructor and Description |
---|
PartialOrderPriorityQueue(Comparator<T> comparator,
int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
adjustTop()
Should be called when the Object at top changes values.
|
void |
clear()
Removes all entries from the PriorityQueue.
|
Iterator<T> |
iterator() |
boolean |
offer(T element)
Adds element to the PriorityQueue in log(size) time if either the
PriorityQueue is not full, or not lessThan(element, top()).
|
T |
peek()
Returns the least element of the PriorityQueue in constant time, but
does not remove it from the priority queue.
|
T |
poll()
Removes and returns the least element of the PriorityQueue in
log(size) time.
|
void |
put(T element)
Adds a buffer to a PriorityQueue in log(size) time.
|
int |
remainingCapacity()
Returns the remaining capacity of the backing array.
|
int |
size()
Returns the number of elements currently stored in the PriorityQueue.
|
add, addAll, element, remove
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public PartialOrderPriorityQueue(Comparator<T> comparator, int capacity)
public int remainingCapacity()
public final void put(T element)
public boolean offer(T element)
public final T peek()
public final T poll()
public final void adjustTop()
{ pq.top().change(); pq.adjustTop(); }instead of
{ o = pq.pop(); o.change(); pq.push(o); }
public final int size()
size
in interface Collection<T>
size
in class AbstractCollection<T>
public final void clear()
clear
in interface Collection<T>
clear
in class AbstractQueue<T>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.