Package com.igormaznitsa.jcp.expression
Class Expression
java.lang.Object
com.igormaznitsa.jcp.expression.Expression
The main class to calculate expressions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PreprocessorContext
The variable contains the preprocessor context for the expression, it can be nullprivate final ExpressionTree
The variable contains the expression treeprivate static final Class<?>[]
Precreated array for speed up operationsprivate static final Class<?>[]
Precreated array for speed up operations -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Expression
(PreprocessorContext context, ExpressionTree tree) -
Method Summary
Modifier and TypeMethodDescriptionprivate ExpressionTreeElement
calculateTreeElement
(ExpressionTreeElement element, PreprocessingState state) private Value
eval
(PreprocessingState state) static Value
evalExpression
(String expression, PreprocessorContext context) Evaluate expressionprivate ExpressionTreeElement
evalFunction
(ExpressionTreeElement functionElement, PreprocessingState state) private ExpressionTreeElement
evalOperator
(ExpressionTreeElement operatorElement, PreprocessingState state) static Value
evalTree
(ExpressionTree tree, PreprocessorContext context) Evaluate an expression tree
-
Field Details
-
OPERATOR_SIGNATURE_1
Precreated array for speed up operations -
OPERATOR_SIGNATURE_2
Precreated array for speed up operations -
context
The variable contains the preprocessor context for the expression, it can be null -
expressionTree
The variable contains the expression tree
-
-
Constructor Details
-
Expression
-
-
Method Details
-
evalExpression
Evaluate expression- Parameters:
expression
- the expression as a String, must not be nullcontext
- a preprocessor context to be used for expression operations- Returns:
- the result as a Value object, it can't be null
-
evalTree
Evaluate an expression tree- Parameters:
tree
- an expression tree, it must not be nullcontext
- a preprocessor context to be used for expression operations- Returns:
- the result as a Value object, it can't be null
-
evalFunction
private ExpressionTreeElement evalFunction(ExpressionTreeElement functionElement, PreprocessingState state) -
evalOperator
private ExpressionTreeElement evalOperator(ExpressionTreeElement operatorElement, PreprocessingState state) -
calculateTreeElement
private ExpressionTreeElement calculateTreeElement(ExpressionTreeElement element, PreprocessingState state) -
eval
-