The HitQueue type exposes the following members.
Constructors
Name | Description | |
---|---|---|
HitQueue | Creates a new instance with CopyC# size CopyC# prePopulate CopyC# size NOTE: in case CopyC# prePopulate PriorityQueue pq = new HitQueue(10, true); // pre-populate. ScoreDoc top = pq.top(); // Add/Update one element. top.score = 1.0f; top.doc = 0; top = (ScoreDoc) pq.updateTop(); int totalHits = 1; // Now pop only the elements that were *truly* inserted. // First, pop all the sentinel elements (there are pq.size() - totalHits). for (int i = pq.size() - totalHits; i > 0; i--) pq.pop(); // Now pop the truly added elements. ScoreDoc[] results = new ScoreDoc[totalHits]; for (int i = totalHits - 1; i >= 0; i--) { results[i] = (ScoreDoc) pq.pop(); }NOTE: This class pre-allocate a full array of length CopyC# size |
Methods
Name | Description | |
---|---|---|
Add | Adds an Object to a PriorityQueue in log(size) time. If one tries to add
more objects than maxSize from initialize an
{@link ArrayIndexOutOfBoundsException} is thrown.
(Inherited from PriorityQueue.) | |
AdjustTop | Obsolete. Should be called when the Object at top changes values. Still log(n) worst
case, but it's at least twice as fast to
(Inherited from PriorityQueue.)pq.top().change(); pq.adjustTop();instead of o = pq.pop(); o.change(); pq.push(o); | |
Clear | Removes all entries from the PriorityQueue. (Inherited from PriorityQueue.) | |
Equals | (Inherited from Object.) | |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetSentinelObject | (Overrides PriorityQueue..::..GetSentinelObject()()()().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Initialize | Subclass constructors must call this. (Inherited from PriorityQueue.) | |
Insert | Obsolete. Adds element to the PriorityQueue in log(size) time if either the
PriorityQueue is not full, or not lessThan(element, top()).
(Inherited from PriorityQueue.) | |
InsertWithOverflow | insertWithOverflow() is the same as insert() except its
return value: it returns the object (if any) that was
dropped off the heap because it was full. This can be
the given parameter (in case it is smaller than the
full heap's minimum, and couldn't be added), or another
object that was previously the smallest value in the
heap and now has been replaced by a larger one, or null
if the queue wasn't yet full with maxSize elements.
(Inherited from PriorityQueue.) | |
LessThan | (Overrides PriorityQueue..::..LessThan(Object, Object).) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Pop | Removes and returns the least element of the PriorityQueue in log(size)
time.
(Inherited from PriorityQueue.) | |
Put | Obsolete. Adds an Object to a PriorityQueue in log(size) time. If one tries to add
more objects than maxSize from initialize a RuntimeException
(ArrayIndexOutOfBound) is thrown.
(Inherited from PriorityQueue.) | |
Size | Returns the number of elements currently stored in the PriorityQueue. (Inherited from PriorityQueue.) | |
Top | Returns the least element of the PriorityQueue in constant time. (Inherited from PriorityQueue.) | |
ToString | (Inherited from Object.) | |
UpdateTop | Should be called when the Object at top changes values. Still log(n) worst
case, but it's at least twice as fast to
(Inherited from PriorityQueue.)pq.top().change(); pq.updateTop();instead of o = pq.pop(); o.change(); pq.push(o); |
Fields
Name | Description | |
---|---|---|
heap | (Inherited from PriorityQueue.) |