AggregateFunctExpression Class Reference

Represents base class of all aggregate function expressions. More...

#include <aggregatefunctexpression.h>

Inheritance diagram for AggregateFunctExpression:

Inheritance graph
[legend]
Collaboration diagram for AggregateFunctExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AggregateFunctExpression (EXP_TYPE _type, VarExpression *_var)
 Constructor.
 AggregateFunctExpression (EXP_TYPE _type, VarStepExpression *_varstep)
 Constructor.
virtual ~AggregateFunctExpression ()
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)
void rewriteAggregateFuncts ()
virtual void print (OutputStream &dos) const
virtual void init (BufferNode *root)
virtual void eval (OutputStream &eos, Environment *env, unsigned modus)=0
bool isSingleValued ()
virtual void prepareOperand (OutputStream &eos, Environment *env, unsigned modus)
void unprepareOperand ()
virtual ValuegetNextValue ()

Protected Attributes

VarExpressionvar
 The entered VarExpression.
VarStepExpressionvarstep
 The entered VarStepExpression.
ForExpressionforexp
 The rewritten ForExpression of the entered VarExpression or VarStepExpression.
BufferIteratorbit
 The initialized BufferIterator for the entered VarExpression or VarStepExpression.

Private Member Functions

virtual long double calculateValue (OutputStream &eos, Environment *env, unsigned modus, bool &empty_sequence)=0
 Result calculation of the corresponding aggregate function.


Detailed Description

Represents base class of all aggregate function expressions.

Represents base class of all aggregate function expressions.

Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 52 of file aggregatefunctexpression.h.


Constructor & Destructor Documentation

AggregateFunctExpression::AggregateFunctExpression ( EXP_TYPE  _type,
VarExpression _var 
)

Constructor.

Constructor - creating object for an EXP_TYPE and a VarExpression.

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

Definition at line 37 of file aggregatefunctexpression.cpp.

AggregateFunctExpression::AggregateFunctExpression ( EXP_TYPE  _type,
VarStepExpression _varstep 
)

Constructor.

Constructor - creating object for an EXP_TYPE and a VarStepExpression.

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

Definition at line 47 of file aggregatefunctexpression.cpp.

AggregateFunctExpression::~AggregateFunctExpression (  )  [virtual]

Destructor.

Definition at line 57 of file aggregatefunctexpression.cpp.

References bit, forexp, var, and varstep.


Member Function Documentation

long double AggregateFunctExpression::calculateValue ( OutputStream eos,
Environment env,
unsigned  modus,
bool &  empty_sequence 
) [private, pure virtual]

Result calculation of the corresponding aggregate function.

Result calculation of the corresponding aggregate function.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to a Environment object.
[in] modus Evaluation modus.
[in] empty_sequence Indicator if aggreagte function is called on an empty sequence.
Return values:
long double Result of the corresponding aggregate function.

Implemented in AggregateFunctAvgExpression, AggregateFunctCountExpression, AggregateFunctMaxExpression, AggregateFunctMedianExpression, AggregateFunctMinExpression, AggregateFunctStdDevPopExpression, AggregateFunctStdDevSampExpression, AggregateFunctSumExpression, AggregateFunctVarPopExpression, and AggregateFunctVarSampExpression.

void AggregateFunctExpression::eval ( OutputStream eos,
Environment env,
unsigned  modus 
) [pure 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 from Expression.

Implemented in AggregateFunctAvgExpression, AggregateFunctCountExpression, AggregateFunctMaxExpression, AggregateFunctMedianExpression, AggregateFunctMinExpression, AggregateFunctStdDevPopExpression, AggregateFunctStdDevSampExpression, AggregateFunctSumExpression, AggregateFunctVarPopExpression, and AggregateFunctVarSampExpression.

Referenced by prepareOperand().

void AggregateFunctExpression::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 91 of file aggregatefunctexpression.cpp.

References ForExpression::extractDependencies(), forexp, and Expression::type.

Referenced by RoundingExpression::extractDependencies().

void AggregateFunctExpression::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 82 of file aggregatefunctexpression.cpp.

References ForExpression::extractFSAMap(), and forexp.

Referenced by RoundingExpression::extractFSAMap().

void AggregateFunctExpression::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 87 of file aggregatefunctexpression.cpp.

References ForExpression::extractParVarMap(), and forexp.

Referenced by RoundingExpression::extractParVarMap().

Value * AggregateFunctExpression::getNextValue (  )  [virtual]

void AggregateFunctExpression::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 223 of file aggregatefunctexpression.cpp.

References bit, forexp, ForExpression::init(), var, and varstep.

Referenced by RoundingExpression::init().

bool AggregateFunctExpression::isSingleValued (  )  [inline, virtual]

Returns if the result/iteration of the operand is a single value.

Returns if the result/iteration of the operand is a single value, e.g a AggregateFunctExpression returns a single value whereas a VarStepExpression may return more than one value.

Return values:
bool  if the result/iteration is a single value, false otherwise.

Implements OperandExpression.

Definition at line 130 of file aggregatefunctexpression.h.

Expression * AggregateFunctExpression::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 100 of file aggregatefunctexpression.cpp.

References forexp, and ForExpression::placeSignOffs().

Referenced by RoundingExpression::placeSignOffs().

void AggregateFunctExpression::prepareOperand ( OutputStream eos,
Environment env,
unsigned  modus 
) [virtual]

Initializes the operand if necessary.

Initializes the operand if necessary.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to a Environment object.
[in] modus Evaluation modus.
Return values:
void 

Implements OperandExpression.

Definition at line 233 of file aggregatefunctexpression.cpp.

References eval(), and EVAL_QUERY_SILENT.

Referenced by FunctTruncateExpression::calculateValue(), FunctRoundHalfToEvenExpression::calculateValue(), FunctRoundExpression::calculateValue(), FunctFloorExpression::calculateValue(), FunctCoverExpression::calculateValue(), FunctCeilingExpression::calculateValue(), and FunctAbsExpression::calculateValue().

void AggregateFunctExpression::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 126 of file aggregatefunctexpression.cpp.

References forexp, Expression::type, and varstep.

void AggregateFunctExpression::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 74 of file aggregatefunctexpression.cpp.

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

Referenced by RoundingExpression::replaceVarId().

void AggregateFunctExpression::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 108 of file aggregatefunctexpression.cpp.

References VarStepExpression::clone(), VarExpression::clone(), forexp, VarName::getInstance(), var, and varstep.

Referenced by RoundingExpression::rewriteAggregateFuncts().

void AggregateFunctExpression::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 64 of file aggregatefunctexpression.cpp.

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

Referenced by RoundingExpression::scopeCheck().

void AggregateFunctExpression::unprepareOperand (  )  [inline, virtual]


Member Data Documentation


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