public class MathsParse
extends java.lang.Object
FunctionParser to the constructor.| Constructor and Description |
|---|
MathsParse(FunctionParser... fps)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
CompiledFunction |
compileFunction(java.lang.String equation)
Parses an equation and returns a compiled function that can then be used
to compute the value fo an equation.
|
double |
parseEquation(java.lang.String equation,
java.util.Map<java.lang.String,java.lang.Double> values)
Parses an equation and returns the result
|
public MathsParse(FunctionParser... fps)
fps - A variable number of parsers that define additional functions.
If none is passed then only the default functions are avaliable.public double parseEquation(java.lang.String equation,
java.util.Map<java.lang.String,java.lang.Double> values)
throws NoSuchFunction,
WrongNumberOfVariables,
NoSuchVariable
equation - The equation to parsevalues - Map from a string to a double that represents the value of
any variables in the equationNoSuchFunction - If the equation uses an undefined functionWrongNumberOfVariables - If the equation uses a function and passes
it the wrong number of variablesNoSuchVariable - Thrown if values does not contain a needed variablepublic CompiledFunction compileFunction(java.lang.String equation) throws NoSuchFunction, WrongNumberOfVariables
equation - The equation to parseNoSuchFunction - If the equation uses an undefined functionWrongNumberOfVariables - If the equation uses a function and passes
it the wrong number of variables