final class ArrayIntroSorter<T> extends IntroSorter
IntroSorter
for object arrays.Modifier and Type | Field and Description |
---|---|
private T[] |
arr |
private java.util.Comparator<? super T> |
comparator |
private T |
pivot |
BINARY_SORT_THRESHOLD
Constructor and Description |
---|
ArrayIntroSorter(T[] arr,
java.util.Comparator<? super T> comparator)
Create a new
ArrayInPlaceMergeSorter . |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(int i,
int j)
Compare entries found in slots
i and j . |
protected int |
comparePivot(int i)
Compare the pivot with the slot at
j , similarly to
compare(i, j) . |
protected void |
setPivot(int i)
Save the value at slot
i so that it can later be used as a
pivot, see Sorter.comparePivot(int) . |
protected void |
swap(int i,
int j)
Swap values at slots
i and j . |
quicksort, sort
binarySort, binarySort, checkRange, doRotate, heapChild, heapify, heapParent, heapSort, lower, lower2, mergeInPlace, reverse, rotate, siftDown, upper, upper2
private final T[] arr
private final java.util.Comparator<? super T> comparator
private T pivot
public ArrayIntroSorter(T[] arr, java.util.Comparator<? super T> comparator)
ArrayInPlaceMergeSorter
.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)
.compare
in class IntroSorter
protected void swap(int i, int j)
Sorter
i
and j
.protected void setPivot(int i)
Sorter
i
so that it can later be used as a
pivot, see Sorter.comparePivot(int)
.setPivot
in class IntroSorter
protected int comparePivot(int i)
Sorter
j
, similarly to
compare(i, j)
.comparePivot
in class IntroSorter