ajax.expression
Class Expression

java.lang.Object
  |
  +--ajax.expression.Expression

public class Expression
extends java.lang.Object


Inner Class Summary
 class Expression.MyBoolean
          AUXILIARY CLASSES
 
Field Summary
static int T_ALGO_CALL
           
static int T_AND
           
static int T_AS_REF
           
static int T_ASTERISC
           
static int T_CHECK
           
static int T_COMPOSED
           
static int T_CONST_REF
           
static int T_CONSTANT
          CONSTANTS
static int T_DEP
           
static int T_DIV
           
static int T_EQ
           
static int T_EQEQ
           
static int T_EXCEPTION
           
static int T_FOREIGN
           
static int T_FROM
           
static int T_FUNCT_CALL
           
static int T_GE
           
static int T_GT
           
static int T_IF_STAT
           
static int T_IMPLICIT
           
static int T_LE
           
static int T_LIKE
           
static int T_LT
           
static int T_MINUS
           
static int T_MULT
           
static int T_NE
           
static int T_NOT
           
static int T_NOT_NULL
           
static int T_OR
           
static int T_ORDER
           
static int T_OUT_TRANSF
           
static int T_PLUS
           
static int T_PROJECT
           
static int T_QUERY
           
static int T_REFERENCE
           
static int T_TRANSF
           
static int T_UNIQUE
           
static int T_VAR_DECL
           
static int T_VAR_REF
           
 
Constructor Summary
Expression()
          Constructor
Expression(Expression exp)
          Constructor
Expression(java.lang.Object obj, int type, int nb_args)
          Constructor
 
Method Summary
 int argsCount()
          Returns the number of arguments
 void clone(Expression exp)
          Creates a copy of an expression
 boolean equals(java.lang.Object obj)
          Redefines the equal() method for references
 Expression getArg(int index)
          Returns the argument of an expression given its index The argument of an expression is another expression
 void getAsReferences(java.util.List list)
          Gets names of the set of As references that belongs to an expression
 java.lang.String getBeginSeparator()
          Returns a string with a start separator when the expression value is a string or a char
 Constant getConstant()
          Returns a constant for constant expressions
 java.lang.String getEndSeparator()
          Returns a string with a begin separator when the expression value is a string or a char
 java.lang.String getName()
          Returns the name of the expression depending on its type
 java.lang.String getNewForRef(java.lang.String str)
          Gets the class to instantiate for references
 void getReferences(java.util.List list)
          Gets names the references that belong to an expression
 java.lang.String getResultSetMethod()
          Converts the expression to its value stored in the _theResult Java variable
 Type getResultType()
          Gets the result type of the expression
 TransfInput getTransf()
          Returns a the transfinput object
 int getType()
          Returns the type of the expression
 java.lang.String getValues(Transformation transf)
          Returns the string to append to the VALUES clause of Java code for ProjectionTerm.
 void getVarReferences(java.util.List list)
          Gets the Variable references and the expressions they are assigned to
 java.lang.String initValue()
          Converts the expression to its value stored in the _theResult Java variable
 boolean isException()
          Checks if the expression is an Exception
 boolean isFunctionCall()
          Checks if the expression is a function call
 boolean isIfStatement()
          Checks if the expression is an IF statement
 boolean isQuery()
          Checks if the expression is a Query
 boolean isReference()
          Checks if the expression is a reference
 boolean isVarDeclaration()
          Checks if the expression is a variable declaration
 boolean isVarReference()
          Checks if the expression is a reference to a variable
 java.lang.Object object()
          Gets the object stored in the expression
 void object(java.lang.Object object)
          Sets the object equal to a given object
static int operator(java.lang.String op)
          Returns the type of the expression that corresponds to a given operator represented by a String
