ProjectionTreeNode Class Reference

Represents a single node of the constructed projection tree. More...

#include <projectiontreenode.h>

Collaboration diagram for ProjectionTreeNode:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ProjectionTreeNode (ProjectionTreeNode *_parent, int _var, PathExpression *_path, bool _dep, Role *_role, bool _direct_output)
 Constructor.
virtual ~ProjectionTreeNode ()
bool insertNode (int parent_var, int introduced_var, PathExpression *path, bool dep, Role *role, bool direct_output)
 Inserts a new node into the projection tree.
void print (OutputStream &dos)
 Prints this single ProjectionTreeNode.
ProjectionTreeNodegetParent ()
 Returns the parent node of a node.
int getVar ()
 Returns the variable of a node.
PathExpressiongetPath ()
 Returns the path of a node.
RolegetRole ()
 Returns the role of a node.
vector< ProjectionTreeNode * > * getChildren ()
 Returns all children of a node.
PathExpressiongetRootPath ()
 Returns the path from the root node of the projection tree to this node (including its own path).
void getPathsFromRoot (vector< PathExpression * > &paths)
 Returns the collection of paths from the root node of the projection tree down to this node.
bool isRoot ()
 Returns if this projection tree node is the root node of the projection tree.
bool isDepNode ()
 Returns if this projection tree node derives from a dependency.
bool isPosDepNode ()
 Returns if this projection tree node derives from a dependency with a [position()=1] PathStepAttributePosition.
bool isDosDepNode ()
 Returns if this projection tree node derives from a dependency with a dos::node() PathStepExpression.
void clearChildren ()
 Removes/Deletes all children of this projection tree node.
void removeUnneededNodes (PassiveProjectionTree *ppt)
 Removes/Deletes all unneeded nodes of the projection tree.
void removeRedundantRoles (PassiveProjectionTree *ppt)
 Removes/Deletes all redundant roles/nodes of the projection tree.
void registerToPassiveProjectionTree (PassiveProjectionTree *ppt)
 Registers a projection tree node to the passive projection tree.

Private Member Functions

void print (OutputStream &dos, unsigned indents)
 Prints this single ProjectionTreeNode with whitespace indenting.
void removeSubtreeInclSelf (PassiveProjectionTree *ppt)
 Removes/Deletes a subtree (including the calling node itself) from a projection tree node on.
void removeSubtreeExclSelf (PassiveProjectionTree *ppt)
 Removes/Deletes a subtree (excluding the calling node itself) from a projection tree node on.
void setRedundantRoleSelf ()
 Sets a role of a projection tree as redundant.

Private Attributes

ProjectionTreeNodeparent
 The entered ProjectionTreeNode (parent node).
int var
 The entered variable to which the projection tree node referes to (-1 if none).
PathExpressionpath
 The entered path.
bool dep
 The entered indicator if this projection tree node derives from a dependency.
Rolerole
 The entered role.
vector< ProjectionTreeNode * > children
bool direct_output
 The entered indicator if the associated for-loop of a node directly produces output.


Detailed Description

Represents a single node of the constructed projection tree.

Represents a single node of the constructed projection tree, i.e. of the constructed ProjectionTree, which takes a variable as parent node, a variable as child node of this parent node, a PathExpression, an indicator if this projection tree node derives from a dependency, a Role and an indicator if this projection tree node or the corresponding ForExpression respectively produces direct output, as arguments.

Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 54 of file projectiontreenode.h.


Constructor & Destructor Documentation

ProjectionTreeNode::ProjectionTreeNode ( ProjectionTreeNode _parent,
int  _var,
PathExpression _path,
bool  _dep,
Role _role,
bool  _direct_output 
)

Constructor.

Constructor - creating object for a variable as parent, a variable as child node of this parent node, a PathExpression, an indicator if this projection tree node derives from a dependency, a Role and an indicator if this projection tree node or the corresponding ForExpression respectively produces direct output.

