public abstract class SortingResponseWriter.PriorityQueue<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
maxSize |
protected int |
size |
Constructor and Description |
---|
SortingResponseWriter.PriorityQueue(int maxSize) |
SortingResponseWriter.PriorityQueue(int maxSize,
boolean prepopulate) |
Modifier and Type | Method and Description |
---|---|
T |
add(T element)
Adds an Object to a PriorityQueue in log(size) time.
|
void |
clear()
Removes all entries from the PriorityQueue.
|
Object[] |
getHeapArray()
This method returns the internal heap array as Object[].
|
protected T |
getSentinelObject() |
T |
insertWithOverflow(T element)
Adds an Object to a PriorityQueue in log(size) time.
|
protected abstract boolean |
lessThan(T a,
T b)
Determines the ordering of objects in this priority queue.
|
T |
pop()
Removes and returns the least element of the PriorityQueue in log(size)
time.
|
int |
size()
Returns the number of elements currently stored in the PriorityQueue.
|
T |
top()
Returns the least element of the PriorityQueue in constant time.
|
T |
updateTop()
Should be called when the Object at top changes values.
|
public SortingResponseWriter.PriorityQueue(int maxSize)
public SortingResponseWriter.PriorityQueue(int maxSize, boolean prepopulate)
protected abstract boolean lessThan(T a, T b)
true
iff parameter a is less than parameter b.protected T getSentinelObject()
public final T add(T element)
public T insertWithOverflow(T element)
public final T top()
public final T pop()
public final T updateTop()
pq.top().change(); pq.updateTop();instead of
o = pq.pop(); o.change(); pq.push(o);
public final int size()
public final void clear()
public final Object[] getHeapArray()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.