Class AbstractExpressionEvaluator

  • All Implemented Interfaces:
    ExpressionEvaluator
    Direct Known Subclasses:
    InMemoryExpressionEvaluator

    public class AbstractExpressionEvaluator
    extends java.lang.Object
    implements ExpressionEvaluator
    Abstract evaluator for an expression. Provides a stack-like process, working its way through the expression tree. Provides methods processXXX that should be implemented by the subclass where it supports the particular operator or expression.
    • Constructor Detail

      • AbstractExpressionEvaluator

        public AbstractExpressionEvaluator()
    • Method Detail

      • evaluate

        public java.lang.Object evaluate​(Expression expr)
        Method to "evaluate" the expression.
        Specified by:
        evaluate in interface ExpressionEvaluator
        Parameters:
        expr - The expression
        Returns:
        The evaluated expression
      • compileOrAndExpression

        protected java.lang.Object compileOrAndExpression​(Expression expr)
        This method deals with the OR/AND conditions. A condition specifies a combination of one or more expressions and logical (Boolean) operators and returns a value of TRUE, FALSE, or unknown
        Parameters:
        expr - The other expression to or/and with
        Returns:
        The updated expression
      • compileRelationalExpression

        protected java.lang.Object compileRelationalExpression​(Expression expr)
        Method to handle a relational expression comparing two expressions and returning a BooleanExpression.
        Parameters:
        expr - The (relational) expression
        Returns:
        The processed expression
      • compileAdditiveMultiplicativeExpression

        protected java.lang.Object compileAdditiveMultiplicativeExpression​(Expression expr)
      • compileUnaryExpression

        protected java.lang.Object compileUnaryExpression​(Expression expr)
      • compilePrimaryExpression

        protected java.lang.Object compilePrimaryExpression​(Expression expr)
      • processOrExpression

        protected java.lang.Object processOrExpression​(Expression expr)
        Method to process the supplied OR expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processAndExpression

        protected java.lang.Object processAndExpression​(Expression expr)
        Method to process the supplied AND expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processBitOrExpression

        protected java.lang.Object processBitOrExpression​(Expression expr)
        Method to process the supplied BITWISE OR expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processBitAndExpression

        protected java.lang.Object processBitAndExpression​(Expression expr)
        Method to process the supplied BITWISE AND expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processBitXorExpression

        protected java.lang.Object processBitXorExpression​(Expression expr)
        Method to process the supplied BITWISE XOR expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processEqExpression

        protected java.lang.Object processEqExpression​(Expression expr)
        Method to process the supplied EQ expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processNoteqExpression

        protected java.lang.Object processNoteqExpression​(Expression expr)
        Method to process the supplied NOTEQ expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processLikeExpression

        protected java.lang.Object processLikeExpression​(Expression expr)
        Method to process the supplied LIKE expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processGtExpression

        protected java.lang.Object processGtExpression​(Expression expr)
        Method to process the supplied GT expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processLtExpression

        protected java.lang.Object processLtExpression​(Expression expr)
        Method to process the supplied LT expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processGteqExpression

        protected java.lang.Object processGteqExpression​(Expression expr)
        Method to process the supplied GTEQ expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processLteqExpression

        protected java.lang.Object processLteqExpression​(Expression expr)
        Method to process the supplied LTEQ expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processIsExpression

        protected java.lang.Object processIsExpression​(Expression expr)
        Method to process the supplied IS (instanceof) expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processIsnotExpression

        protected java.lang.Object processIsnotExpression​(Expression expr)
        Method to process the supplied ISNOT (!instanceof) expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processInExpression

        protected java.lang.Object processInExpression​(Expression expr)
        Method to process the supplied IN expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processNotInExpression

        protected java.lang.Object processNotInExpression​(Expression expr)
        Method to process the supplied NOT IN expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processAddExpression

        protected java.lang.Object processAddExpression​(Expression expr)
        Method to process the supplied ADD expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processSubExpression

        protected java.lang.Object processSubExpression​(Expression expr)
        Method to process the supplied SUB expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processMulExpression

        protected java.lang.Object processMulExpression​(Expression expr)
        Method to process the supplied MUL expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processDivExpression

        protected java.lang.Object processDivExpression​(Expression expr)
        Method to process the supplied DIV expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processModExpression

        protected java.lang.Object processModExpression​(Expression expr)
        Method to process the supplied MOD expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processNegExpression

        protected java.lang.Object processNegExpression​(Expression expr)
        Method to process the supplied NEG expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processComExpression

        protected java.lang.Object processComExpression​(Expression expr)
        Method to process the supplied COM expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processNotExpression

        protected java.lang.Object processNotExpression​(Expression expr)
        Method to process the supplied NOT expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processDistinctExpression

        protected java.lang.Object processDistinctExpression​(Expression expr)
        Method to process the supplied DISTINCT expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processCreatorExpression

        protected java.lang.Object processCreatorExpression​(CreatorExpression expr)
        Method to process the supplied creator expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processPrimaryExpression

        protected java.lang.Object processPrimaryExpression​(PrimaryExpression expr)
        Method to process the supplied primary expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processParameterExpression

        protected java.lang.Object processParameterExpression​(ParameterExpression expr)
        Method to process the supplied parameter expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processVariableExpression

        protected java.lang.Object processVariableExpression​(VariableExpression expr)
        Method to process the supplied variable expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processSubqueryExpression

        protected java.lang.Object processSubqueryExpression​(SubqueryExpression expr)
        Method to process the supplied subquery expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processInvokeExpression

        protected java.lang.Object processInvokeExpression​(InvokeExpression expr)
        Method to process the supplied invoke expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processCastExpression

        protected java.lang.Object processCastExpression​(Expression expr)
        Method to process the supplied cast expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processCaseExpression

        protected java.lang.Object processCaseExpression​(CaseExpression expr)
        Method to process the supplied case expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result
      • processLiteral

        protected java.lang.Object processLiteral​(Literal expr)
        Method to process the supplied invoke expression. To be implemented by subclasses.
        Parameters:
        expr - The expression
        Returns:
        The result