Package org.qdl_lang.variables.values
Class QDLKey
- java.lang.Object
-
- org.qdl_lang.variables.values.QDLValue
-
- org.qdl_lang.variables.values.QDLKey
-
- All Implemented Interfaces:
Serializable
,Comparable<QDLValue>
,Constants
- Direct Known Subclasses:
LongValue
,StemValue
,StringValue
public class QDLKey extends QDLValue
A marker class for thoseQDLValue
s that may also function as keys to stems and lists.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.qdl_lang.variables.values.QDLValue
axisValue, booleanValue, decimalValue, dyadicFunctionValue, functionValue, longValue, moduleValue, nullValue, setValue, stemValue, stringValue
-
Fields inherited from interface org.qdl_lang.variables.Constants
ALL_INDICES_NAME, ALL_INDICES_TYPE, ARG_COUNT_TYPE, AXIS_RESTRICTION_NAME, AXIS_RESTRICTION_TYPE, BOOLEAN_NAME, BOOLEAN_TYPE, DECIMAL_NAME, DECIMAL_TYPE, DYADIC_FUNCTION_NAME, DYADIC_FUNCTION_TYPE, FUNCTION_NAME, FUNCTION_TYPE, INTEGER_TYPE, LIST_NAME, LIST_TYPE, LONG_NAME, LONG_TYPE, MODULE_NAME, MODULE_TYPE, NULL_NAME, NULL_TYPE, SET_NAME, SET_TYPE, STEM_NAME, STEM_TYPE, STRING_NAME, STRING_TYPE, UNKNOWN_NAME, UNKNOWN_TYPE
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static LongValue
decimalToLong(BigDecimal decimal)
Decimals may be used as keys if they have a trivial fractional part.static QDLKey
from(Object value)
This will convert the POJO to a key.static Collection<QDLKey>
from(Collection<Object> values)
Converts a collection -- a list or set -- of objects to keys.-
Methods inherited from class org.qdl_lang.variables.values.QDLValue
asAxisExpression, asBoolean, asDecimal, asDyadicFunction, asFunction, asJavaValue, asLong, asModule, asNull, asQDLValue, asSet, asStem, asString, castToJavaValues, castToJavaValues, castToQDLValueList, castToQDLValues, castToQDLValues, castToQDLValues, castToQDLValues, compareTo, equals, getInputForm, getNullValue, getType, getValue, hashCode, hasValue, isAllIndices, isAxisRestriction, isBoolean, isDecimal, isDyadicFunction, isFunction, isList, isListOrStem, isLong, isModule, isNull, isScalar, isSet, isStem, isString, setValue, toString
-
-
-
-
Constructor Detail
-
QDLKey
public QDLKey(Object value)
-
-
Method Detail
-
from
public static QDLKey from(Object value)
This will convert the POJO to a key. It does try to return the correct actual type so feeding in a string like "2" will result in aLongValue
of 2. By the same token, decimal values are checked to see if they are actually integers- Parameters:
value
-- Returns:
-
decimalToLong
protected static LongValue decimalToLong(BigDecimal decimal)
Decimals may be used as keys if they have a trivial fractional part. Since an expression likea := 6.0/3.0;
would reliably yield the value 2.0, This should be usable as a stem index as the integer 2.- Parameters:
decimal
-- Returns:
-
from
public static Collection<QDLKey> from(Collection<Object> values)
Converts a collection -- a list or set -- of objects to keys. Note that non-key values will cause an error.- Parameters:
values
-- Returns:
-
-