Maths
Class CompiledFunction.Function

java.lang.Object
  extended by 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


Nested Class Summary
 
Nested classes/interfaces inherited from interface Maths.CompiledFunction
CompiledFunction.Add, CompiledFunction.Constant, CompiledFunction.Divide, CompiledFunction.Function, CompiledFunction.Multiply, CompiledFunction.Power, CompiledFunction.Subtract, CompiledFunction.Variable
 
Constructor Summary
CompiledFunction.Function(FunctionParser p, java.lang.String name, CompiledFunction[] inputs)
          Default constructor
 
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
 

Constructor Detail

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 function
name - 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
Method Detail

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