org.datanucleus.query.expression
Class Expression

java.lang.Object
  extended by org.datanucleus.query.expression.Expression
Direct Known Subclasses:
ArrayExpression, CastExpression, ClassExpression, CreatorExpression, DyadicExpression, InvokeExpression, JoinExpression, Literal, OrderExpression, ParameterExpression, PrimaryExpression, SubqueryExpression, VariableExpression

public abstract class Expression
extends java.lang.Object

A Scalar expression in a Query. Used to compute values with a resulting type.


Nested Class Summary
static class Expression.DyadicOperator
          "Dyadic" operator performs operation on one or two operands.
static class Expression.MonadicOperator
          "Monadic" operator performs a function on one operand.
static class Expression.Operator
          Representation of an Operator.
 
Field Summary
protected  java.lang.String alias
           
protected  Expression left
           
protected static Localiser LOCALISER
          Localiser for messages
protected  Expression.Operator op
           
static Expression.DyadicOperator OP_ADD
          ADD
static Expression.DyadicOperator OP_AND
          AND
static Expression.MonadicOperator OP_COM
          COM
static Expression.DyadicOperator OP_CONCAT
          CONCAT
static Expression.MonadicOperator OP_DISTINCT
          DISTINCT
static Expression.DyadicOperator OP_DIV
          DIV
static Expression.DyadicOperator OP_EQ
          EQ
static Expression.DyadicOperator OP_GT
          GT
static Expression.DyadicOperator OP_GTEQ
          GTEQ
static Expression.DyadicOperator OP_IN
          IN
static Expression.DyadicOperator OP_IS
          IS
static Expression.DyadicOperator OP_ISNOT
          ISNOT
static Expression.DyadicOperator OP_LIKE
          LIKE
static Expression.DyadicOperator OP_LT
          LT
static Expression.DyadicOperator OP_LTEQ
          LTEQ
static Expression.DyadicOperator OP_MOD
          MOD
static Expression.DyadicOperator OP_MUL
          MUL
static Expression.MonadicOperator OP_NEG
          NEG
static Expression.MonadicOperator OP_NOT
          NOT
static Expression.DyadicOperator OP_NOTEQ
          NOTEQ
static Expression.DyadicOperator OP_OR
          OR
static Expression.DyadicOperator OP_SUB
          SUB
protected  Expression right
           
protected  Symbol symbol
           
 
Constructor Summary
protected Expression()
          Constructor.
protected Expression(Expression.MonadicOperator op, Expression operand)
          Perform a function op on operand
protected Expression(Expression operand1, Expression.DyadicOperator op, Expression operand2)
          Performs a function on two arguments.
 
Method Summary
abstract  Symbol bind(SymbolTable symtbl)
          Method to bind the expression to the symbol table as appropriate.
 java.lang.Object evaluate(ExpressionEvaluator eval)
          Method to evaluate this expression, using the passed evaluator.
 java.lang.String getAlias()
           
 Expression getLeft()
          Accessor for the left hand expression.
 Expression.Operator getOperator()
          The operator to be performed by this expression.
 Expression getRight()
          Accessor for the right hand expression.
 Symbol getSymbol()
          Accessor for the symbol for this expression (if set).
 void setAlias(java.lang.String alias)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages


op

protected Expression.Operator op

left

protected Expression left

right

protected Expression right

symbol

protected Symbol symbol

alias

protected java.lang.String alias

OP_OR

public static final Expression.DyadicOperator OP_OR
OR


OP_AND

public static final Expression.DyadicOperator OP_AND
AND


OP_NOT

public static final Expression.MonadicOperator OP_NOT
NOT


OP_EQ

public static final Expression.DyadicOperator OP_EQ
EQ


OP_NOTEQ

public static final Expression.DyadicOperator OP_NOTEQ
NOTEQ


OP_LT

public static final Expression.DyadicOperator OP_LT
LT


OP_LTEQ

public static final Expression.DyadicOperator OP_LTEQ
LTEQ


OP_GT

public static final Expression.DyadicOperator OP_GT
GT


OP_GTEQ

public static final Expression.DyadicOperator OP_GTEQ
GTEQ


OP_LIKE

public static final Expression.DyadicOperator OP_LIKE
LIKE


OP_IS

public static final Expression.DyadicOperator OP_IS
IS


OP_ISNOT

public static final Expression.DyadicOperator OP_ISNOT
ISNOT


OP_IN

public static final Expression.DyadicOperator OP_IN
IN


OP_ADD

public static final Expression.DyadicOperator OP_ADD
ADD


OP_SUB

public static final Expression.DyadicOperator OP_SUB
SUB


OP_CONCAT

public static final Expression.DyadicOperator OP_CONCAT
CONCAT


OP_MUL

public static final Expression.DyadicOperator OP_MUL
MUL


OP_DIV

public static final Expression.DyadicOperator OP_DIV
DIV


OP_MOD

public static final Expression.DyadicOperator OP_MOD
MOD


OP_NEG

public static final Expression.MonadicOperator OP_NEG
NEG


OP_COM

public static final Expression.MonadicOperator OP_COM
COM


OP_DISTINCT

public static final Expression.MonadicOperator OP_DISTINCT
DISTINCT

Constructor Detail

Expression

protected Expression()
Constructor.


Expression

protected Expression(Expression.MonadicOperator op,
                     Expression operand)
Perform a function op on operand

Parameters:
op - operator
operand - operand

Expression

protected Expression(Expression operand1,
                     Expression.DyadicOperator op,
                     Expression operand2)
Performs a function on two arguments. op(operand1,operand2) operand1 op operand2

Parameters:
operand1 - the first expression
op - the operator between operands
operand2 - the second expression
Method Detail

getOperator

public Expression.Operator getOperator()
The operator to be performed by this expression. See the OP_{name} final static properties of this class.

Returns:
Operator

getLeft

public Expression getLeft()
Accessor for the left hand expression.

Returns:
Left expression

getRight

public Expression getRight()
Accessor for the right hand expression.

Returns:
Right expression

getSymbol

public Symbol getSymbol()
Accessor for the symbol for this expression (if set).

Returns:
The symbol

setAlias

public void setAlias(java.lang.String alias)

getAlias

public java.lang.String getAlias()

evaluate

public java.lang.Object evaluate(ExpressionEvaluator eval)
Method to evaluate this expression, using the passed evaluator.

Parameters:
eval - Evaluator
Returns:
The result

bind

public abstract Symbol bind(SymbolTable symtbl)
Method to bind the expression to the symbol table as appropriate.

Parameters:
symtbl - Symbol table
Returns:
The symbol for this expression


Copyright © 2010. All Rights Reserved.