Enum Types.ValueType

    • Method Detail

      • values

        public static Types.ValueType[] 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 (Types.ValueType c : Types.ValueType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Types.ValueType 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 name
        NullPointerException - if the argument is null
      • isNumeric

        public boolean isNumeric()
        Get if the ValueType is a numeric value.
        Returns:
        If it is numeric.
      • isUnknown

        public boolean isUnknown()
        Helper method to detect Unknown ValueTypes.
        Returns:
        If the valuetype is Unknown
      • isPseudoNumeric

        public boolean isPseudoNumeric()
        If the value is pseudoNumeric, meaning that we can translate it to a number
        Returns:
        If the number is indirectly numeric
      • toExternalString

        public String toExternalString()
        Convert the internal Enum to an externalizable String, the string indicate how the toString version of a value type acts.
        Returns:
        A capitalized string of the ValueType.
      • fromExternalString

        public static Types.ValueType fromExternalString​(String value)
        Parse an external string representation to the internal Enum ValueTypes supported.
        Parameters:
        value - The String to parse
        Returns:
        The internal Enum of the given string
        Throws:
        DMLRuntimeException - In case the given string is unsupported or invalid.
      • isSameTypeString

        public static boolean isSameTypeString​(Types.ValueType vt1,
                                               Types.ValueType vt2)
        Given two ValueTypes, would they both print and eternalize similarly.
        Parameters:
        vt1 - The first ValueType to compare
        vt2 - The second ValueType to compare
        Returns:
        If they behave similarly.
      • getHighestCommonTypeSafe

        public static Types.ValueType getHighestCommonTypeSafe​(Types.ValueType a,
                                                               Types.ValueType b)
        Get the highest common type, where if one inout is UNKNOWN return the other.

        For instance:

        Character and String returns String

        INT32 and String returns String

        INT32 and FP32 returns FP32

        INT32 and INT64 returns INT64

        Parameters:
        a - First value type to analyze
        b - Second Value type to analyze
        Returns:
        The highest common value
      • getHighestCommonType

        public static Types.ValueType getHighestCommonType​(Types.ValueType a,
                                                           Types.ValueType b)
        Get the highest common type that both ValueTypes can be contained in.

        For instance:

        Character and String returns String

        INT32 and String returns String

        INT32 and FP32 returns FP32

        INT32 and INT64 returns INT64

        Parameters:
        a - First ValueType
        b - Second ValueType
        Returns:
        The common highest type to represent both
        Throws:
        DMLRuntimeException - If any input is UNKNOWN.