Maths
Class CompiledFunction.Function
java.lang.Object
Maths.CompiledFunction.Function
- All Implemented Interfaces:
- CompiledFunction
- Enclosing interface:
- CompiledFunction
public static class CompiledFunction.Function
- extends java.lang.Object
- implements CompiledFunction
Represents an arbitary function defined in a FunctionParser
Method Summary |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompiledFunction.Function
public CompiledFunction.Function(FunctionParser p,
java.lang.String name,
CompiledFunction[] inputs)
throws WrongNumberOfVariables,
NoSuchFunction
- Default constructor
- Parameters:
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 function
- Throws:
WrongNumberOfVariables
- If the number of inputs past is not the number expected
NoSuchFunction
- Thrown if values does not contain a needed variable
compute
public double compute(java.util.Map<java.lang.String,java.lang.Double> values)
throws NoSuchVariable
- Description copied from interface:
CompiledFunction
- Computes the result of the function
- Specified by:
compute
in interface CompiledFunction
- Parameters:
values
- Map from variable name to value
- Returns:
- The value of the function
- Throws:
NoSuchVariable
- Thrown if values does not contain a needed variable
neededParams
public java.util.Set<java.lang.String> neededParams()
- Description copied from interface:
CompiledFunction
- Returns a list of variable that the function expects to be passed to it
- Specified by:
neededParams
in interface CompiledFunction
- Returns:
- The list of variable names tyhat need to be passed