static java.lang.String operatorName(int op, boolean toJava)
          Returns the operator name given the type of the expression
 void setArg(int index, Expression exp)
          Sets a given argument of the expression to a given expression
 void setResultType(Type type)
          Sets the result type to a given type
 void setType(int type)
          Sets the type of the expression to a given type
 void split(Expression varExp, Expression refExp)
          Splits into two expressions: one with variable references and another with references
 void splitVarsRefs(java.util.List varList, java.util.List refList)
          Splits into two lists: one with references and another with variable references
 java.lang.String toCode(boolean let, boolean where)
           
 java.lang.String toHtmlCode(boolean let, boolean where)
           
 java.lang.String toHtmlLet()
          Converts a let expression into its html code.
 java.lang.String toJava(boolean let, boolean varDecl, boolean where, boolean merging, boolean isToTable)
          Returns a string that corresponds to the equivalent Java code
 java.lang.String toJava(boolean let, boolean varDecl, boolean where, Transformation transf)
          Called when parameters of Transformation are relevant
 java.lang.String toSQL(boolean trigger, boolean outWhere, boolean isToTable)
          Returns a string that is SQL code
 java.lang.String toSQL(boolean trigger, boolean outWhere, Transformation transf)
          Called when parameters of Transformation are relevant
 java.lang.String toString()
          Converts the expression into a human read-able object.
 java.lang.String toStringLet()
          Converts a let expression into its code.
 java.lang.String toStringWhere()
          Converts a where expression into its code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

T_CONSTANT

public static final int T_CONSTANT
CONSTANTS

T_VAR_DECL

public static final int T_VAR_DECL

T_VAR_REF

public static final int T_VAR_REF

T_AS_REF

public static final int T_AS_REF

T_REFERENCE

public static final int T_REFERENCE

T_TRANSF

public static final int T_TRANSF

T_OUT_TRANSF

public static final int T_OUT_TRANSF

T_FUNCT_CALL

public static final int T_FUNCT_CALL

T_IF_STAT

public static final int T_IF_STAT

T_QUERY

public static final int T_QUERY

T_PROJECT

public static final int T_PROJECT

T_FROM

public static final int T_FROM

T_ORDER

public static final int T_ORDER

T_EQ

public static final int T_EQ

T_EQEQ

public static final int T_EQEQ

T_GT

public static final int T_GT

T_GE

public static final int T_GE

T_LT

public static final int T_LT

T_LE

public static final int T_LE

T_LIKE

public static final int T_LIKE

T_AND

public static final int T_AND

T_OR

public static final int T_OR

T_NOT

public static final int T_NOT

T_PLUS

public static final int T_PLUS

T_MINUS

public static final int T_MINUS

T_DIV

public static final int T_DIV

T_DEP

public static final int T_DEP

T_CHECK

public static final int T_CHECK

T_UNIQUE

public static final int T_UNIQUE

T_NOT_NULL

public static final int T_NOT_NULL

T_FOREIGN

public static final int T_FOREIGN

T_ASTERISC

public static final int T_ASTERISC

T_MULT

public static final int T_MULT

T_NE

public static final int T_NE

T_EXCEPTION

public static final int T_EXCEPTION

T_IMPLICIT

public static final int T_IMPLICIT

T_COMPOSED

public static final int T_COMPOSED

T_ALGO_CALL

public static final int T_ALGO_CALL

T_CONST_REF

public static final int T_CONST_REF
Constructor Detail

Expression

public Expression()
Constructor

Expression

public Expression(java.lang.Object obj,
                  int type,
                  int nb_args)
Constructor

Expression

public Expression(Expression exp)
Constructor
Method Detail

clone

public void clone(Expression exp)
Creates a copy of an expression

operator

public static int operator(java.lang.String op)
Returns the type of the expression that corresponds to a given operator represented by a String

operatorName

public static java.lang.String operatorName(int op,
                                            boolean toJava)
Returns the operator name given the type of the expression

getArg

public Expression getArg(int index)
Returns the argument of an expression given its index The argument of an expression is another expression

setArg

public void setArg(int index,
                   Expression exp)
Sets a given argument of the expression to a given expression

argsCount

public int argsCount()
Returns the number of arguments

getType

public int getType()
Returns the type of the expression

setType

public void setType(int type)
Sets the type of the expression to a given type