Parameters:
[in] _parent Pointer to a ProjectionTreeNode object.
[in] _var New Variable or child node respectively which this projection tree node referes to (-1 if none).
[in] _path Pointer to a PathExpression object.
[in] _dep Indicator if this projection tree node derives from a dependency.
[in] _role Pointer to a Role object.
[in] _direct_output true if the associated for-loop directly produces output, false otherwise.

Definition at line 37 of file projectiontreenode.cpp.

Referenced by insertNode().

ProjectionTreeNode::~ProjectionTreeNode (  )  [virtual]

Destructor.

Definition at line 48 of file projectiontreenode.cpp.

References children.


Member Function Documentation

void ProjectionTreeNode::clearChildren (  )  [inline]

Removes/Deletes all children of this projection tree node.

Removes/Deletes all children of this projection tree node.

Return values:
void 

Definition at line 208 of file projectiontreenode.h.

References children.

vector< ProjectionTreeNode * > * ProjectionTreeNode::getChildren (  )  [inline]

Returns all children of a node.

Returns all children of a node, i.e. returns the member variable.

Return values:
vector<ProjectionTreeNode*>* Pointer to a vector containing ProjectionTreeNode objects.

Definition at line 141 of file projectiontreenode.h.

References children.

Referenced by ProjectionTreeLabels::computeProjectionTreeLabels(), removeRedundantRoles(), and removeSubtreeInclSelf().

ProjectionTreeNode * ProjectionTreeNode::getParent (  )  [inline]

Returns the parent node of a node.

Returns the parent node of a node, i.e. returns the member variable.

Return values:
ProjectionTreeNode Pointer to a ProjectionTreeNode object.

Definition at line 107 of file projectiontreenode.h.

References parent.

PathExpression * ProjectionTreeNode::getPath (  )  [inline]

void ProjectionTreeNode::getPathsFromRoot ( vector< PathExpression * > &  paths  ) 

Returns the collection of paths from the root node of the projection tree down to this node.

Returns the collection of paths from the root node of the projection tree down to this node. The passed vector is filled with pointers to the original paths, nothing must be deleted.

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

Definition at line 103 of file projectiontreenode.cpp.

References getPathsFromRoot(), parent, and path.

Referenced by getPathsFromRoot(), and getRootPath().

Role * ProjectionTreeNode::getRole (  )  [inline]

Returns the role of a node.

Returns the role of a node, i.e. returns the member variable.

Return values:
Role Pointer to a Role object.

Definition at line 132 of file projectiontreenode.h.

Referenced by TokenConfiguration::createRoleList(), removeSubtreeExclSelf(), and removeSubtreeInclSelf().

PathExpression * ProjectionTreeNode::getRootPath (  ) 

Returns the path from the root node of the projection tree to this node (including its own path).

Returns the path from the root node of the projection tree to this node (including its own path), Although NULL paths are ignore. The returned path is a fresh copy (with all path steps cloned) and must be deleted externally.

Return values:
PathExpression Pointer to a PathExpression object.

Definition at line 84 of file projectiontreenode.cpp.

References PathExpression::addPathStep(), PathStepExpression::clone(), getPathsFromRoot(), PathExpression::getPathSize(), PathExpression::getPathStepAt(), and PathExpression::isEmptyPath().

Referenced by registerToPassiveProjectionTree().

int ProjectionTreeNode::getVar (  )  [inline]

Returns the variable of a node.

Returns the variable of a node, to which this node referes to (-1 if none).

Return values:
int Variable to which this node referes to (-1 if none).

Definition at line 114 of file projectiontreenode.h.

Referenced by ProjectionTreeLabel::getAxisFollowingFSA(), ProjectionTreeLabel::getDependingVar(), ProjectionTreeLabel::locateVarAncestorLabel(), ProjectionTreeLabel::print(), and removeRedundantRoles().

bool ProjectionTreeNode::insertNode ( int  parent_var,
int  introduced_var,
PathExpression path,
bool  dep,
Role role,
bool  direct_output 
)

Inserts a new node into the projection tree.

Inserts a new node into the projection tree, which is appended as child of the first argument of this method.

