Package org.apache.lucene.util
Class Selector
java.lang.Object
org.apache.lucene.util.Selector
- Direct Known Subclasses:
IntroSelector
,RadixSelector
An implementation of a selection algorithm, ie. computing the k-th greatest value from a
collection.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
select
(int from, int to, int k) Reorder elements so that the element at positionk
is the same as if all elements were sorted and all other elements are partitioned around it:[from, k)
only contains elements that are less than or equal tok
and(k, to)
only contains elements that are greater than or equal tok
.protected abstract void
swap
(int i, int j) Swap values at slotsi
andj
.
-
Constructor Details
-
Selector
public Selector()
-
-
Method Details
-
select
public abstract void select(int from, int to, int k) Reorder elements so that the element at positionk
is the same as if all elements were sorted and all other elements are partitioned around it:[from, k)
only contains elements that are less than or equal tok
and(k, to)
only contains elements that are greater than or equal tok
. -
swap
protected abstract void swap(int i, int j) Swap values at slotsi
andj
.
-