Expression Class Reference

Represents base class of all expressions. More...

#include <expression.h>

Inheritance diagram for Expression:

Inheritance graph
[legend]
Collaboration diagram for Expression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Expression (EXP_TYPE _type)
 Constructor.
virtual ~Expression ()
virtual void scopeCheck (vector< unsigned > &def_vars, vector< unsigned > &introduced_vars, vector< unsigned > &violating_vars)
 Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.
virtual void replaceVarId (unsigned old_id, unsigned new_id)
 Replaces all matching variable IDs by a new one.
virtual void mergeSequences ()
 Merges belonging together XQuery sequences into a single sequence.
virtual void extractFSAMap (FSAMap *fsamap, unsigned parent_var)
 Extracts the needed first straight ancestor (FSA) variables map.
virtual void extractParVarMap (ParVarMap *parvarmap)
 Extracts the needed parent variable (ParVar) map.
virtual void extractDependencies (vector< DependencySet * > *depset)
 Extracts the needed dependencies of a query.
virtual ExpressionplaceSignOffs (vector< SignOffExpression * > &signoffs)
 Places all signOff-statements in the corresponding query.
virtual void rewriteWhereExps ()
 Rewrites all where-clauses in the query into equivalent if-expressions.
virtual void rewriteEmptyFuncts ()
 Rewrites all fn:empty XQuery functions into equivalent fn:not(fn:exists) XQuery functions.
virtual void rewriteVarstepCondExps ()
 Rewrites all if($x) if-conditions into equivalent if(fn:not(fn:empty($x))) XQuery expressions.
virtual void rewriteAggregateFuncts ()
 Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).
virtual void rewriteVarsteps ()
 Rewrites all varstep expressions, which produces output into an equivalent for-clause (with return-clause).
virtual void print (OutputStream &dos) const =0
 Prints the expression.
virtual void init (BufferNode *root)
 Initializes the query for evaluation.
virtual void eval (OutputStream &eos, Environment *env, unsigned modus)
 Evaluates the expression in the given environment.
const EXP_TYPE getType ()
 Returns the EXP_TYPE of the corresponding expression.
void setType (EXP_TYPE _type)
 Sets the EXP_TYPE of the corresponding expression.
virtual bool containsDirectOutput ()
 Returns if the corresponding expression produces direct output.

Protected Attributes

TagMaptagmap
EXP_TYPE type
 The entered EXP_TYPE.


Detailed Description

Represents base class of all expressions.

Represents base class of all expressions.

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 92 of file expression.h.


Constructor & Destructor Documentation

Expression::Expression ( EXP_TYPE  _type  ) 

Constructor.

Constructor - creating object for an EXP_TYPE.

Parameters:
[in] _type EXP_TYPE.

Definition at line 37 of file expression.cpp.

Expression::~Expression (  )  [virtual]

Destructor.

Definition at line 41 of file expression.cpp.


Member Function Documentation

bool Expression::containsDirectOutput (  )  [virtual]

Returns if the corresponding expression produces direct output.

Returns if the corresponding expression produces direct output. Direct output is meant that this subexpression produces output such as node constructs or strings.

Return values:
bool true if the corresponding expression produces direct output, false otherwise.

Reimplemented in ForExpression, IfExpression, SequenceExpression, and WhereExpression.

Definition at line 89 of file expression.cpp.

Referenced by IfExpression::containsDirectOutput(), and ForExpression::containsDirectOutput().

void Expression::eval ( OutputStream eos,
Environment env,
unsigned  modus 
) [virtual]

Evaluates the expression in the given environment.

Evaluates the expression in the given environment. The evaluation takes place in the environment that is passed to this method. In addition, the parameter modus is one of the following: EVAL_QUERY, EVAL_QUERY_SILENT or EVAL_SIGNOFF (see also the corresponding defines for more information). This method implements the XQuery semantics for the standard expression types, but also the GCX specific extensions like signOff-statements.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to an Environment object.
[in] modus The query evaluation mode.
Exceptions:
RuntimeException If illegal evaluation mode.

