Enum Class TokenSorter

java.lang.Object
java.lang.Enum<TokenSorter>
com.pervasive.datarush.tokens.TokenSorter
All Implemented Interfaces:
Serializable, Comparable<TokenSorter>, java.lang.constant.Constable

public enum TokenSorter extends Enum<TokenSorter>
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:
  • Enum Constant Details

    • 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 Details

    • values

      public static TokenSorter[] 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

      public static TokenSorter valueOf(String name)
      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 name
      NullPointerException - 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 sort
      sortOrder - 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 sort
      sortOrder - 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 sort
      sortKeys - 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 sorted
      comparator - A comparator that determines the ordering
      Returns:
      an array of sequence indexes which puts the elements in sorted order.