Package me.yleoft.zAPI.util
Class MathExpressionEvaluator
java.lang.Object
me.yleoft.zAPI.util.MathExpressionEvaluator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsMathOperators(@NotNull String expression) Returns true if the expression contains arithmetic operators or math functions.static doublestatic @NotNull StringevaluateMathIfNeeded(@NotNull String expression) Evaluates a string as a math expression if it contains operators, otherwise returns it as-is (as a string).static doubleevaluateNumeric(@NotNull String expression) Evaluates a string as a number, using the math evaluator if it contains operators.
-
Constructor Details
-
MathExpressionEvaluator
public MathExpressionEvaluator()
-
-
Method Details
-
evaluate
- Throws:
IllegalArgumentException
-
evaluateNumeric
Evaluates a string as a number, using the math evaluator if it contains operators. Returns 0.0 if the string cannot be parsed. -
evaluateMathIfNeeded
Evaluates a string as a math expression if it contains operators, otherwise returns it as-is (as a string). Used for equality comparisons. -
containsMathOperators
Returns true if the expression contains arithmetic operators or math functions.
-