CondOperandExpression Class Reference

Represents XQuery comparison of two operands with relational operators <, <=, >=, >, = or !=. More...

#include <condoperandexpression.h>

Inheritance diagram for CondOperandExpression:

Inheritance graph
[legend]
Collaboration diagram for CondOperandExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CondOperandExpression (OperandExpression *_left, COMP_TYPE _op, OperandExpression *_right)
 Constructor.
virtual ~CondOperandExpression ()
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 extractFSAMap (FSAMap *fsamap, unsigned parent_var)
virtual void extractParVarMap (ParVarMap *parvarmap)
virtual void extractDependencies (vector< DependencySet * > *depset)
virtual ExpressionplaceSignOffs (vector< SignOffExpression * > &signoffs)
virtual void rewriteEmptyFuncts ()
virtual void rewriteVarstepCondExps ()
virtual void rewriteAggregateFuncts ()
virtual void print (OutputStream &dos) const
virtual void init (BufferNode *root)
virtual bool evalCond (OutputStream &eos, Environment *env, unsigned modus)

Private Member Functions

bool evalRelOp (Value *left, COMP_TYPE op, Value *right)
 Evaluates the two entered Value objects with respect to the entered COMP_TYPE.
COMP_TYPE invertOperator (COMP_TYPE ot)
 Inverts the entered COMP_TYPE.

Private Attributes

OperandExpressionleft
 The entered OperandExpression on the left hand side of the entered COMP_TYPE.
COMP_TYPE op
 The entered COMP_TYPE between the two entered OperandExpression.
OperandExpressionright
 The entered OperandExpression on the right hand side of the entered COMP_TYPE.


Detailed Description

Represents XQuery comparison of two operands with relational operators <, <=, >=, >, = or !=.

Represents XQuery comparison of two operands with relational operators <, <=, >=, >, = or !=, which takes therefore two OperandExpression, e.g. $x/bib/book, "foo" or fn:count($x), and a COMP_TYPE, e.g. = or !=, as arguments and returns the evaluated value of the two OperandExpression with respect to COMP_TYPE, i.e. returns true if the two OperandExpression are in correct relationship to the COMP_TYPE, false otherwise.

Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 56 of file condoperandexpression.h.


Constructor & Destructor Documentation

CondOperandExpression::CondOperandExpression ( OperandExpression _left,
COMP_TYPE  _op,
OperandExpression _right 
)

Constructor.

Constructor - creating object for a COMP_TYPE and two OperandExpression.

Parameters:
[in] _left Pointer to a OperandExpression object.
[in] _op COMP_TYPE.
[in] _right Pointer to a OperandExpression object.

Definition at line 38 of file condoperandexpression.cpp.

CondOperandExpression::~CondOperandExpression (  )  [virtual]

Destructor.

Definition at line 48 of file condoperandexpression.cpp.

References left, and right.


Member Function Documentation

bool CondOperandExpression::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 135 of file condoperandexpression.cpp.

References EVAL_QUERY, EVAL_SIGNOFF, evalRelOp(), OperandExpression::getNextValue(), invertOperator(), OperandExpression::isSingleValued(), left, op, OperandExpression::prepareOperand(), right, and OperandExpression::unprepareOperand().

bool CondOperandExpression::evalRelOp ( Value left,
COMP_TYPE  op,
Value right 
) [private]

Evaluates the two entered Value objects with respect to the entered COMP_TYPE.

Evaluates the two entered Value objects with respect to the entered COMP_TYPE to true or false.

Parameters:
[in] left Pointer to a Value object.
[in] op COMP_TYPE.
[in] right Pointer to a Value object.
Return values:
bool true if the two Value objects are in correct relationship with respect to the entered COMP_TYPE, false otherwise.

Definition at line 199 of file condoperandexpression.cpp.

References Value::getNumVal(), Value::getStrVal(), and Value::type.

Referenced by evalCond().

void CondOperandExpression::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 75 of file condoperandexpression.cpp.

References Expression::extractDependencies(), left, and right.

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

Definition at line 65 of file condoperandexpression.cpp.

References Expression::extractFSAMap(), left, and right.

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

Parameters:
[in,out] parvarmap Pointer to a ParVarMap object.
Return values:
void 

Reimplemented from Expression.

Definition at line 70 of file condoperandexpression.cpp.

References Expression::extractParVarMap(), left, and right.

void CondOperandExpression::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 130 of file condoperandexpression.cpp.

References Expression::init(), left, and right.

COMP_TYPE CondOperandExpression::invertOperator ( COMP_TYPE  ot  )  [private]

Inverts the entered COMP_TYPE.

Inverts the entered COMP_TYPE, e.g. < results in >.

Parameters:
[in] ot COMP_TYPE.
Return values:
COMP_TYPE The inverted COMP_TYPE of the original one.

Definition at line 239 of file condoperandexpression.cpp.

Referenced by evalCond().

Expression * CondOperandExpression::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 from Expression.

Definition at line 81 of file condoperandexpression.cpp.

References left, Expression::placeSignOffs(), and right.

void CondOperandExpression::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 105 of file condoperandexpression.cpp.

References op.

void CondOperandExpression::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 60 of file condoperandexpression.cpp.

References left, Expression::replaceVarId(), and right.

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

Return values:
void 

Reimplemented from Expression.

Definition at line 100 of file condoperandexpression.cpp.

References left, Expression::rewriteAggregateFuncts(), and right.

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

Return values:
void 

Reimplemented from Expression.

Definition at line 90 of file condoperandexpression.cpp.

References left, Expression::rewriteEmptyFuncts(), and right.

void CondOperandExpression::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 95 of file condoperandexpression.cpp.

References left, Expression::rewriteVarstepCondExps(), and right.

void CondOperandExpression::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 53 of file condoperandexpression.cpp.

References left, right, and Expression::scopeCheck().


Member Data Documentation

The entered OperandExpression on the left hand side of the entered COMP_TYPE.

The entered OperandExpression on the left hand side of the entered COMP_TYPE, which is the first argument of the constructor.

Definition at line 162 of file condoperandexpression.h.

Referenced by evalCond(), extractDependencies(), extractFSAMap(), extractParVarMap(), init(), placeSignOffs(), replaceVarId(), rewriteAggregateFuncts(), rewriteEmptyFuncts(), rewriteVarstepCondExps(), scopeCheck(), and ~CondOperandExpression().

The entered COMP_TYPE between the two entered OperandExpression.

The entered COMP_TYPE between the two entered OperandExpression, which is the second argument of the constructor.

Definition at line 169 of file condoperandexpression.h.

Referenced by evalCond(), and print().

The entered OperandExpression on the right hand side of the entered COMP_TYPE.

The entered OperandExpression on the right hand side of the entered COMP_TYPE, which is the third argument of the constructor.

Definition at line 176 of file condoperandexpression.h.

Referenced by evalCond(), extractDependencies(), extractFSAMap(), extractParVarMap(), init(), placeSignOffs(), replaceVarId(), rewriteAggregateFuncts(), rewriteEmptyFuncts(), rewriteVarstepCondExps(), scopeCheck(), and ~CondOperandExpression().


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