Package com.plotsquared.core.util
Class PlotExpression
java.lang.Object
com.plotsquared.core.util.PlotExpression
An expression that can be evaluated.
Evaluation is thread-safe.
This is a wrapper for
Expression.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull PlotExpressionCompiles an expression from a string.doubleevaluate(double... values)Evaluates the expression with the given variable values.
-
Method Details
-
compile
public static @NonNull PlotExpression compile(@NonNull String expression, @NonNull String @NonNull ... variableNames)Compiles an expression from a string.- Parameters:
expression- the expression to compile.variableNames- the variables that can be set inevaluate(double...).- Returns:
- the compiled expression.
-
evaluate
public double evaluate(double... values)Evaluates the expression with the given variable values.- Parameters:
values- the values to set the variables to.- Returns:
- the result of the evaluation.
-