public class Expression extends Object
Expression.compile("expression here", "var1", "var2"...)
If you wish to run the equation multiple times, you can then optimize it, by calling myExpression.optimize();
You can then run the equation as many times as you want by calling myExpression.evaluate(var1, var2...)
You do not need to pass values for all variables specified while compiling.
To query variables after evaluation, you can use myExpression.getVariable("variable name").
To get a value out of these, use myVariable.getValue()
Variables are also supported and can be set either by passing values to evaluate| Modifier and Type | Method and Description |
|---|---|
static Expression |
compile(String expression,
String... variableNames) |
double |
evaluate(double... values) |
ExpressionEnvironment |
getEnvironment() |
Functions |
getFunctions() |
static Expression |
getInstance() |
RValue |
getVariable(String name,
boolean create) |
void |
optimize() |
void |
setEnvironment(ExpressionEnvironment environment) |
String |
toString() |
public static Expression compile(String expression, String... variableNames) throws ExpressionException
ExpressionExceptionpublic double evaluate(double... values)
throws EvaluationException
EvaluationExceptionpublic void optimize()
throws EvaluationException
EvaluationExceptionpublic static Expression getInstance()
public Functions getFunctions()
public ExpressionEnvironment getEnvironment()
public void setEnvironment(ExpressionEnvironment environment)
Copyright © 2010-2014. All Rights Reserved.