Parameters:
[in] parent_var Parent node of a new node.
[in] introduced_var New node or variable respectively to be inserted.
[in] path Pointer to a PathExpression object.
[in] dep Indicator if this projection tree node derives from a dependency.
[in] role Pointer to a Role object.
[in] direct_output true if the associated for-loop directly produces output, false otherwise.
Return values:
bool true if the new node was successfully inserted, false otherwise.

Definition at line 54 of file projectiontreenode.cpp.

References children, ProjectionTreeNode(), and var.

Referenced by ProjectionTree::insertNode().

bool ProjectionTreeNode::isDepNode (  )  [inline]

Returns if this projection tree node derives from a dependency.

Returns if this projection tree node derives from a dependency.

Return values:
bool true if this projection tree node derives from a dependency, false otherwise.

Definition at line 179 of file projectiontreenode.h.

bool ProjectionTreeNode::isDosDepNode (  )  [inline]

Returns if this projection tree node derives from a dependency with a dos::node() PathStepExpression.

Returns if this projection tree node derives from a dependency with a dos::node() PathStepExpression.

Return values:
bool true if this projection tree node derives from a dependency with a dos::node() PathStepExpression, false otherwise.

Definition at line 199 of file projectiontreenode.h.

References Role::isDosRole().

Referenced by removeRedundantRoles().

bool ProjectionTreeNode::isPosDepNode (  )  [inline]

Returns if this projection tree node derives from a dependency with a [position()=1] PathStepAttributePosition.

Returns if this projection tree node derives from a dependency with a [position()=1] PathStepAttributePosition.

Return values:
bool true if this projection tree node derives from a dependency with a [position()=1] PathStepAttributePosition, false otherwise.

Definition at line 189 of file projectiontreenode.h.

References Role::isPosRole().

bool ProjectionTreeNode::isRoot (  )  [inline]

Returns if this projection tree node is the root node of the projection tree.

Returns if this projection tree node is the root node of the projection tree.

Return values:
bool true if this projection tree node is the root node of the projection tree, false otherwise.

Definition at line 169 of file projectiontreenode.h.

References parent.

Referenced by ProjectionTreeLabel::getTag(), and ProjectionTreeLabel::print().

void ProjectionTreeNode::print ( OutputStream dos,
unsigned  indents 
) [private]

Prints this single ProjectionTreeNode with whitespace indenting.

Prints this single ProjectionTreeNode with whitespace indenting.

Parameters:
[in] dos Pointer to a OutputStream object.
[in] indents Number of whitespaces to put before output or of a ProjectionTreeNode respectively.
Return values:
void 

Definition at line 187 of file projectiontreenode.cpp.

References children, direct_output, Role::getBasingVar(), Role::getId(), VarName::getInstance(), Role::getType(), VarName::getVarname(), incrementIndents(), NEWLINE, path, resetIndents(), role, var, and writeIndents().

void ProjectionTreeNode::print ( OutputStream dos  ) 

Prints this single ProjectionTreeNode.

Prints this single ProjectionTreeNode.

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

Definition at line 79 of file projectiontreenode.cpp.

References resetIndents().

Referenced by ProjectionTree::print().

void ProjectionTreeNode::registerToPassiveProjectionTree ( PassiveProjectionTree ppt  ) 

Registers a projection tree node to the passive projection tree.

Registers a projection tree node to the passive projection tree. This method is called whenever a projection tree node is deleted.

Parameters:
[in] ppt Pointer to a PassiveProjectionTree object (to register dropped nodes).
Return values:
void 

Definition at line 180 of file projectiontreenode.cpp.

References getRootPath(), and PassiveProjectionTree::registerPath().

Referenced by removeSubtreeInclSelf().

void ProjectionTreeNode::removeRedundantRoles ( PassiveProjectionTree ppt  ) 

Removes/Deletes all redundant roles/nodes of the projection tree.

Removes/Deletes all redundant roles/nodes of the projection tree.

Parameters:
[in] ppt Pointer to a PassiveProjectionTree object (to register dropped nodes).
Return values:
void 

