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, sortbinarySort, binarySort, checkRange, doRotate, heapChild, heapify, heapParent, heapSort, 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).compare in class IntroSorterprotected void swap(int i,
int j)
Sorteri and j.protected void setPivot(int i)
Sorteri so that it can later be used as a
pivot, see Sorter.comparePivot(int).setPivot in class IntroSorterprotected int comparePivot(int i)
Sorterj, similarly to
compare(i, j).comparePivot in class IntroSorter