|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.Sorter org.apache.lucene.util.IntroSorter
public abstract class IntroSorter
Sorter
implementation based on a variant of the quicksort algorithm
called introsort: when
the recursion level exceeds the log of the length of the array to sort, it
falls back to heapsort. This prevents quicksort from running into its
worst-case quadratic runtime. Small arrays are sorted with
insertion sort.
Constructor Summary | |
---|---|
IntroSorter()
Create a new IntroSorter . |
Method Summary | |
---|---|
protected abstract int |
comparePivot(int j)
Compare the pivot with the slot at j , similarly to
compare(i, j) . |
protected abstract void |
setPivot(int i)
Save the value at slot i so that it can later be used as a
pivot, see comparePivot(int) . |
void |
sort(int from,
int to)
Sort the slice which starts at from (inclusive) and ends at
to (exclusive). |
Methods inherited from class org.apache.lucene.util.Sorter |
---|
compare, swap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IntroSorter()
IntroSorter
.
Method Detail |
---|
public final void sort(int from, int to)
Sorter
from
(inclusive) and ends at
to
(exclusive).
sort
in class Sorter
protected abstract void setPivot(int i)
i
so that it can later be used as a
pivot, see comparePivot(int)
.
protected abstract int comparePivot(int j)
j
, similarly to
compare(i, j)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |