Class NullWrappedNary
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryFunction
com.singularsys.jep.misc.nullwrapper.functions.NullWrappedNary
- All Implemented Interfaces:
NullWrappedFunctionI
,PostfixMathCommandI
,Serializable
Wrap an NaryFunction with a new function so that if any argument is null, then null is returned.
- Since:
- 3.4
- Author:
- Richard Morris
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkNumberOfParameters
(int n) Checks the number of parameters of the function.Evaluate the functionint
Return the required number of parameters.getRoot()
Get to function which this function wraps.void
setCurNumberOfParameters
(int n) Sets the number of current number of parameters used in the next call of run().void
Sets the name of the function used for error messagesMethods inherited from class com.singularsys.jep.functions.NaryFunction
run
-
Constructor Details
-
NullWrappedNary
- Parameters:
fun
-
-
-
Method Details
-
getRoot
Description copied from interface:NullWrappedFunctionI
Get to function which this function wraps.- Specified by:
getRoot
in interfaceNullWrappedFunctionI
- Returns:
- the root function, may be "this".
-
eval
Description copied from class:NaryFunction
Evaluate the function- Specified by:
eval
in classNaryFunction
- Parameters:
args
- arguments to the function- Returns:
- value returned by the function
- Throws:
EvaluationException
- if the calculation cannot be performed
-
setName
Description copied from interface:PostfixMathCommandI
Sets the name of the function used for error messages- Specified by:
setName
in interfacePostfixMathCommandI
- Overrides:
setName
in classPostfixMathCommand
- Parameters:
name
- the function name
-
checkNumberOfParameters
public boolean checkNumberOfParameters(int n) Description copied from class:PostfixMathCommand
Checks the number of parameters of the function. Functions which set numberOfParameter=-1 should overload this method- Specified by:
checkNumberOfParameters
in interfacePostfixMathCommandI
- Overrides:
checkNumberOfParameters
in classPostfixMathCommand
- Parameters:
n
- number of parameters function will be called with.- Returns:
- false if an illegal number of parameters is supplied, true otherwise.
-
getNumberOfParameters
public int getNumberOfParameters()Description copied from class:PostfixMathCommand
Return the required number of parameters.- Specified by:
getNumberOfParameters
in interfacePostfixMathCommandI
- Overrides:
getNumberOfParameters
in classPostfixMathCommand
- Returns:
- allowable number of parameters, -1 if a variable number is allowed
-
setCurNumberOfParameters
public void setCurNumberOfParameters(int n) Description copied from class:PostfixMathCommand
Sets the number of current number of parameters used in the next call of run(). This method is only called when the reqNumberOfParameters is -1.- Specified by:
setCurNumberOfParameters
in interfacePostfixMathCommandI
- Overrides:
setCurNumberOfParameters
in classPostfixMathCommand
- Parameters:
n
- number of parameter for next call of function
-