public abstract class NaryBinaryFunction extends PostfixMathCommand
Object eval(Object l,Object r)
method for calculating the result.
The operation must be associative.curNumberOfParameters, name, NaN, numberOfParameters
Constructor and Description |
---|
NaryBinaryFunction() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkNumberOfParameters(int n)
Checks the number of parameters of the function.
|
java.lang.Object |
eval(java.lang.Object[] args)
Evaluate given an array of arguments
|
abstract java.lang.Object |
eval(java.lang.Object l,
java.lang.Object r) |
void |
run(java.util.Stack<java.lang.Object> stack)
Calls
eval(Object, Object) |
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
public boolean checkNumberOfParameters(int n)
PostfixMathCommand
checkNumberOfParameters
in interface PostfixMathCommandI
checkNumberOfParameters
in class PostfixMathCommand
n
- number of parameters function will be called with.public final void run(java.util.Stack<java.lang.Object> stack) throws EvaluationException
eval(Object, Object)
run
in interface PostfixMathCommandI
run
in class PostfixMathCommand
stack
- arguments for functionEvaluationException
- if function cannot be evaluatedpublic final java.lang.Object eval(java.lang.Object[] args) throws EvaluationException
args
- array of arguments to function, must have at least one elementEvaluationException
- if empty arraypublic abstract java.lang.Object eval(java.lang.Object l, java.lang.Object r) throws EvaluationException
EvaluationException
Copyright © 2018 Singular Systems http://www.singularsys.com/jep