Package org.apache.lucene.util
Class Sorter
- java.lang.Object
-
- org.apache.lucene.util.Sorter
-
- Direct Known Subclasses:
InPlaceMergeSorter,IntroSorter,MSBRadixSorter,TimSorter
public abstract class Sorter extends Object
Base class for sorting algorithms implementations.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSorter()Sole constructor, used for inheritance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract intcompare(int i, int j)Compare entries found in slotsiandj.protected intcomparePivot(int j)Compare the pivot with the slot atj, similarly tocompare(i, j).protected voidsetPivot(int i)Save the value at slotiso that it can later be used as a pivot, seecomparePivot(int).abstract voidsort(int from, int to)Sort the slice which starts atfrom(inclusive) and ends atto(exclusive).protected abstract voidswap(int i, int j)Swap values at slotsiandj.
-
-
-
Method Detail
-
compare
protected abstract int compare(int i, int j)Compare entries found in slotsiandj. The contract for the returned value is the same asComparator.compare(Object, Object).
-
swap
protected abstract void swap(int i, int j)Swap values at slotsiandj.
-
setPivot
protected void setPivot(int i)
Save the value at slotiso that it can later be used as a pivot, seecomparePivot(int).
-
comparePivot
protected int comparePivot(int j)
Compare the pivot with the slot atj, similarly tocompare(i, j).
-
sort
public abstract void sort(int from, int to)Sort the slice which starts atfrom(inclusive) and ends atto(exclusive).
-
-