fn:exists
.
More...
#include <existscondexpression.h>
Public Member Functions | |
ExistsCondExpression (VarExpression *_var) | |
Constructor. | |
ExistsCondExpression (VarStepExpression *_varstep) | |
Constructor. | |
virtual | ~ExistsCondExpression () |
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 | extractDependencies (vector< DependencySet * > *depset) |
virtual void | print (OutputStream &dos) const |
void | init (BufferNode *root) |
virtual bool | evalCond (OutputStream &eos, Environment *env, unsigned modus) |
Private Attributes | |
VarExpression * | var |
The entered VarExpression. | |
VarStepExpression * | varstep |
The entered VarStepExpression. | |
BufferIterator * | bit |
The initialized BufferIterator for the entered VarExpression or VarStepExpression. |
fn:exists
.
Represents XQuery standard function fn:exists
, which takes either a VarExpression, e.g. fn:exists($x)
, or a VarStepExpression, e.g. fn:exists($x/bib/book)
or fn:exists(/bib//book)
respectively, as argument and returns true
if the sequence located through the entered VarExpression or the entered VarStepExpression respectively contains one or more items, false
otherwise.
Definition at line 55 of file existscondexpression.h.
ExistsCondExpression::ExistsCondExpression | ( | VarExpression * | _var | ) |
Constructor.
Constructor - creating object for a VarExpression.
[in] | _var | Pointer to a VarExpression object. |
Definition at line 37 of file existscondexpression.cpp.
ExistsCondExpression::ExistsCondExpression | ( | VarStepExpression * | _varstep | ) |
Constructor.
Constructor - creating object for a VarStepExpression.
[in] | _varstep | Pointer to a VarStepExpression object. |
Definition at line 41 of file existscondexpression.cpp.
ExistsCondExpression::~ExistsCondExpression | ( | ) | [virtual] |
Destructor.
Definition at line 45 of file existscondexpression.cpp.
bool ExistsCondExpression::evalCond | ( | OutputStream & | eos, | |
Environment * | env, | |||
unsigned | modus | |||
) | [virtual] |
Evaluates the corresponding CondExpression.
Evaluates the corresponding CondExpression.
[in] | eos | Pointer to a OutputStream object. |
[in] | env | Pointer to a Environment object. |
[in] | modus | Evaluation modus. |
bool | true if the corresponding CondExpression is true , false otherwise. |
RuntimeException | If illegal evaluation mode (argument: unsigned modus). |
Implements CondExpression.
Definition at line 101 of file existscondexpression.cpp.
References bit, EVAL_QUERY, EVAL_SIGNOFF, VarExpression::getId(), BufferIterator::getNext(), Environment::getNodeBinding(), BufferIterator::init(), BufferIterator::reset(), var, and varstep.
Referenced by VarstepCondExpression::evalCond().
void ExistsCondExpression::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 69 of file existscondexpression.cpp.
References VarExpression::getId(), VarStepExpression::getPath(), PathExpression::isEmptyPath(), var, and varstep.
Referenced by VarstepCondExpression::extractDependencies().
void ExistsCondExpression::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 92 of file existscondexpression.cpp.
References bit, var, and varstep.
Referenced by VarstepCondExpression::init().
void ExistsCondExpression::print | ( | OutputStream & | dos | ) | const [virtual] |
Prints the expression.
Prints the expression.
[in] | dos | Pointer to a OutputStream object. |
void |
Implements Expression.
Definition at line 84 of file existscondexpression.cpp.
References var.
void ExistsCondExpression::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 61 of file existscondexpression.cpp.
References VarExpression::replaceVarId(), var, and varstep.
void ExistsCondExpression::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 51 of file existscondexpression.cpp.
References VarExpression::scopeCheck(), var, and varstep.
BufferIterator * ExistsCondExpression::bit [private] |
The initialized BufferIterator for the entered VarExpression or VarStepExpression.
The initialized BufferIterator for the entered VarExpression or VarStepExpression after calling method init(). This member variable is NULL
on creation of object but should not be NULL
anymore after method init() has been executed.
Definition at line 129 of file existscondexpression.h.
Referenced by evalCond(), init(), and ~ExistsCondExpression().
VarExpression * ExistsCondExpression::var [private] |
The entered VarExpression.
The entered VarExpression, which is the argument of the constructor. This member variable is NULL
if the constructor was called with a VarStepExpression.
Definition at line 114 of file existscondexpression.h.
Referenced by evalCond(), extractDependencies(), init(), print(), replaceVarId(), scopeCheck(), and ~ExistsCondExpression().
VarStepExpression * ExistsCondExpression::varstep [private] |
The entered VarStepExpression.
The entered VarStepExpression, which is the argument of the constructor. This member variable is NULL
if the constructor was called with a VarExpression.
Definition at line 121 of file existscondexpression.h.
Referenced by evalCond(), extractDependencies(), init(), replaceVarId(), scopeCheck(), and ~ExistsCondExpression().