|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.solr.util.LongPriorityQueue
public class LongPriorityQueue
A native long priority queue.
Field Summary | |
---|---|
protected int |
currentCapacity
|
protected long[] |
heap
|
protected int |
maxSize
|
protected long |
sentinel
|
protected int |
size
|
Constructor Summary | |
---|---|
LongPriorityQueue(int initialSize,
int maxSize,
long sentinel)
|
Method Summary | |
---|---|
long |
add(long element)
Adds an object to a PriorityQueue in log(size) time. |
void |
addNoCheck(long element)
Adds an object to a PriorityQueue in log(size) time. |
void |
clear()
Removes all entries from the PriorityQueue. |
int |
getCurrentCapacity()
|
long[] |
getInternalArray()
Returns the array used to hold the heap, with the smallest item at array[1] and the last (but not necessarily largest) at array[size()]. |
protected void |
initialize(int sz)
|
boolean |
insert(long element)
inserts the element and returns true if this element caused another element to be dropped from the queue. |
long |
insertWithOverflow(long element)
Adds an object to a PriorityQueue in log(size) time. |
long |
pop()
Removes and returns the least element of the PriorityQueue in log(size) time. |
void |
resize(int sz)
|
int |
size()
Returns the number of elements currently stored in the PriorityQueue. |
long[] |
sort(int n)
Pops the smallest n items from the heap, placing them in the internal array at arr[size] through arr[size-(n-1)] with the smallest (first element popped) being at arr[size]. |
long |
top()
Returns the least element of the PriorityQueue in constant time. |
long |
updateTop()
Should be called when the Object at top changes values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int size
protected int currentCapacity
protected int maxSize
protected long[] heap
protected final long sentinel
Constructor Detail |
---|
public LongPriorityQueue(int initialSize, int maxSize, long sentinel)
Method Detail |
---|
protected void initialize(int sz)
public int getCurrentCapacity()
public void resize(int sz)
public long add(long element)
ArrayIndexOutOfBoundsException
is thrown.
public void addNoCheck(long element)
ArrayIndexOutOfBoundsException
is thrown.
public long insertWithOverflow(long element)
public boolean insert(long element)
public long top()
public long pop()
public long updateTop()
public int size()
public long[] getInternalArray()
public long[] sort(int n)
public void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |