VarstepCondExpression Class Reference

Represents XQuery condition if($x) or if($x/bib/book). More...

#include <varstepcondexpression.h>

Inheritance diagram for VarstepCondExpression:

Inheritance graph
[legend]
Collaboration diagram for VarstepCondExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 VarstepCondExpression (VarExpression *_var)
 Constructor.
 VarstepCondExpression (VarStepExpression *_varstep)
 Constructor.
virtual ~VarstepCondExpression ()
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)
void rewriteVarstepCondExps ()
virtual void print (OutputStream &dos) const
virtual void init (BufferNode *root)
virtual bool evalCond (OutputStream &eos, Environment *env, unsigned modus)

Private Attributes

VarExpressionvar
 The entered VarExpression.
VarStepExpressionvarstep
 The entered VarStepExpression.
ExistsCondExpressionecond
 The rewritten ExistsCondExpression of the entered VarExpression or VarStepExpression.


Detailed Description

Represents XQuery condition if($x) or if($x/bib/book).

Represents XQuery condition if($x) or if($x/bib/book), which takes either a VarExpression, e.g. if($x), or a VarStepExpression, e.g. if($x/bib/book) or if(/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.

Note:
This expression does not exists instead it is rewritten to fn:exists.
Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 56 of file varstepcondexpression.h.


Constructor & Destructor Documentation

VarstepCondExpression::VarstepCondExpression ( VarExpression _var  ) 

Constructor.

Constructor - creating object for a VarExpression.

Parameters:
[in] _var Pointer to a VarExpression object.

Definition at line 37 of file varstepcondexpression.cpp.

VarstepCondExpression::VarstepCondExpression ( VarStepExpression _varstep  ) 

Constructor.

Constructor - creating object for a VarStepExpression.

Parameters:
[in] _varstep Pointer to a VarStepExpression object.

Definition at line 41 of file varstepcondexpression.cpp.

VarstepCondExpression::~VarstepCondExpression (  )  [virtual]

Destructor.

Definition at line 45 of file varstepcondexpression.cpp.

References econd.


Member Function Documentation

bool VarstepCondExpression::evalCond ( OutputStream eos,
Environment env,
unsigned  modus 
) [virtual]

Evaluates the corresponding CondExpression.

Evaluates the corresponding CondExpression.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to a Environment object.
[in] modus Evaluation modus.
Return values:
bool true if the corresponding CondExpression is true, false otherwise.
Exceptions:
RuntimeException If illegal evaluation mode (argument: unsigned modus).

Implements CondExpression.

Definition at line 92 of file varstepcondexpression.cpp.

References econd, and ExistsCondExpression::evalCond().

void VarstepCondExpression::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.

Parameters:
[in,out] depset Pointer to a vector containing Pointer to DependencySet objects.
Return values:
void 

Reimplemented from Expression.

Definition at line 67 of file varstepcondexpression.cpp.

References econd, and ExistsCondExpression::extractDependencies().

void VarstepCondExpression::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.

Parameters:
[in] root Pointer to a BufferNode object.
Return values:
void 

Reimplemented from Expression.

Definition at line 88 of file varstepcondexpression.cpp.

References econd, and ExistsCondExpression::init().

void VarstepCondExpression::print ( OutputStream dos  )  const [virtual]

Prints the expression.

Prints the expression.

Parameters:
[in] dos Pointer to a OutputStream object.
Return values:
void 

Implements Expression.

Definition at line 78 of file varstepcondexpression.cpp.

References econd, and var.

void VarstepCondExpression::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().

Parameters:
[in] old_id Old variable ID.
[in] new_id New variable ID, which should be introduced instead.
Return values:
void 

Reimplemented from Expression.

Definition at line 59 of file varstepcondexpression.cpp.

References VarExpression::replaceVarId(), var, and varstep.

void VarstepCondExpression::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.

Return values:
void 

Reimplemented from Expression.

Definition at line 72 of file varstepcondexpression.cpp.

References econd, Expression::setType(), var, and varstep.

void VarstepCondExpression::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 from Expression.

Definition at line 49 of file varstepcondexpression.cpp.

References VarExpression::scopeCheck(), var, and varstep.


Member Data Documentation

The rewritten ExistsCondExpression of the entered VarExpression or VarStepExpression.

The rewritten ExistsCondExpression of the entered VarExpression or VarStepExpression after calling method rewriteVarstepCondExps(). This member variable is NULL on creation of object but should not be NULL anymore after method rewriteVarstepCondExps() has been executed.

Definition at line 136 of file varstepcondexpression.h.

Referenced by evalCond(), extractDependencies(), init(), print(), rewriteVarstepCondExps(), and ~VarstepCondExpression().

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 120 of file varstepcondexpression.h.

Referenced by print(), replaceVarId(), rewriteVarstepCondExps(), and scopeCheck().

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 127 of file varstepcondexpression.h.

Referenced by replaceVarId(), rewriteVarstepCondExps(), and scopeCheck().


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