#include <projectiontreenode.h>
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. | |
ProjectionTreeNode * | getParent () |
Returns the parent node of a node. | |
int | getVar () |
Returns the variable of a node. | |
PathExpression * | getPath () |
Returns the path of a node. | |
Role * | getRole () |
Returns the role of a node. | |
vector< ProjectionTreeNode * > * | getChildren () |
Returns all children of a node. | |
PathExpression * | getRootPath () |
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 | |
ProjectionTreeNode * | parent |
The entered ProjectionTreeNode (parent node). | |
int | var |
The entered variable to which the projection tree node referes to (-1 if none). | |
PathExpression * | path |
The entered path. | |
bool | dep |
The entered indicator if this projection tree node derives from a dependency. | |
Role * | role |
The entered role. | |
vector< ProjectionTreeNode * > | children |
bool | direct_output |
The entered indicator if the associated for-loop of a node directly produces output. |
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.
Definition at line 54 of file projectiontreenode.h.
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.
[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] |
void ProjectionTreeNode::clearChildren | ( | ) | [inline] |
Removes/Deletes all children of this projection tree node.
Removes/Deletes all children of this projection tree node.
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.
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.
ProjectionTreeNode | Pointer to a ProjectionTreeNode object. |
Definition at line 107 of file projectiontreenode.h.
References parent.
PathExpression * ProjectionTreeNode::getPath | ( | ) | [inline] |
Returns the path of a node.
Returns the path of a node, i.e. returns the member variable.
PathExpression | Pointer to a PathExpression object. |
Definition at line 123 of file projectiontreenode.h.
Referenced by ProjectionTreeLabel::atEndOfPath(), ProjectionTreeLabels::computeProjectionTreeLabels(), ProjectionTreeLabel::getPath(), ProjectionTreeLabel::getPathStep(), ProjectionTreeLabel::isChildLabel(), ProjectionTreeLabel::isChildOrDescendantLabel(), ProjectionTreeLabel::isDescendantLabel(), ProjectionTreeLabel::isDosLabel(), ProjectionTreeLabel::isDosNodeLabel(), ProjectionTreeLabel::isDosOrDescendantLabel(), ProjectionTreeLabel::isNodeLabel(), ProjectionTreeLabel::isStarLabel(), ProjectionTreeLabel::matchesTag(), ProjectionTreeLabel::matchesText(), ProjectionTreeLabel::print(), and removeUnneededNodes().
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.
[in,out] | paths | Pointer to a vector containing Pointer to PathExpression objects. |
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.
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.
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).
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.
[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. |
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.
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.
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.
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.
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.
[in] | dos | Pointer to a OutputStream object. |
[in] | indents | Number of whitespaces to put before output or of a ProjectionTreeNode respectively. |
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.
[in] | dos | Pointer to a OutputStream object. |
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.
[in] | ppt | Pointer to a PassiveProjectionTree object (to register dropped nodes). |
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.
[in] | ppt | Pointer to a PassiveProjectionTree object (to register dropped nodes). |
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.
[in] | ppt | Pointer to a PassiveProjectionTree object (to register dropped nodes). |
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.
[in] | ppt | Pointer to a PassiveProjectionTree object (to register dropped nodes). |
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.
[in] | ppt | Pointer to a PassiveProjectionTree object (to register dropped nodes). |
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.
void |
Definition at line 274 of file projectiontreenode.cpp.
References RoleList::getInstance(), and role.
Referenced by removeRedundantRoles().
vector< ProjectionTreeNode * > ProjectionTreeNode::children [private] |
All child nodes of a ProjectionTreeNode.
Definition at line 306 of file projectiontreenode.h.
Referenced by clearChildren(), getChildren(), insertNode(), print(), removeRedundantRoles(), removeSubtreeExclSelf(), removeUnneededNodes(), and ~ProjectionTreeNode().
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().
bool ProjectionTreeNode::direct_output [private] |
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().
ProjectionTreeNode * ProjectionTreeNode::parent [private] |
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().
PathExpression * ProjectionTreeNode::path [private] |
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().
Role * ProjectionTreeNode::role [private] |
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().