Class MathExpression.ExpressionSolver
java.lang.Object
com.github.gbenroscience.parser.MathExpression.ExpressionSolver
- Enclosing class:
MathExpression
Optimized and simplified refactor of the attached expression-processing code.
Notes:
- This class focuses on performance and clarity: fewer repeated parses,
fewer temporary strings, single-pass operator handlers where possible,
and centralized "garbage" cleanup.
- It preserves the original semantics (special "Infinity" handling, post/pre
operators, power, permutation/combination, mul/div/remainder, comparisons,
and final packaging) while removing repeated try/catch blocks and
duplicated code.
Assumptions:
- Helper predicates and functions such as isNumber(...), isFactorial(...),
isSquare(...), isCube(...), isInverse(...), isHasPostNumberOperators(),
isHasPowerOperators(), isHasPreNumberOperators(), isHasPermOrCombOperators(),
isHasMulOrDivOperators(), isHasRemainderOperators(), isHasLogicOperators(),
isHasPlusOrMinusOperators(), Maths.fact(String) exist in the surrounding
codebase. They are referenced here as-is to keep the refactor focused on
algorithmic improvements.
- Operator constants are defined here for clarity; adjust to match your
existing constants if different.
- Author:
- GBENRO
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ExpressionSolver
public ExpressionSolver()
-
-
Method Details
-
solve
-
isNumber
-