Reimplemented in AggregateFunctAvgExpression, AggregateFunctCountExpression, AggregateFunctExpression, AggregateFunctMaxExpression, AggregateFunctMedianExpression, AggregateFunctMinExpression, AggregateFunctStdDevPopExpression, AggregateFunctStdDevSampExpression, AggregateFunctSumExpression, AggregateFunctVarPopExpression, AggregateFunctVarSampExpression, AndCondExpression, ConstExpression, EmptyCondExpression, ForExpression, FunctAbsExpression, FunctCeilingExpression, FunctCoverExpression, FunctFloorExpression, FunctRoundExpression, FunctRoundHalfToEvenExpression, FunctTruncateExpression, IfExpression, NodeConstructExpression, NotCondExpression, NumericConstExpression, OrCondExpression, RoundingExpression, SequenceExpression, SignOffExpression, StringConstExpression, VarExpression, VarStepExpression, and WhereExpression.

Definition at line 86 of file expression.cpp.

Referenced by OrCondExpression::eval(), NotCondExpression::eval(), NodeConstructExpression::eval(), IfExpression::eval(), ForExpression::eval(), AndCondExpression::eval(), Executor::evalQuery(), and ForExpression::evalSignOffForBinding().

void Expression::extractDependencies ( vector< DependencySet * > *  depset  )  [virtual]

void Expression::extractFSAMap ( FSAMap fsamap,
unsigned  parent_var 
) [virtual]

Extracts the needed first straight ancestor (FSA) variables map.

Extracts the needed first straight ancestor (FSA) variables map, which is needed for correct insertion of SignOffExpression.

Parameters:
[in,out] fsamap Pointer to a FSAMap object.
[in] parent_var Parent variable.
Return values:
void 

Reimplemented in AggregateFunctExpression, AndCondExpression, CondOperandExpression, EmptyCondExpression, ForExpression, IfExpression, NodeConstructExpression, NotCondExpression, OrCondExpression, RoundingExpression, SequenceExpression, and WhereExpression.

Definition at line 55 of file expression.cpp.

Referenced by Executor::collectQueryInformation(), OrCondExpression::extractFSAMap(), NotCondExpression::extractFSAMap(), NodeConstructExpression::extractFSAMap(), IfExpression::extractFSAMap(), ForExpression::extractFSAMap(), CondOperandExpression::extractFSAMap(), and AndCondExpression::extractFSAMap().

void Expression::extractParVarMap ( ParVarMap parvarmap  )  [virtual]

const EXP_TYPE Expression::getType (  )  [inline]

void Expression::init ( BufferNode root  )  [virtual]

void Expression::mergeSequences (  )  [virtual]

Merges belonging together XQuery sequences into a single sequence.

Merges belonging together XQuery sequences into a single sequence, which is done because of better/nicer output look.

Return values:
void 

Reimplemented in ForExpression, IfExpression, NodeConstructExpression, SequenceExpression, and WhereExpression.

Definition at line 52 of file expression.cpp.

Referenced by Executor::buildSignOffQuery(), NodeConstructExpression::mergeSequences(), IfExpression::mergeSequences(), ForExpression::mergeSequences(), and Executor::optimizeQuery().

Expression * Expression::placeSignOffs ( vector< SignOffExpression * > &  signoffs  )  [virtual]

Places all signOff-statements in the corresponding query.

Places all signOff-statements in the corresponding query, which are needed for active garbage collection by removing Role from the BufferNode.

Parameters:
[in] signoffs Pointer to a vector containing Pointer to SignOffExpression objects.
Return values:
Expression* Pointer to a Expression object (following expression in the corresponding query).

Reimplemented in AggregateFunctExpression, AndCondExpression, CondOperandExpression, EmptyCondExpression, ForExpression, IfExpression, NodeConstructExpression, NotCondExpression, OrCondExpression, RoundingExpression, SequenceExpression, and WhereExpression.

Definition at line 64 of file expression.cpp.

