org.datanucleus.query.evaluator
Class AbstractExpressionEvaluator

java.lang.Object
  extended by org.datanucleus.query.evaluator.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 Summary
AbstractExpressionEvaluator()
           
 
Method Summary
protected  java.lang.Object compileAdditiveMultiplicativeExpression(Expression expr)
           
protected  java.lang.Object compileOrAndExpression(Expression expr)
          This method deals with the OR/AND conditions.
protected  java.lang.Object compilePrimaryExpression(Expression expr)
           
protected  java.lang.Object compileRelationalExpression(Expression expr)
          Method to handle a relational expression comparing two expressions and returning a BooleanExpression.
protected  java.lang.Object compileUnaryExpression(Expression expr)
           
 java.lang.Object evaluate(Expression expr)
          Method to "evaluate" the expression.
protected  java.lang.Object processAddExpression(Expression expr)
          Method to process the supplied ADD expression.
protected  java.lang.Object processAndExpression(Expression expr)
          Method to process the supplied AND expression.
protected  java.lang.Object processCastExpression(CastExpression expr)
          Method to process the supplied cast expression.
protected  java.lang.Object processComExpression(Expression expr)
          Method to process the supplied COM expression.
protected  java.lang.Object processCreatorExpression(CreatorExpression expr)
          Method to process the supplied creator expression.
protected  java.lang.Object processDistinctExpression(Expression expr)
          Method to process the supplied DISTINCT expression.
protected  java.lang.Object processDivExpression(Expression expr)
          Method to process the supplied DIV expression.
protected  java.lang.Object processEqExpression(Expression expr)
          Method to process the supplied EQ expression.
protected  java.lang.Object processGteqExpression(Expression expr)
          Method to process the supplied GTEQ expression.
protected  java.lang.Object processGtExpression(Expression expr)
          Method to process the supplied GT expression.
protected  java.lang.Object processInExpression(Expression expr)
          Method to process the supplied IN expression.
protected  java.lang.Object processInvokeExpression(InvokeExpression expr)
          Method to process the supplied invoke expression.
protected  java.lang.Object processIsExpression(Expression expr)
          Method to process the supplied IS (instanceof) expression.
protected  java.lang.Object processIsnotExpression(Expression expr)
          Method to process the supplied ISNOT (!instanceof) expression.
protected  java.lang.Object processLikeExpression(Expression expr)
          Method to process the supplied LIKE expression.
protected  java.lang.Object processLiteral(Literal expr)
          Method to process the supplied invoke expression.
protected  java.lang.Object processLteqExpression(Expression expr)
          Method to process the supplied LTEQ expression.
protected  java.lang.Object processLtExpression(Expression expr)
          Method to process the supplied LT expression.
protected  java.lang.Object processModExpression(Expression expr)
          Method to process the supplied MOD expression.
protected  java.lang.Object processMulExpression(Expression expr)
          Method to process the supplied MUL expression.
protected  java.lang.Object processNegExpression(Expression expr)
          Method to process the supplied NEG expression.
protected  java.lang.Object processNoteqExpression(Expression expr)
          Method to process the supplied NOTEQ expression.
protected  java.lang.Object processNotExpression(Expression expr)
          Method to process the supplied NOT expression.
protected  java.lang.Object processOrExpression(Expression expr)
          Method to process the supplied OR expression.
protected  java.lang.Object processParameterExpression(ParameterExpression expr)
          Method to process the supplied parameter expression.
protected  java.lang.Object processPrimaryExpression(PrimaryExpression expr)
          Method to process the supplied primary expression.
protected  java.lang.Object processSubExpression(Expression expr)
          Method to process the supplied SUB expression.
protected  java.lang.Object processSubqueryExpression(SubqueryExpression expr)
          Method to process the supplied subquery expression.
protected  java.lang.Object processVariableExpression(VariableExpression expr)
          Method to process the supplied variable expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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


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

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

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(CastExpression expr)
Method to process the supplied cast 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


Copyright © 2010. All Rights Reserved.