Class TokenUtils


  • public class TokenUtils
    extends Object
    Utilities for working with token values.
    • Method Detail

      • getTypes

        public static ScalarTokenType[] getTypes​(ScalarValued[] values)
        Extracts the types of an array of scalar token values.
        Parameters:
        values - the scalar token values whose types should be extracted
        Returns:
        an array of the token types, in the same order as the input values
      • selectFields

        public static ScalarValued[] selectFields​(RecordValued value,
                                                  String[] fieldNames)
        Extracts the given list of field values from a record value.
        Parameters:
        value - the record to decompose
        fieldNames - the fields to extract
        Returns:
        the values of the the named fields, in the order they were specified.
      • selectFields

        public static ScalarSettable[] selectFields​(RecordSettable value,
                                                    String[] fieldNames)
        Extracts the given list of field setters from a writeable record buffer.
        Parameters:
        value - the record to decompose
        fieldNames - the fields to extract
        Returns:
        the setters of the the named fields, in the order they were specified.
      • castFields

        public static <T extends ScalarValued> T[] castFields​(RecordValued value,
                                                              Class<T> clazz,
                                                              String[] fieldNames)
        Extracts the given list of field names, casting them to the specified type.
        Type Parameters:
        T - the type to which we are casting
        Parameters:
        value - The record from which we are extracting fields
        clazz - The type to which we are casting
        fieldNames - The list of field names to extract
        Returns:
        A list of fields in the order specified by fieldNames
      • castFields

        public static <T extends ScalarSettable> T[] castFields​(RecordSettable value,
                                                                Class<T> clazz,
                                                                String[] fieldNames)
        Extracts the given list of field names, casting them to the specified type.
        Type Parameters:
        T - the type to which we are casting
        Parameters:
        value - The record from which we are extracting fields
        clazz - The type to which we are casting
        fieldNames - The list of field names to extract
        Returns:
        A list of fields in the order specified by fieldNames
      • castFields

        public static <T extends ScalarSettable> T[] castFields​(ScalarSettable[] fields,
                                                                Class<T> clazz,
                                                                Integer[] fieldIndices)
        Extracts the given list of field indices, casting them to the specified type.
        Type Parameters:
        T - the type to which we are casting
        Parameters:
        fields - The array of fields
        clazz - The type to which we are casting
        fieldIndices - The list of field indices to extract
        Returns:
        A list of fields in the order specified by fieldNames
      • castFields

        public static <T extends ScalarValued> T[] castFields​(ScalarValued[] fields,
                                                              Class<T> clazz)
        Casts an array of fields to the specified type
        Type Parameters:
        T - the type to which we are casting
        Parameters:
        fields - the array of fields
        clazz - the type to cast the fields to
        Returns:
        The list of fields, casted to the specified type
      • castFields

        public static <T extends ScalarSettable> T[] castFields​(ScalarSettable[] fields,
                                                                Class<T> clazz)
        Casts an array of fields to the specified type
        Type Parameters:
        T - the type to which we are casting
        Parameters:
        fields - the array of fields
        clazz - the type to cast the fields to
        Returns:
        The list of fields, casted to the specified type
      • asToken

        public static DataToken asToken​(TokenValued value)
        Creates an immutable copy of the given token value.

        If a large number of values are to be converted, it is usually more efficient to use a TokenConverter instead of repeatedly calling this method.

        Parameters:
        value - the value to copy
        Returns:
        a token containing the same value as the input
      • convert

        public static BigDecimal convert​(double d)
        Converts a double value to a BigDecimal.
        Parameters:
        d - the value to convert
        Returns:
        a BigDecimal with the given value.
      • convert

        public static BigDecimal convert​(long l)
        Converts a long value to a BigDecimal.
        Parameters:
        l - the value to convert
        Returns:
        a BigDecimal with the given value.
      • forceDouble

        public static double forceDouble​(NumericValued value)
        Converts a numeric value to a double value, truncating if necessary. Precision will be lost if the source is wider than a double.
        Parameters:
        value - the source number value
        Returns:
        the number value as a double.
      • forceFloat

        public static float forceFloat​(NumericValued value)
        Converts a numeric value to a float value, truncating if necessary. Precision will be lost if the source is wider than a float.
        Parameters:
        value - the source number value
        Returns:
        the value as a float.
      • forceLong

        public static long forceLong​(NumericValued value)
        Converts a numeric value to a long value, truncating if necessary. Precision will be lost if the source is wider than a long.
        Parameters:
        value - the source number value
        Returns:
        the value as a long.
      • forceInt

        public static int forceInt​(NumericValued value)
        Converts a numeric value to an integer value, truncating if necessary. Precision will be lost if the source is wider than an int.
        Parameters:
        value - the source number value
        Returns:
        the value as an int.
      • hashCode

        public static int hashCode​(BinaryValued value)
        Computes a hash code for a binary value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(BooleanValued value)
        Computes a hash code for a boolean value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(CharValued value)
        Computes a hash code for a char value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(DurationValued value)
        Computes a hash code for a duration value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(DateValued value)
        Computes a hash code for a date value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(DoubleValued value)
        Computes a hash code for a double value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(FloatValued value)
        Computes a hash code for a float value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(IntValued value)
        Computes a hash code for an integer value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(Ip4AddressValued value)
        Computes a hash code for a ip4address value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(Ip6AddressValued value)
        Computes a hash code for a ip6address value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(LongValued value)
        Computes a hash code for a long value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(MoneyValued value)
        Computes a hash code for a money value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(NumericValued value)
        Computes a hash code for a numeric value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(ObjectValued<?> value)
        Computes a hash code for an object value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(PeriodValued value)
        Computes a hash code for a period value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(StringValued value)
        Computes a hash code for a string value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(TimeValued value)
        Computes a hash code for a time value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • hashCode

        public static int hashCode​(TimestampValued value)
        Computes a hash code for a string value.
        Parameters:
        value - the value to hash
        Returns:
        the hash code for the value
      • asString

        public static String asString​(TokenValued value)
        Formats a token value as a string suitable for output.

        If a large number of values are to be formatted, it is usually more efficient to use a TokenConverter instead of repeatedly calling this method.

        Parameters:
        value - the value to format
        Returns:
        a string value. A null value is represented as the empty string.
      • asString

        public static String asString​(BinaryValued value)
        Formats a binary value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a hexadecimal string encoding the value. A null value is represented as the empty string.
      • asString

        public static String asString​(BooleanValued value)
        Formats a boolean value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(CharValued value)
        Formats a character value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(DurationValued value)
        Formats a duration value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(DateValued value)
        Formats a date value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        an ISO 8601 formatted date string. A null value is represented as the empty string.
      • asString

        public static String asString​(DoubleValued value)
        Formats a double value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(FloatValued value)
        Formats a float value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(IntValued value)
        Formats an integer value as a string suitable for output.
        Parameters:
        value - i value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(Ip4AddressValued value)
        Formats an ipv4 value as a string suitable for output.
        Parameters:
        value - i value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(Ip6AddressValued value)
        Formats an ipv6 value as a string suitable for output.
        Parameters:
        value - i value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(LongValued value)
        Formats a long value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(MoneyValued value)
        Formats a money value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(NumericValued value)
        Formats a numeric value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(ObjectValued<?> value)
        Formats an object value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. The exact representation will depend on the implementation of toString() on the object. A null value is represented as the empty string.
      • asString

        public static String asString​(PeriodValued value)
        Formats a period value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string representing the value. A null value is represented as the empty string.
      • asString

        public static String asString​(StringValued value)
        Formats a string value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        a string value. A null value is represented as the empty string.
      • asString

        public static String asString​(TimeValued value)
        Formats a time value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        an ISO 8601 time of day string with zone offset. A null value is represented as the empty string.
      • asString

        public static String asString​(TimestampValued value)
        Formats a timestamp value as a string suitable for output.
        Parameters:
        value - the value to format
        Returns:
        an ISO 8601 timestamp string. A null value is represented as the empty string.
      • equal

        public static boolean equal​(BinaryValued value1,
                                    BinaryValued value2)
        Indicates whether two binary values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(BooleanValued value1,
                                    BooleanValued value2)
        Indicates whether two boolean values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(CharValued value1,
                                    CharValued value2)
        Indicates whether two character values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(DurationValued value1,
                                    DurationValued value2)
        Indicates whether two duration values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(DateValued value1,
                                    DateValued value2)
        Indicates whether two date values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(DoubleValued value1,
                                    DoubleValued value2)
        Indicates whether two double values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(FloatValued value1,
                                    FloatValued value2)
        Indicates whether two float values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(IntValued value1,
                                    IntValued value2)
        Indicates whether two integer values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(Ip4AddressValued value1,
                                    Ip4AddressValued value2)
        Indicates whether two ip4address values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(Ip6AddressValued value1,
                                    Ip6AddressValued value2)
        Indicates whether two ip6address values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(LongValued value1,
                                    LongValued value2)
        Indicates whether two long values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(MoneyValued value1,
                                    MoneyValued value2)
        Indicates whether two money values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(NumericValued value1,
                                    NumericValued value2)
        Indicates whether two numeric values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static <O> boolean equal​(ObjectValued<O> value1,
                                        ObjectValued<O> value2)
        Indicates whether two object values are equal. Nulls are considered unequal in this context.
        Type Parameters:
        O - the type of the objects
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal (as determined by their equals() method), false otherwise
      • equal

        public static boolean equal​(PeriodValued value1,
                                    PeriodValued value2)
        Indicates whether two period values are equal. The values are not normalized before comparison. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(StringValued value1,
                                    StringValued value2)
        Indicates whether two string values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(TimeValued value1,
                                    TimeValued value2)
        Indicates whether two time values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • equal

        public static boolean equal​(TimestampValued value1,
                                    TimestampValued value2)
        Indicates whether two timestamp values are equal. Nulls are considered unequal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        true if the two values are equal, false otherwise
      • compare

        public static int compare​(BinaryValued value1,
                                  BinaryValued value2)
        Indicates the relative ordering of two binary values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(BinaryValued value1,
                                  byte[] value2)
        Indicates the relative ordering of a binary value and a non-null binary data array in ascending order.
        Parameters:
        value1 - the first value
        value2 - the second non-null value, as an array of binary data
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(BooleanValued value1,
                                  BooleanValued value2)
        Indicates the relative ordering of two boolean values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(CharValued value1,
                                  CharValued value2)
        Indicates the relative ordering of two character values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(DurationValued value1,
                                  DurationValued value2)
        Indicates the relative ordering of two duration values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(DateValued value1,
                                  DateValued value2)
        Indicates the relative ordering of two date values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(DoubleValued value1,
                                  DoubleValued value2)
        Indicates the relative ordering of two double values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(FloatValued value1,
                                  FloatValued value2)
        Indicates the relative ordering of two float values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(IntValued value1,
                                  IntValued value2)
        Indicates the relative ordering of two integer values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(Ip4AddressValued value1,
                                  Ip4AddressValued value2)
        Indicates the relative ordering of two ip4address values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(Ip6AddressValued value1,
                                  Ip6AddressValued value2)
        Indicates the relative ordering of two ip4address values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(LongValued value1,
                                  LongValued value2)
        Indicates the relative ordering of two long values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(MoneyValued value1,
                                  MoneyValued value2)
        Indicates the relative ordering of two money values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(NumericValued value1,
                                  long value2)
        Indicates the relative ordering of a number value and a non-null long in ascending order. If necessary, the narrower of the two values will be widened.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(NumericValued value1,
                                  double value2)
        Indicates the relative ordering of a number value and a non-null double in ascending order. If necessary, the narrower of the two values will be widened.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(NumericValued value1,
                                  BigDecimal value2)
        Indicates the relative ordering of a number value and a non-null java.math.BigDecimal in ascending order. If necessary, the narrower of the two values will be widened.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(NumericValued value1,
                                  NumericValued value2)
        Indicates the relative ordering of two numeric values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static <O extends Comparable<O>> int compare​(ObjectValued<O> value1,
                                                            ObjectValued<O> value2)
        Indicates the relative ordering of two object values in ascending order. Nulls are considered equal in this context. The ordering is that defined by the object's compareTo(Object,Object) method; thus this is restricted to Java objects implementing Comparable.
        Type Parameters:
        O - the type of Java objects. This must be a comparable type.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(PeriodValued value1,
                                  PeriodValued value2)
        Indicates the relative ordering of two period values in ascending order. The values will be normalized before comparison. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compareNormalizedPeriod

        public static int compareNormalizedPeriod​(Period p1,
                                                  Period p2)
        Indicates the relative ordering of two periods in ascending order. The period values are normalized before comparison.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(StringValued value1,
                                  StringValued value2)
        Indicates the relative ordering of two string values in ascending order. Nulls are considered equal in this context. Strings are ordered based on the Unicode code points of their characters.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compareByCodepoint

        public static int compareByCodepoint​(String value1,
                                             String value2)
        Indicates the relative ordering of two string values by code point in ascending order. Unlike String.compareTo(String), this method produces an ordering consistent with Unicode code points. This ordering differs only for characters above Character.MAX_SURROGATE which have code points before those represented by any surrogate pair.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(TimeValued value1,
                                  TimeValued value2)
        Indicates the relative ordering of two time values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(TimestampValued value1,
                                  TimestampValued value2)
        Indicates the relative ordering of two timestamp values in ascending order. Nulls are considered equal in this context.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • compare

        public static int compare​(ScalarValued value1,
                                  ScalarValued value2)
        Indicates the relative ordering of two scalar values in ascending order. Nulls are considered equal in this context. The two values must be of comparable types.

        If a large number of comparisons are to be done, it is more efficient to use a TokenComparator instead of repeatedly calling this method.

        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        a negative integer, zero, or a positive integer if the first argument is respectively less than, equal to, or greater than the second.
      • getNull

        public static TokenValued getNull​(TokenType type)
        Returns an appropriate null value for the given type.
        Parameters:
        type - The token type.
        Returns:
        an appropriate null value for the given type.
      • transfer

        public static void transfer​(TokenValued[] sources,
                                    TokenSettable[] dest)
        Transfers the given array of sources to the array of destinations by-position.
        Parameters:
        sources - The sources.
        dest - The desrinations. Must be the same length as sources
      • getZero

        public static DataToken getZero​(TokenType type)
        Returns an appropriate zero value for the given type.
        Parameters:
        type - The token type.
        Returns:
        an appropriate null value for the given type.
      • parse

        public static ScalarToken parse​(ScalarTokenType type,
                                        String value)
        Parses the given string as a value of the specified type. If the value is available in a primitive form (that is, as an int or other datatype), it is more efficient to directly create a token instead of converting it to a string and parsing it.
        Parameters:
        type - the expected type of the value's string representation
        value - the string representation of a token value
        Returns:
        a token with the represented value