public abstract class Sorter extends Object
Modifier | Constructor and Description |
---|---|
protected |
Sorter()
Sole constructor, used for inheritance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract int |
compare(int i,
int j)
Compare entries found in slots
i and j . |
protected int |
comparePivot(int j)
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 comparePivot(int) . |
abstract void |
sort(int from,
int to)
Sort the slice which starts at
from (inclusive) and ends at
to (exclusive). |
protected abstract void |
swap(int i,
int j)
Swap values at slots
i and j . |
protected abstract int compare(int i, int j)
i
and j
.
The contract for the returned value is the same as
Comparator.compare(Object, Object)
.protected abstract void swap(int i, int j)
i
and j
.protected void setPivot(int i)
i
so that it can later be used as a
pivot, see comparePivot(int)
.protected int comparePivot(int j)
j
, similarly to
compare(i, j)
.public abstract void sort(int from, int to)
from
(inclusive) and ends at
to
(exclusive).Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.