public class Expression
extends java.lang.Object
Supported operators:
Supported functions: abs, acos, asin, atan, atan2, cbrt, ceil, cos, cosh, exp, floor, ln, log, log10, max, max, min, min, rint, round, sin, sinh, sqrt, tan, tanh and more. (See the Functions class or the wiki)
Constants: e, pi
To compile an equation, run
Expression.compile("expression here", "var1", "var2"...)
.
If you wish to run the equation multiple times, you can then optimize it,
by calling optimize()
. You can then run the equation as many times
as you want by calling evaluate(double...)
. You do not need to
pass values for all slots specified while compiling.
To query slots after evaluation, you can use the slot table.
Modifier and Type | Method and Description |
---|---|
static Expression |
compile(java.lang.String expression,
java.lang.String... variableNames) |
double |
evaluate(double... values) |
double |
evaluate(double[] values,
int timeout) |
ExpressionEnvironment |
getEnvironment() |
SlotTable |
getSlots() |
java.lang.String |
getSource() |
void |
optimize() |
void |
setEnvironment(ExpressionEnvironment environment) |
java.lang.String |
toString() |
public static Expression compile(java.lang.String expression, java.lang.String... variableNames) throws ExpressionException
ExpressionException
public double evaluate(double... values) throws EvaluationException
EvaluationException
public double evaluate(double[] values, int timeout) throws EvaluationException
EvaluationException
public void optimize()
public java.lang.String getSource()
public java.lang.String toString()
toString
in class java.lang.Object
public SlotTable getSlots()
public ExpressionEnvironment getEnvironment()
public void setEnvironment(ExpressionEnvironment environment)