public static class CompiledFunction.Function extends java.lang.Object implements CompiledFunction
FunctionParser
CompiledFunction.Add, CompiledFunction.Constant, CompiledFunction.Divide, CompiledFunction.Function, CompiledFunction.Multiply, CompiledFunction.Power, CompiledFunction.Subtract, CompiledFunction.Variable
Constructor and Description |
---|
CompiledFunction.Function(FunctionParser p,
java.lang.String name,
CompiledFunction[] inputs)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
double |
compute(java.util.Map<java.lang.String,java.lang.Double> values)
Computes the result of the function
|
java.util.Set<java.lang.String> |
neededParams()
Returns a list of variable that the function expects to be passed to it
|
public CompiledFunction.Function(FunctionParser p, java.lang.String name, CompiledFunction[] inputs) throws WrongNumberOfVariables, NoSuchFunction
p
- The function parser to be used to parse this functionname
- The name of the function (which is passed to the function parser)inputs
- The inputs to the functionWrongNumberOfVariables
- If the number of inputs past is not the number expectedNoSuchFunction
- Thrown if values does not contain a needed variablepublic double compute(java.util.Map<java.lang.String,java.lang.Double> values) throws NoSuchVariable
CompiledFunction
compute
in interface CompiledFunction
values
- Map from variable name to valueNoSuchVariable
- Thrown if values does not contain a needed variablepublic java.util.Set<java.lang.String> neededParams()
CompiledFunction
neededParams
in interface CompiledFunction