Package org.apache.lucene.util
Class ArrayTimSorter<T>
- java.lang.Object
-
- org.apache.lucene.util.Sorter
-
- org.apache.lucene.util.TimSorter
-
- org.apache.lucene.util.ArrayTimSorter<T>
-
-
Field Summary
Fields Modifier and Type Field Description private T[]
arr
private java.util.Comparator<? super T>
comparator
private T[]
tmp
-
Fields inherited from class org.apache.lucene.util.TimSorter
maxTempSlots, MIN_GALLOP, minRun, MINRUN, runEnds, stackSize, STACKSIZE, THRESHOLD, to
-
Fields inherited from class org.apache.lucene.util.Sorter
BINARY_SORT_THRESHOLD, INSERTION_SORT_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description ArrayTimSorter(T[] arr, java.util.Comparator<? super T> comparator, int maxTempSlots)
Create a newArrayTimSorter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
compare(int i, int j)
Compare entries found in slotsi
andj
.protected int
compareSaved(int i, int j)
Compare elementi
from the temporary storage with elementj
from the slice to sort, similarly toSorter.compare(int, int)
.protected void
copy(int src, int dest)
Copy data from slotsrc
to slotdest
.protected void
restore(int src, int dest)
Restore elementj
from the temporary storage into sloti
.protected void
save(int start, int len)
Save all elements between slotsi
andi+len
into the temporary storage.protected void
swap(int i, int j)
Swap values at slotsi
andj
.-
Methods inherited from class org.apache.lucene.util.TimSorter
doRotate, ensureInvariants, exhaustStack, lowerSaved, lowerSaved3, merge, mergeAt, mergeHi, mergeLo, minRun, nextRun, pushRunLen, reset, runBase, runEnd, runLen, setRunEnd, sort, upperSaved, upperSaved3
-
Methods inherited from class org.apache.lucene.util.Sorter
binarySort, binarySort, checkRange, comparePivot, heapChild, heapify, heapParent, heapSort, insertionSort, lower, lower2, mergeInPlace, reverse, rotate, setPivot, siftDown, upper, upper2
-
-
-
-
Constructor Detail
-
ArrayTimSorter
public ArrayTimSorter(T[] arr, java.util.Comparator<? super T> comparator, int maxTempSlots)
Create a newArrayTimSorter
.
-
-
Method Detail
-
compare
protected int compare(int i, int j)
Description copied from class:Sorter
Compare entries found in slotsi
andj
. The contract for the returned value is the same asComparator.compare(Object, Object)
.
-
swap
protected void swap(int i, int j)
Description copied from class:Sorter
Swap values at slotsi
andj
.
-
copy
protected void copy(int src, int dest)
Description copied from class:TimSorter
Copy data from slotsrc
to slotdest
.
-
save
protected void save(int start, int len)
Description copied from class:TimSorter
Save all elements between slotsi
andi+len
into the temporary storage.
-
restore
protected void restore(int src, int dest)
Description copied from class:TimSorter
Restore elementj
from the temporary storage into sloti
.
-
compareSaved
protected int compareSaved(int i, int j)
Description copied from class:TimSorter
Compare elementi
from the temporary storage with elementj
from the slice to sort, similarly toSorter.compare(int, int)
.- Specified by:
compareSaved
in classTimSorter
-
-