- All Implemented Interfaces:
Serializable,Comparable<TokenSorter>,java.lang.constant.Constable
An object capable of producing a sort order permutation of a
TokenSequence. The sequence is not modified
by the sorter.
These objects are thread-safe; the same TokenSorter
can be used simultaneously by multiple threads.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA sorter using the heap sort algorithm.A sorter using the merge sort algorithm. -
Method Summary
Modifier and TypeMethodDescriptionint[]sort(int rowCount, ElementComparator comparator) Performs a sort based on an element comparator.int[]sort(RecordTokenSequence data, SortKey... sortKeys) Builds a sort order permutation for the specified composite sequence using the given sort keys.int[]sort(RecordTokenSequence data, TokenOrder[] sortOrder) Builds a sort order permutation for the specified composite sequence using the specified order for each column.int[]sort(TokenSequence data) Builds a sort order permutation for the specified sequence, assuming a default of ascending order.int[]sort(TokenSequence data, TokenOrder sortOrder) Builds a sort order permutation for the specified sequence in the specified order.static TokenSorterReturns the enum constant of this class with the specified name.static TokenSorter[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HEAP_SORT
A sorter using the heap sort algorithm. Heap sort is in-place, reducing memory usage, but is not a stable sort. -
MERGE_SORT
A sorter using the merge sort algorithm. Merge sort requires additional memory, but is a stable sort.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
sort
Builds a sort order permutation for the specified sequence, assuming a default of ascending order.- Parameters:
data- the sequence to sort- Returns:
- an array of sequence indexes which puts the sequence in sorted order.
-
sort
Builds a sort order permutation for the specified sequence in the specified order. If the sequence is a composite, the order will be used for all columns of the composite.- Parameters:
data- the sequence to sortsortOrder- the ordering to use- Returns:
- an array of sequence indexes which puts the sequence in sorted order.
-
sort
Builds a sort order permutation for the specified composite sequence using the specified order for each column.- Parameters:
data- the composite sequence to sortsortOrder- the ordering to use. This must provide as many orderings as there are columns in the sequence.- Returns:
- an array of sequence indexes which puts the sequence in sorted order.
-
sort
Builds a sort order permutation for the specified composite sequence using the given sort keys.- Parameters:
data- the composite sequence to sortsortKeys- definition of the sort keys to use- Returns:
- an array of sequence indexes which puts the sequence in sorted order.
-
sort
Performs a sort based on an element comparator.- Parameters:
rowCount- The number of rows to be sortedcomparator- A comparator that determines the ordering- Returns:
- an array of sequence indexes which puts the elements in sorted order.
-