Package org.apache.sysds.common
Enum Types.ValueType
- java.lang.Object
-
- java.lang.Enum<Types.ValueType>
-
- org.apache.sysds.common.Types.ValueType
-
- All Implemented Interfaces:
Serializable
,Comparable<Types.ValueType>
- Enclosing interface:
- Types
public static enum Types.ValueType extends Enum<Types.ValueType>
Value types (int, double, string, boolean, unknown).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Types.ValueType
fromExternalString(String value)
Parse an external string representation to the internal Enum ValueTypes supported.static Types.ValueType
getHighestCommonType(Types.ValueType a, Types.ValueType b)
Get the highest common type that both ValueTypes can be contained in.static Types.ValueType
getHighestCommonTypeSafe(Types.ValueType a, Types.ValueType b)
Get the highest common type, where if one inout is UNKNOWN return the other.boolean
isNumeric()
Get if the ValueType is a numeric value.boolean
isPseudoNumeric()
If the value is pseudoNumeric, meaning that we can translate it to a numberstatic boolean
isSameTypeString(Types.ValueType vt1, Types.ValueType vt2)
Given two ValueTypes, would they both print and eternalize similarly.boolean
isUnknown()
Helper method to detect Unknown ValueTypes.String
toExternalString()
Convert the internal Enum to an externalizable String, the string indicate how the toString version of a value type acts.static Types.ValueType
valueOf(String name)
Returns the enum constant of this type with the specified name.static Types.ValueType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UINT4
public static final Types.ValueType UINT4
-
UINT8
public static final Types.ValueType UINT8
-
FP32
public static final Types.ValueType FP32
-
FP64
public static final Types.ValueType FP64
-
INT32
public static final Types.ValueType INT32
-
INT64
public static final Types.ValueType INT64
-
BOOLEAN
public static final Types.ValueType BOOLEAN
-
STRING
public static final Types.ValueType STRING
-
UNKNOWN
public static final Types.ValueType UNKNOWN
-
HASH64
public static final Types.ValueType HASH64
-
HASH32
public static final Types.ValueType HASH32
-
CHARACTER
public static final Types.ValueType CHARACTER
-
-
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 nameNullPointerException
- 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 comparevt2
- 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 analyzeb
- 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 ValueTypeb
- Second ValueType- Returns:
- The common highest type to represent both
- Throws:
DMLRuntimeException
- If any input is UNKNOWN.
-
-