getResultType

public Type getResultType()
Gets the result type of the expression

setResultType

public void setResultType(Type type)
Sets the result type to a given type

object

public java.lang.Object object()
Gets the object stored in the expression

object

public void object(java.lang.Object object)
Sets the object equal to a given object

getName

public java.lang.String getName()
Returns the name of the expression depending on its type

equals

public boolean equals(java.lang.Object obj)
Redefines the equal() method for references
Overrides:
equals in class java.lang.Object

isVarDeclaration

public boolean isVarDeclaration()
Checks if the expression is a variable declaration

isReference

public boolean isReference()
Checks if the expression is a reference

isVarReference

public boolean isVarReference()
Checks if the expression is a reference to a variable

isFunctionCall

public boolean isFunctionCall()
Checks if the expression is a function call

isIfStatement

public boolean isIfStatement()
Checks if the expression is an IF statement

isQuery

public boolean isQuery()
Checks if the expression is a Query

isException

public boolean isException()
Checks if the expression is an Exception

getConstant

public Constant getConstant()
Returns a constant for constant expressions

getTransf

public TransfInput getTransf()
Returns a the transfinput object

toSQL

public java.lang.String toSQL(boolean trigger,
                              boolean outWhere,
                              Transformation transf)
Called when parameters of Transformation are relevant

toSQL

public java.lang.String toSQL(boolean trigger,
                              boolean outWhere,
                              boolean isToTable)
Returns a string that is SQL code

toJava

public java.lang.String toJava(boolean let,
                               boolean varDecl,
                               boolean where,
                               Transformation transf)
                        throws CatalogException,
                               ExpressionException,
                               AjaxTypeException
Called when parameters of Transformation are relevant

toJava

public java.lang.String toJava(boolean let,
                               boolean varDecl,
                               boolean where,
                               boolean merging,
                               boolean isToTable)
                        throws CatalogException,
                               ExpressionException,
                               AjaxTypeException
Returns a string that corresponds to the equivalent Java code

getResultSetMethod

public java.lang.String getResultSetMethod()
Converts the expression to its value stored in the _theResult Java variable

initValue

public java.lang.String initValue()
Converts the expression to its value stored in the _theResult Java variable

getNewForRef

public java.lang.String getNewForRef(java.lang.String str)
                              throws ExpressionException
Gets the class to instantiate for references

getEndSeparator

public java.lang.String getEndSeparator()
Returns a string with a begin separator when the expression value is a string or a char

getBeginSeparator

public java.lang.String getBeginSeparator()
Returns a string with a start separator when the expression value is a string or a char

getValues

public java.lang.String getValues(Transformation transf)
                           throws CatalogException,
                                  ExpressionException,
                                  AjaxTypeException
Returns the string to append to the VALUES clause of Java code for ProjectionTerm. The string is composed by the values of the attributes projected in the Select clause

splitVarsRefs

public void splitVarsRefs(java.util.List varList,
                          java.util.List refList)
                   throws ExpressionException
Splits into two lists: one with references and another with variable references

split

public void split(Expression varExp,
                  Expression refExp)
           throws ExpressionException
Splits into two expressions: one with variable references and another with references

getReferences

public void getReferences(java.util.List list)
Gets names the references that belong to an expression

getAsReferences

public void getAsReferences(java.util.List list)
Gets names of the set of As references that belongs to an expression

getVarReferences

public void getVarReferences(java.util.List list)
Gets the Variable references and the expressions they are assigned to

toStringLet

public java.lang.String toStringLet()
Converts a let expression into its code.

toHtmlLet

public java.lang.String toHtmlLet()
Converts a let expression into its html code.

toStringWhere

public java.lang.String toStringWhere()
Converts a where expression into its code.

toCode

public java.lang.String toCode(boolean let,
                               boolean where)

toHtmlCode

public java.lang.String toHtmlCode(boolean let,
                                   boolean where)

toString

public java.lang.String toString()
Converts the expression into a human read-able object.
Overrides:
toString in class java.lang.Object