Referenced by Executor::insertSignOffs(), OrCondExpression::placeSignOffs(), NotCondExpression::placeSignOffs(), NodeConstructExpression::placeSignOffs(), IfExpression::placeSignOffs(), ForExpression::placeSignOffs(), CondOperandExpression::placeSignOffs(), and AndCondExpression::placeSignOffs().

void Expression::print ( OutputStream dos  )  const [pure virtual]

void Expression::replaceVarId ( unsigned  old_id,
unsigned  new_id 
) [virtual]

void Expression::rewriteAggregateFuncts (  )  [virtual]

void Expression::rewriteEmptyFuncts (  )  [virtual]

void Expression::rewriteVarstepCondExps (  )  [virtual]

void Expression::rewriteVarsteps (  )  [virtual]

Rewrites all varstep expressions, which produces output into an equivalent for-clause (with return-clause).

Rewrites all varstep expressions, which produces output into an equivalent for-clause (with return-clause). This method belongs to the 'earlier execution of signoff-statements' optimization.

Return values:
void 

Reimplemented in ForExpression, IfExpression, NodeConstructExpression, SequenceExpression, and WhereExpression.

Definition at line 80 of file expression.cpp.

Referenced by Executor::optimizeQuery(), NodeConstructExpression::rewriteVarsteps(), IfExpression::rewriteVarsteps(), and ForExpression::rewriteVarsteps().

void Expression::rewriteWhereExps (  )  [virtual]

Rewrites all where-clauses in the query into equivalent if-expressions.

Rewrites all where-clauses in the query into equivalent if-expressions, i.e. rewrites all WhereExpression into equivalent IfExpression.

Return values:
void 

Reimplemented in ForExpression, IfExpression, NodeConstructExpression, SequenceExpression, and WhereExpression.

Definition at line 68 of file expression.cpp.

Referenced by Executor::optimizeQuery(), NodeConstructExpression::rewriteWhereExps(), IfExpression::rewriteWhereExps(), and ForExpression::rewriteWhereExps().

void Expression::scopeCheck ( vector< unsigned > &  def_vars,
vector< unsigned > &  introduced_vars,
vector< unsigned > &  violating_vars 
) [virtual]

Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.

Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.

Parameters:
[in] def_vars Vector containing all previously defined variables.
[in] introduced_vars Vector containing all up to this expression defined variables.
[in] violating_vars Vector containing all variables which violates the scope condition.
Return values:
void 

Reimplemented in AggregateFunctExpression, AndCondExpression, CondOperandExpression, EmptyCondExpression, ExistsCondExpression, ForExpression, IfExpression, NodeConstructExpression, NotCondExpression, OrCondExpression, RoundingExpression, SequenceExpression, SignOffExpression, VarExpression, VarstepCondExpression, and WhereExpression.

Definition at line 44 of file expression.cpp.

Referenced by WhereExpression::scopeCheck(), OrCondExpression::scopeCheck(), NotCondExpression::scopeCheck(), NodeConstructExpression::scopeCheck(), IfExpression::scopeCheck(), ForExpression::scopeCheck(), CondOperandExpression::scopeCheck(), and AndCondExpression::scopeCheck().

void Expression::setType ( EXP_TYPE  _type  )  [inline]

Sets the EXP_TYPE of the corresponding expression.

Sets the EXP_TYPE of the corresponding expression.

Parameters:
[in] _type EXP_TYPE.
Return values:
void 

Definition at line 257 of file expression.h.

Referenced by EmptyCondExpression::rewriteEmptyFuncts(), VarstepCondExpression::rewriteVarstepCondExps(), and WhereExpression::rewriteWhereExps().


Member Data Documentation

TagMap * Expression::tagmap [protected]

The map which contains mapping of numeric values of tagnames to their string value.

Definition at line 276 of file expression.h.

Referenced by NodeConstructExpression::eval(), PathStepTagExpression::print(), and NodeConstructExpression::print().


Generated on Sun May 24 20:20:23 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9