Modifier and Type | Field and Description |
---|---|
private T[] |
arr |
private java.util.Comparator<? super T> |
comparator |
private T[] |
tmp |
maxTempSlots, MIN_GALLOP, minRun, MINRUN, runEnds, stackSize, STACKSIZE, THRESHOLD, to
BINARY_SORT_THRESHOLD
Constructor and Description |
---|
ArrayTimSorter(T[] arr,
java.util.Comparator<? super T> comparator,
int maxTempSlots)
Create a new
ArrayTimSorter . |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(int i,
int j)
Compare entries found in slots
i and j . |
protected int |
compareSaved(int i,
int j)
Compare element
i from the temporary storage with element
j from the slice to sort, similarly to
Sorter.compare(int, int) . |
protected void |
copy(int src,
int dest)
Copy data from slot
src to slot dest . |
protected void |
restore(int src,
int dest)
Restore element
j from the temporary storage into slot i . |
protected void |
save(int start,
int len)
Save all elements between slots
i and i+len
into the temporary storage. |
protected void |
swap(int i,
int j)
Swap values at slots
i and j . |
doRotate, ensureInvariants, exhaustStack, lowerSaved, lowerSaved3, merge, mergeAt, mergeHi, mergeLo, minRun, nextRun, pushRunLen, reset, runBase, runEnd, runLen, setRunEnd, sort, upperSaved, upperSaved3
binarySort, binarySort, checkRange, comparePivot, heapChild, heapify, heapParent, heapSort, lower, lower2, mergeInPlace, reverse, rotate, setPivot, siftDown, upper, upper2
private final java.util.Comparator<? super T> comparator
private final T[] arr
private final T[] tmp
public ArrayTimSorter(T[] arr, java.util.Comparator<? super T> comparator, int maxTempSlots)
ArrayTimSorter
.protected int compare(int i, int j)
Sorter
i
and j
.
The contract for the returned value is the same as
Comparator.compare(Object, Object)
.protected void swap(int i, int j)
Sorter
i
and j
.protected void copy(int src, int dest)
TimSorter
src
to slot dest
.protected void save(int start, int len)
TimSorter
i
and i+len
into the temporary storage.protected void restore(int src, int dest)
TimSorter
j
from the temporary storage into slot i
.protected int compareSaved(int i, int j)
TimSorter
i
from the temporary storage with element
j
from the slice to sort, similarly to
Sorter.compare(int, int)
.compareSaved
in class TimSorter