public final class FormulaInterpreter
extends java.lang.Object
Constructor and Description |
---|
FormulaInterpreter()
Creates a new instance of FormulaInterpreter
|
Modifier and Type | Method and Description |
---|---|
void |
compile(java.lang.String formula)
compile the specified formula
|
double |
evaluate()
evaluate the compiled formula
|
double |
evaluate(java.lang.String formula)
Compile and evaluate the specified formula.
|
boolean |
hasVariable(java.lang.String name)
Determine if a variable of the specified name exists and has been assigned a value.
|
void |
setVariable(java.lang.String name,
double value)
Set the named variable to the specified value.
|
public FormulaInterpreter()
public final void setVariable(java.lang.String name, double value)
name
- name of the variablevalue
- value assigned to the variablepublic final boolean hasVariable(java.lang.String name)
name
- The name of the variable for which to check.public void compile(java.lang.String formula)
public double evaluate(java.lang.String formula)
public double evaluate()