#include <sequenceexpression.h>
Public Member Functions | |
SequenceExpression (Expression *_left, Expression *_right) | |
Constructor. | |
virtual | ~SequenceExpression () |
virtual void | scopeCheck (vector< unsigned > &def_vars, vector< unsigned > &introduced_vars, vector< unsigned > &violating_vars) |
virtual void | replaceVarId (unsigned old_id, unsigned new_id) |
virtual void | mergeSequences () |
virtual void | extractFSAMap (FSAMap *fsamap, unsigned parent_var) |
virtual void | extractParVarMap (ParVarMap *parvarmap) |
virtual void | extractDependencies (vector< DependencySet * > *depset) |
virtual Expression * | placeSignOffs (vector< SignOffExpression * > &signoffs) |
virtual void | rewriteWhereExps () |
virtual void | rewriteEmptyFuncts () |
virtual void | rewriteVarstepCondExps () |
virtual void | rewriteAggregateFuncts () |
virtual void | rewriteVarsteps () |
virtual void | print (OutputStream &dos) const |
virtual void | init (BufferNode *root) |
virtual void | eval (OutputStream &eos, Environment *env, unsigned modus) |
void | insertExp (Expression *exp) |
Inserts a new expression to this sequence of XQuery expressions. | |
void | unsetRecursiveDelete () |
Resets recursive delete of this object. | |
virtual bool | containsDirectOutput () |
Private Member Functions | |
vector< Expression * > * | getExps () |
Returns the sequence of XQuery expressions. | |
Private Attributes | |
vector< Expression * > | exps |
The entered (sequence of) XQuery expressions. | |
bool | delete_recursively |
Indicator to change delete behaviour when the destructor is called. |
Represents a sequence of XQuery expressions, which takes therefore (two) Expression, e.g. $x, $y
or //book, fn:count($x)
, as arguments and returns the strictly sequentially evaluated results of the (two) Expression, i.e. outputs or returns the corresponding Expression values according to their (input) order.
Definition at line 55 of file sequenceexpression.h.
SequenceExpression::SequenceExpression | ( | Expression * | _left, | |
Expression * | _right | |||
) |
Constructor.
Constructor - creating object for two Expression.
[in] | _left | Pointer to a Expression object. |
[in] | _right | Pointer to a Expression object. |
Definition at line 37 of file sequenceexpression.cpp.
References exps.
SequenceExpression::~SequenceExpression | ( | ) | [virtual] |
Destructor.
Definition at line 43 of file sequenceexpression.cpp.
References delete_recursively, and exps.
bool SequenceExpression::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.
bool | true if the corresponding expression produces direct output, false otherwise. |
Reimplemented from Expression.
Definition at line 212 of file sequenceexpression.cpp.
References exps, and Expression::getType().
void SequenceExpression::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.
[in] | eos | Pointer to a OutputStream object. |
[in] | env | Pointer to an Environment object. |
[in] | modus | The query evaluation mode. |
RuntimeException | If illegal evaluation mode. |
Reimplemented from Expression.
Definition at line 193 of file sequenceexpression.cpp.
References EVAL_QUERY, EVAL_SIGNOFF, and exps.
void SequenceExpression::extractDependencies | ( | vector< DependencySet * > * | depset | ) | [virtual] |
Extracts the needed dependencies of a query.
Extracts the needed dependencies of a query, which are needed for constructing the ProjectionTree.
[in,out] | depset | Pointer to a vector containing Pointer to DependencySet objects. |
void |
Reimplemented from Expression.
Definition at line 100 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::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.
[in,out] | fsamap | Pointer to a FSAMap object. |
[in] | parent_var | Parent variable. |
void |
Reimplemented from Expression.
Definition at line 88 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::extractParVarMap | ( | ParVarMap * | parvarmap | ) | [virtual] |
Extracts the needed parent variable (ParVar) map.
Extracts the needed parent variable (ParVar) map, which is needed for constructing the VariableTree.
[in,out] | parvarmap | Pointer to a ParVarMap object. |
void |
Reimplemented from Expression.
Definition at line 94 of file sequenceexpression.cpp.
References exps.
vector< Expression * > * SequenceExpression::getExps | ( | ) | [inline, private] |
Returns the sequence of XQuery expressions.
Returns the sequence of XQuery expressions, i.e. returns the member variable.
vector<Expression*>* | Pointer to a vector object containing Pointer to Expression objects. |
Definition at line 176 of file sequenceexpression.h.
References exps.
Referenced by mergeSequences().
void SequenceExpression::init | ( | BufferNode * | root | ) | [virtual] |
Initializes the query for evaluation.
Initializes the query for evaluation. Up to now only all required BufferIterator objects are created to speed up query evaluation.
[in] | root | Pointer to a BufferNode object. |
void |
Reimplemented from Expression.
Definition at line 187 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::insertExp | ( | Expression * | exp | ) | [inline] |
Inserts a new expression to this sequence of XQuery expressions.
Inserts a new expression to this sequence of XQuery expressions.
[in] | exp | Pointer to a Expression object. |
void |
Definition at line 153 of file sequenceexpression.h.
References exps.
void SequenceExpression::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.
void |
Reimplemented from Expression.
Definition at line 65 of file sequenceexpression.cpp.
References exps, getExps(), Expression::getType(), and unsetRecursiveDelete().
Expression * SequenceExpression::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.
[in] | signoffs | Pointer to a vector containing Pointer to SignOffExpression objects. |
Expression* | Pointer to a Expression object (following expression in the corresponding query). |
Reimplemented from Expression.
Definition at line 106 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::print | ( | OutputStream & | dos | ) | const [virtual] |
Prints the expression.
Prints the expression.
[in] | dos | Pointer to a OutputStream object. |
void |
Implements Expression.
Definition at line 156 of file sequenceexpression.cpp.
References decrementIndents(), exps, Expression::getType(), incrementIndents(), NEWLINE, and writeIndents().
void SequenceExpression::replaceVarId | ( | unsigned | old_id, | |
unsigned | new_id | |||
) | [virtual] |
Replaces all matching variable IDs by a new one.
Replaces all matching variable IDs by a new one, which is needed in case of calling method rewriteVarsteps().
[in] | old_id | Old variable ID. |
[in] | new_id | New variable ID, which should be introduced instead. |
void |
Reimplemented from Expression.
Definition at line 59 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::rewriteAggregateFuncts | ( | ) | [virtual] |
Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).
Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).
void |
Reimplemented from Expression.
Definition at line 133 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::rewriteEmptyFuncts | ( | ) | [virtual] |
Rewrites all fn:empty
XQuery functions into equivalent fn:not(fn:exists)
XQuery functions.
Rewrites all fn:empty
XQuery functions into equivalent fn:not(fn:exists)
XQuery functions.
void |
Reimplemented from Expression.
Definition at line 121 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::rewriteVarstepCondExps | ( | ) | [virtual] |
Rewrites all if($x)
if-conditions into equivalent if(fn:not(fn:empty($x)))
XQuery expressions.
Rewrites all if($x)
if-conditions into equivalent if(fn:not(fn:empty($x)))
XQuery expressions.
void |
Reimplemented from Expression.
Definition at line 127 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::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.
void |
Reimplemented from Expression.
Definition at line 139 of file sequenceexpression.cpp.
References VarExpression::clone(), exps, VarName::getInstance(), and Expression::getType().
void SequenceExpression::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.
void |
Reimplemented from Expression.
Definition at line 115 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::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.
[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. |
void |
Reimplemented from Expression.
Definition at line 49 of file sequenceexpression.cpp.
References exps.
void SequenceExpression::unsetRecursiveDelete | ( | ) | [inline] |
Resets recursive delete of this object.
Resets recursive delete of this object, i.e. on delete of this object subexpressions will not be deleted recursively.
void |
Definition at line 161 of file sequenceexpression.h.
Referenced by mergeSequences().
bool SequenceExpression::delete_recursively [private] |
Indicator to change delete behaviour when the destructor is called.
true
will delete sequences recursively, false
otherwise.
Definition at line 190 of file sequenceexpression.h.
Referenced by ~SequenceExpression().
vector< Expression * > SequenceExpression::exps [private] |
The entered (sequence of) XQuery expressions.
The entered (sequence of) XQuery expressions, which are the arguments of the constructor.
Definition at line 184 of file sequenceexpression.h.
Referenced by containsDirectOutput(), eval(), extractDependencies(), extractFSAMap(), extractParVarMap(), getExps(), init(), insertExp(), mergeSequences(), placeSignOffs(), print(), replaceVarId(), rewriteAggregateFuncts(), rewriteEmptyFuncts(), rewriteVarstepCondExps(), rewriteVarsteps(), rewriteWhereExps(), scopeCheck(), SequenceExpression(), and ~SequenceExpression().