Class Put
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryFunction
com.singularsys.jep.misc.dictionary.Put
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
Puts a key-value pair into a map.
The function either returns the previous value
associated with the key or the nullValue.
map = {'x':2, 'y':3};
put(map, 'x', 4);
put(map, 'z', 5);
- Since:
- Jep 4.1
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckNumberOfParameters(int n) Checks the number of parameters of the function.protected booleanTest if key equals k.Evaluate the functionprotected Objectprotected ObjectMethods inherited from class com.singularsys.jep.functions.NaryFunction
runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Field Details
-
nullValue
-
type
-
-
Constructor Details
-
Put
-
-
Method Details
-
checkNumberOfParameters
public boolean checkNumberOfParameters(int n) Description copied from class:PostfixMathCommandChecks the number of parameters of the function. Functions which set numberOfParameter=-1 should overload this method- Specified by:
checkNumberOfParametersin interfacePostfixMathCommandI- Overrides:
checkNumberOfParametersin classPostfixMathCommand- Parameters:
n- number of parameters function will be called with.- Returns:
- false if an illegal number of parameters is supplied, true otherwise.
-
eval
Description copied from class:NaryFunctionEvaluate the function- Specified by:
evalin classNaryFunction- Parameters:
args- arguments to the function- Returns:
- value returned by the function
- Throws:
EvaluationException- if the calculation cannot be performed
-
eval
-
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
-