Definition at line 129 of file projectiontreenode.cpp.

References children, dep, direct_output, getChildren(), PathExpression::getPathSize(), PathExpression::getTailPathStep(), getVar(), isDosDepNode(), PathStepExpression::isDosNodeStep(), parent, path, setRedundantRoleSelf(), and TAGID_ROOT.

Referenced by ProjectionTree::removeRedundantRoles().

void ProjectionTreeNode::removeSubtreeExclSelf ( PassiveProjectionTree ppt  )  [private]

Removes/Deletes a subtree (excluding the calling node itself) from a projection tree node on.

Removes/Deletes a subtree (excluding the calling node itself) from a projection tree node on.

Parameters:
[in] ppt Pointer to a PassiveProjectionTree object (to register dropped nodes).
Return values:
void 

Definition at line 258 of file projectiontreenode.cpp.

References children, RoleList::getInstance(), getRole(), and RoleList::removeRole().

Referenced by removeSubtreeInclSelf().

void ProjectionTreeNode::removeSubtreeInclSelf ( PassiveProjectionTree ppt  )  [private]

Removes/Deletes a subtree (including the calling node itself) from a projection tree node on.

Removes/Deletes a subtree (including the calling node itself) from a projection tree node on.

Parameters:
[in] ppt Pointer to a PassiveProjectionTree object (to register dropped nodes).
Return values:
void 

Definition at line 234 of file projectiontreenode.cpp.

References getChildren(), RoleList::getInstance(), getRole(), parent, registerToPassiveProjectionTree(), RoleList::removeRole(), removeSubtreeExclSelf(), and role.

void ProjectionTreeNode::removeUnneededNodes ( PassiveProjectionTree ppt  ) 

Removes/Deletes all unneeded nodes of the projection tree.

Removes/Deletes all unneeded nodes of the projection tree.

Parameters:
[in] ppt Pointer to a PassiveProjectionTree object (to register dropped nodes).
Return values:
void 

Definition at line 110 of file projectiontreenode.cpp.

References children, getPath(), and PathExpression::hasInnerTextNodeTest().

Referenced by ProjectionTree::removeUnneededNodes().

void ProjectionTreeNode::setRedundantRoleSelf (  )  [private]

Sets a role of a projection tree as redundant.

Sets a role of a projection tree as redundant, i.e. deletes this Role.

Return values:
void 

Definition at line 274 of file projectiontreenode.cpp.

References RoleList::getInstance(), and role.

Referenced by removeRedundantRoles().


Member Data Documentation

bool ProjectionTreeNode::dep [private]

The entered indicator if this projection tree node derives from a dependency.

The entered indicator if this projection tree node derives from a dependency, which is the fourth argument of the constructor.

Definition at line 294 of file projectiontreenode.h.

Referenced by removeRedundantRoles().

The entered indicator if the associated for-loop of a node directly produces output.

The entered indicator if the associated for-loop of a node directly produces output such as node construct or constant string output.

Definition at line 313 of file projectiontreenode.h.

Referenced by print(), and removeRedundantRoles().

The entered ProjectionTreeNode (parent node).

The entered ProjectionTreeNode (parent node), which is the first argument of the constructor.

Definition at line 274 of file projectiontreenode.h.

Referenced by getParent(), getPathsFromRoot(), isRoot(), removeRedundantRoles(), and removeSubtreeInclSelf().

The entered path.

The entered path, which is the third argument of the constructor.

Definition at line 287 of file projectiontreenode.h.

Referenced by getPathsFromRoot(), print(), and removeRedundantRoles().

The entered role.

The entered role, which is the fifth argument of the constructor.

Definition at line 300 of file projectiontreenode.h.

Referenced by print(), removeSubtreeInclSelf(), and setRedundantRoleSelf().

int ProjectionTreeNode::var [private]

The entered variable to which the projection tree node referes to (-1 if none).

The entered variable to which the projection tree node referes to (-1 if none), which is the second argument of the constructor.

Definition at line 281 of file projectiontreenode.h.

Referenced by insertNode(), and print().


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