| Constructor and Description |
|---|
UnaryFunction() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract BigDecimal |
eval(BigDecimal a,
MathContext mathContext)
Performs the computation of the unary function
|
BigDecimal |
eval(List<Expression> args,
MathContext mathContext)
Executes the function with the given arguments.
|
int |
getNumberOfArguments()
Returns the number of expected arguments.
|
boolean |
isNaturalFunction()
A natural function returns the same output for the same input.
|
public int getNumberOfArguments()
FunctionIf the function is called with a different number of arguments, an error will be created
In order to support functions with a variable number of arguments, a negative number can be returned. This will essentially disable the check.
getNumberOfArguments in interface Functionpublic BigDecimal eval(List<Expression> args, MathContext mathContext)
FunctionThe arguments need to be evaluated first. This is not done externally to permit functions to perform lazy evaluations.
protected abstract BigDecimal eval(BigDecimal a, MathContext mathContext)
a - the argument of the functionmathContext - the math contextpublic boolean isNaturalFunction()
FunctionAll classical mathematical functions are "natural". A function which reads user input is not natural, as the function might return different results depending on the users input
isNaturalFunction in interface FunctionCopyright © 2019. All rights reserved.