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 |
INSERTION_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 IntroSorter.comparePivot(int). |
protected void |
swap(int i,
int j)
Swap values at slots
i and j. |
quicksort, sortbinarySort, binarySort, checkRange, doRotate, heapChild, heapify, heapParent, heapSort, insertionSort, lower, lower2, mergeInPlace, reverse, rotate, siftDown, upper, upper2private 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)
Sorteri and j.
The contract for the returned value is the same as
Comparator.compare(Object, Object).protected void swap(int i,
int j)
Sorteri and j.protected void setPivot(int i)
IntroSorteri so that it can later be used as a
pivot, see IntroSorter.comparePivot(int).setPivot in class IntroSorterprotected int comparePivot(int i)
IntroSorterj, similarly to
compare(i, j).comparePivot in class IntroSorter