Package org.apache.sysds.common
Enum Class Types.ValueType
- All Implemented Interfaces:
Serializable,Comparable<Types.ValueType>,Constable
- Enclosing interface:
- Types
Value types (int, double, string, boolean, unknown).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic Types.ValueTypefromExternalString(String value) Parse an external string representation to the internal Enum ValueTypes supported.static Types.ValueTypeGet the highest common type that both ValueTypes can be contained in.static Types.ValueTypeGet the highest common type, where if one inout is UNKNOWN return the other.booleanisFP()booleanGet if the ValueType is a numeric value.booleanIf the value is pseudoNumeric, meaning that we can translate it to a numberstatic booleanisSameTypeString(Types.ValueType vt1, Types.ValueType vt2) Given two ValueTypes, would they both print and eternalize similarly.booleanHelper method to detect Unknown ValueTypes.Convert the internal Enum to an externalizable String, the string indicate how the toString version of a value type acts.static Types.ValueTypeReturns the enum constant of this class with the specified name.static Types.ValueType[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
UINT4
-
UINT8
-
FP32
-
FP64
-
INT32
-
INT64
-
BOOLEAN
-
STRING
-
UNKNOWN
-
HASH64
-
HASH32
-
CHARACTER
-
-
Method Details
-
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
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 nameNullPointerException- 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
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
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
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
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
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.
-