Class Get
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.BinaryFunction
com.singularsys.jep.misc.dictionary.Get
- All Implemented Interfaces:
ZeroLengthBehaviourI,ZeroLengthBehaviourI.DefaultZeroLengthBehaviourI,PostfixMathCommandI,Serializable
Gets the value associated with a key.
The function returns the value associated with the key.
If no key is found then the behaviour is controlled
according to
map = {'x':2, 'y':3};
get(map, 'x');
ZeroLengthBehaviourI.
If no value is associate with the key then nullValue is returned.
is returned.- Since:
- Jep 4.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.functions.BinaryFunction
BinaryFunction.BiFunctionWithException<T>Nested classes/interfaces inherited from interface com.singularsys.jep.functions.ZeroLengthBehaviourI
ZeroLengthBehaviourI.DefaultZeroLengthBehaviourI, ZeroLengthBehaviourI.ZeroLengthErrorBehaviour, ZeroLengthBehaviourI.ZeroLengthHelper -
Field Summary
FieldsFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanTest if key equals k.Evaluate the functionprotected Objectprotected ObjectgetErrorMessage(String name) Gets the zero length error message.Gets the helper class which implements the zero length behaviour.Methods inherited from class com.singularsys.jep.functions.BinaryFunction
instanceOf, instanceOf, instanceOf, instanceOf, runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.singularsys.jep.functions.ZeroLengthBehaviourI
getValueOrException, zeroLengthResultOrExceptionMethods inherited from interface com.singularsys.jep.functions.ZeroLengthBehaviourI.DefaultZeroLengthBehaviourI
getZeroLengthErrorBehaviour, getZeroLengthValue, setZeroLengthErrorBehaviour, setZeroLengthValue
-
Field Details
-
nullValue
-
zeroLengthHelper
-
-
Constructor Details
-
Get
Constructor- Parameters:
nullValue- , value returned when a key has no value.
-
-
Method Details
-
eval
Description copied from class:BinaryFunctionEvaluate the function- Specified by:
evalin classBinaryFunction- Parameters:
l- lhs argumentkey- rhs argument- Returns:
- the results
- Throws:
EvaluationException- if the function cannot be evaluated.
-
eval
- Throws:
EvaluationException
-
eval
- Throws:
EvaluationException
-
equals
Test if key equals k. Default implementation useskey.equals(k)- Parameters:
key- key to testk- key to test- Returns:
- true if parameters are equal
- Throws:
EvaluationException
-
getZeroLengthHelper
Description copied from interface:ZeroLengthBehaviourI.DefaultZeroLengthBehaviourIGets the helper class which implements the zero length behaviour. The standard implementation is:ZeroLengthHelper zeroLengthHelper = new ZeroLengthHelper(); @Override public ZeroLengthBehaviourI getZeroLengthHelper() { return zeroLengthHelper; }- Specified by:
getZeroLengthHelperin interfaceZeroLengthBehaviourI.DefaultZeroLengthBehaviourI- Returns:
- the helper class
-
getErrorMessage
Description copied from interface:ZeroLengthBehaviourIGets the zero length error message. The default implementation format a string using thefunctions.AtLestOneArgumentIsRequiredproperty.- Specified by:
getErrorMessagein interfaceZeroLengthBehaviourI- Parameters:
name- name of the function passed intoZeroLengthBehaviourI.zeroLengthResultOrException(String)- Returns:
- the error message.
-