Enum Class Types.ValueType

java.lang.Object
java.lang.Enum<Types.ValueType>
org.apache.sysds.common.Types.ValueType
All Implemented Interfaces:
Serializable, Comparable<Types.ValueType>, Constable
Enclosing interface:
Types

public static enum Types.ValueType extends Enum<Types.ValueType>
Value types (int, double, string, boolean, unknown).
  • Enum Constant Details

  • Method Details

    • values

      public static Types.ValueType[] 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 Types.ValueType 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
    • isNumeric

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

      public boolean isFP()
    • 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.