- java.lang.Object
-
- java.lang.Enum<TokenSorter>
-
- com.pervasive.datarush.tokens.TokenSorter
-
- All Implemented Interfaces:
Serializable
,Comparable<TokenSorter>
public enum TokenSorter extends Enum<TokenSorter>
An object capable of producing a sort order permutation of aTokenSequence
. 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:
TokenOrder
-
-
Enum Constant Summary
Enum Constants Enum Constant Description HEAP_SORT
A sorter using the heap sort algorithm.MERGE_SORT
A sorter using the merge sort algorithm.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
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 TokenSorter
valueOf(String name)
Returns the enum constant of this type with the specified name.static TokenSorter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HEAP_SORT
public static final TokenSorter 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
public static final TokenSorter MERGE_SORT
A sorter using the merge sort algorithm. Merge sort requires additional memory, but is a stable sort.
-
-
Method Detail
-
values
public static TokenSorter[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TokenSorter c : TokenSorter.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TokenSorter valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
sort
public int[] sort(TokenSequence data)
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
public int[] sort(TokenSequence data, TokenOrder sortOrder)
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
public int[] sort(RecordTokenSequence data, TokenOrder[] sortOrder)
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
public int[] sort(RecordTokenSequence data, SortKey... sortKeys)
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
public int[] sort(int rowCount, ElementComparator comparator)
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.
-
-