Class TokenComparators

java.lang.Object
com.pervasive.datarush.tokens.TokenComparators

public class TokenComparators extends Object
A factory for creating TokenComparator objects.
  • Method Details

    • getComparator

      public static TokenComparator getComparator(TokenType type)
      Creates a comparator appropriate for the given type. If the the given type is a record type, all fields are evaluated in the comparison.
      Parameters:
      type - the token type for which to create a comparator
      Returns:
      a new comparator object
    • getComparator

      public static TokenComparator getComparator(TokenValued left, TokenValued right)
      Creates a comparator, bound to the given left and right values. The two values must be of comparable types; the resulting comparator will be of the narrowest possible type for the comparison. If the given values are of record type, all fields are evaluated in the comparison.
      Parameters:
      left - the value to bind to the left operand in comparisons
      right - the value to bind to the right operand in comparisons
      Returns:
      a new comparator bound to the given values
    • getComparator

      public static TokenComparator getComparator(TokenType type, TokenOrder order)
      Creates a comparator appropriate for the given type ordered in the specified direction. If the the given type is a record type, all fields are evaluated in the comparison.
      Parameters:
      type - the token type for which to create a comparator
      order - the direction of the ordering
      Returns:
      a new comparator object
    • getCompositeComparator

      public static RecordTokenComparator getCompositeComparator(ScalarTokenType[] types, TokenOrder order)
      Creates a composite comparator appropriate for the given types ordered in the specified direction.
      Parameters:
      types - the token types of individual fields. The comparator will expect values in the same order as the argument.
      order - the direction of the ordering. All fields will be compared under this ordering.
      Returns:
      a new comparator object
    • getCompositeComparator

      public static RecordTokenComparator getCompositeComparator(ScalarValued[] left, ScalarValued[] right, TokenOrder order)
      Creates a composite comparator, bound to the given sets of left and right values, using the specified ordering for all pairings of values. The two values in each pair must be of comparable types; the resulting comparator will be of the narrowest possible type for the comparison.
      Parameters:
      left - the set of values to bind to the fields of the left operand in comparisons
      right - the set of values to bind to the fields of the right operand in comparisons
      order - the ordering for all fields
      Returns:
      a new comparator bound to the given values
    • getCompositeComparator

      public static RecordTokenComparator getCompositeComparator(ScalarTokenType[] types, TokenOrder[] order)
      Creates a composite comparator appropriate for the given types ordered in the specified direction for each field.
      Parameters:
      types - the token types of individual fields. The comparator will expect values in the same order as the argument.
      order - the direction of the orderings for each field.
      Returns:
      a new comparator object
    • getCompositeComparator

      public static RecordTokenComparator getCompositeComparator(ScalarValued[] left, ScalarValued[] right, TokenOrder[] order)
      Creates a composite comparator, bound to the given sets of left and right values, using the specified orderings for each pairing of values. The two values in each pair must be of comparable types; the resulting comparator will be of the narrowest possible type for the comparison.
      Parameters:
      left - the set of values to bind to the fields of the left operand in comparisons
      right - the set of values to bind to the fields of the right operand in comparisons
      order - the set of orderings for each field
      Returns:
      a new comparator bound to the given values