#include <node.h>
Inheritance diagram for Node:
Public Types | |
typedef _TContent | value_type |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef NodeIterator< Node< value_type > > | iterator |
typedef NodeIterator< const Node< value_type > > | const_iterator |
typedef AllNodeIterator< Node< value_type > > | all_iterator |
typedef AllNodeIterator< const Node< value_type > > | const_all_iterator |
typedef PostOrderNodeIterator< Node< value_type > > | post_iterator |
typedef PostOrderNodeIterator< const Node< value_type > > | const_post_iterator |
typedef VariableNodeIterator< Node< value_type > > | var_iterator |
typedef VariableNodeIterator< const Node< value_type > > | const_var_iterator |
typedef LeaveIterator< Node< value_type > > | leave_iterator |
typedef LeaveIterator< const Node< value_type > > | const_leave_iterator |
typedef size_t | size_type |
typedef ptrdiff_t | difference_type |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Methods | |
Node () | |
Node (const Node< _TContent > &node) | |
Copy Constructor. | |
Node (const _TContent &content) | |
virtual | ~Node () |
Destructor. | |
virtual Node * | construct () const=0 |
virtual Node * | cloneTree () const=0 |
virtual Node * | cloneNode () const=0 |
virtual Node< _TContent > * | getParent () |
Get the parent of this node. | |
virtual const Node< _TContent > * | getParent () const |
virtual Node< _TContent > * | getRoot () |
Get the enclosing (sub-)trees root. | |
virtual const Node< _TContent > * | getRoot () const |
virtual Node< _TContent > * | getLeftSibling () |
Get the left neighbor (or sister) of this node. | |
virtual const Node< _TContent > * | getLeftSibling () const |
virtual Node< _TContent > * | getRightSibling () |
Get the right neighbor (or sister) of this node. | |
virtual const Node< _TContent > * | getRightSibling () const |
virtual const std::list< Node< _TContent > * > * | getChildren () const |
Get a list of children of this node. | |
virtual const std::list< Node * > * | getLeaves () const |
Get a list of leaves of this node. | |
virtual size_type | getNumChildren () const |
Get the number of direct children of this node. | |
virtual size_type | getNumDescendants () const |
Get the number of descendants of this node. | |
virtual int | getDepth () const |
Get the maximal depth of the tree. | |
virtual std::string | getName () const |
Get the name of the node. | |
virtual bool | isFixed () const |
Return fixed state. | |
virtual void | recalcLeaves () |
Update the list of leaves of this node Does nothing for NormalNodes. | |
virtual void | setFixed (bool b) |
Make the node fixed. | |
virtual void | setName (std::string name) |
Set the name of the node. | |
virtual iterator | begin () |
Get a STL conform iterator to traverse the tree structure beginning with this node (nodes of subtrees n o t included). | |
virtual const_iterator | begin () const |
virtual iterator | end () |
Get the 'past the end' iterator. | |
virtual const_iterator | end () const |
virtual all_iterator | beginAll () |
Get an STL conform iterator to traverse the tree structure beginning with this node (nodes of subtrees included). | |
virtual const_all_iterator | beginAll () const |
virtual const_all_iterator | beginAllConst () const |
don't have a glue why the compiler doesn't pick the right const function, so here is an explicit call to get the const iterator | |
virtual all_iterator | endAll () |
Get the 'past the end' iterator. | |
virtual const_all_iterator | endAll () const |
virtual bool | addChildFront (Node *node) |
Add a pointer to a child to the node (insert in front). | |
virtual bool | addChildBack (Node *node) |
Add a pointer to a child node to the node (add to back). | |
virtual bool | addChild (Node *node) |
Add a pointer to a child node to the node (insert it where the last one was deleted). | |
virtual bool | addChild (Node *node, unsigned int index) |
Add a pointer to a child to the node (insert it at position index) + index 0: push_front + index > number of children: push_back. | |
virtual bool | addChild (Node *node, typename std::list< Node * >::iterator &iter) |
Add a child to the node (insert it before the position the iterator points to). | |
virtual std::list< Node * > | deleteChild (Node *node) |
Delete a child from the node Returns a list of the children of the deleted node. | |
virtual bool | cutChild (Node *node) |
Delete a child from the node Doesn't delete the child. | |
virtual void | acceptVisitor (NodeVisitorBase< Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > > *visitor)=0 |
virtual void | acceptVisitor (NodeVisitorBase< const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > > *visitor) const=0 |
virtual void | reduce () |
Reduce connected fixed parts of the tree to RootNodes. | |
virtual pointer | getContent () |
virtual const_pointer | getContent () const |
virtual bool | isRootNode () const |
Return true is the node is a RootNode This method is nescessary to distinguisch normal and super nodes inside node. | |
Protected Types | |
typedef std::map< const Node< _TContent > *, Node< _TContent > * > | OldNewMap |
Protected Methods | |
virtual Node * | copy (OldNewMap &nodeMap) const=0 |
virtual void | linkSiblings () |
Sets the sibling links of node's children right. | |
virtual void | setParent (Node *node) |
Set the nodes parent. | |
virtual void | deleteParent () |
Delete the nodes parent. | |
virtual void | disconnectChildren () |
Delete references to the nodes children. | |
virtual void | setProtected (bool) |
Set true to make the RootNode a unit in the enclosing tree Does nothing for NormalNodes. | |
virtual bool | isProtected () const |
Returns protection state. | |
virtual bool | isInner () const |
Check if the node is inner node of a protected tree. | |
Protected Attributes | |
Node * | m_parent |
tree layout | |
Node * | m_root |
tree layout | |
Node * | m_right_sibling |
tree layout | |
Node * | m_left_sibling |
tree layout | |
std::list< Node< _TContent > * > | m_children |
tree layout | |
_TContent * | m_content |
node configuration | |
bool | m_protected |
node configuration | |
bool | m_fixed |
node configuration : if m_fixed is true, connection to parent node cannot be removed | |
std::string | m_name |
node configuration | |
std::list< Node * >::iterator | m_repairIter |
this iterator points after every delete action to the child in front of which was deleted so its possible to use insert to repair | |
Friends | |
class | NormalNode< _TContent > |
class | RootNode< _TContent > |
Together with NormalNode and RootNode it implements the 'composite pattern' in an extended way, which means that any node could be a leave.
RootNodes are used as the root of a tree. Trees constructed in this way are recognized as a unit after insertion into another tree. NormalNodes are the basic parts of the tree.
Applicationspecific content of the node is added by the template-parameter _TContent (which must have a public constructor, destructor and copy-constructor).
For copying trees use the function cloneTree(), which gives back a pointer to the copied tree. The assignement operator is only the default version and should _never be used_. It only makes a copy of the data in the copied class, but doesn't copy, what the pointer point to. The Copy Contructor is made protected, so that it cannot be used.
Definition at line 82 of file node.h.
|
Definition at line 94 of file node.h. Referenced by Node< value_type >::endAll(). |
|
Definition at line 95 of file node.h. Referenced by Node< value_type >::endAll(), and Node::getDepth(). |
|
Definition at line 93 of file node.h. Referenced by Node< value_type >::begin(), and Node< value_type >::end(). |
|
|
|
Reimplemented in NormalNode, and RootNode. Definition at line 90 of file node.h. Referenced by Node< value_type >::getContent(). |
|
|
|
Reimplemented in NormalNode, and RootNode. |
|
|
|
|
|
Reimplemented in NormalNode, and RootNode. |
|
Definition at line 92 of file node.h. Referenced by Node< value_type >::begin(), Node< value_type >::end(), and Node::setParent(). |
|
|
|
Reimplemented in NormalNode, and RootNode. |
|
Reimplemented in NormalNode, and RootNode. Definition at line 89 of file node.h. Referenced by Node< value_type >::getContent(). |
|
|
|
Reimplemented in NormalNode, and RootNode. |
|
|
|
Reimplemented in NormalNode, and RootNode. Definition at line 102 of file node.h. Referenced by Node< value_type >::getNumChildren(), and Node< value_type >::getNumDescendants(). |
|
Reimplemented in NormalNode, and RootNode. |
|
|
|
Definition at line 370 of file node.h. References Node::m_content. |
|
Copy Constructor. only content is a real copy. For parent, root and children only the pointer is copied. For a real copy use cloneTree() Definition at line 397 of file node.h. References Node::m_content. |
|
Definition at line 381 of file node.h. References Node::m_content. |
|
Destructor. Works recursivly. Definition at line 415 of file node.h. References Node::m_children, and Node::m_content. |
|
Implemented in NormalNode, and RootNode. |
|
Implemented in NormalNode, and RootNode. |
|
Add a child to the node (insert it before the position the iterator points to).
Definition at line 555 of file node.h. References Node::addChildBack(), Node::addChildFront(), Node::isInner(), Node::m_children, Node::m_left_sibling, Node::m_right_sibling, Node::recalcLeaves(), Node::setParent(), and Node::setProtected(). |
|
Add a pointer to a child to the node (insert it at position index) + index 0: push_front + index > number of children: push_back.
Definition at line 531 of file node.h. References Node::addChild(), Node::addChildBack(), Node::addChildFront(), Node::isInner(), and Node::m_children. |
|
Add a pointer to a child node to the node (insert it where the last one was deleted).
Definition at line 508 of file node.h. References Node::addChildBack(), Node::isInner(), and Node::m_repairIter. Referenced by Node::addChild(). |
|
Add a pointer to a child node to the node (add to back).
Definition at line 475 of file node.h. References Node::isInner(), Node::m_children, Node::m_left_sibling, Node::m_right_sibling, Node::recalcLeaves(), Node::setParent(), and Node::setProtected(). Referenced by Node::addChild(). |
|
Add a pointer to a child to the node (insert in front).
Definition at line 442 of file node.h. References Node::isInner(), Node::m_children, Node::m_left_sibling, Node::m_right_sibling, Node::recalcLeaves(), Node::setParent(), and Node::setProtected(). Referenced by Node::addChild(). |
|
|
|
Get a STL conform iterator to traverse the tree structure beginning with this node (nodes of subtrees n o t included).
Definition at line 161 of file node.h. Referenced by Node::setParent(). |
|
|
|
Get an STL conform iterator to traverse the tree structure beginning with this node (nodes of subtrees included).
Definition at line 169 of file node.h. Referenced by LayoutVisitor::calculatePosition(). |
|
don't have a glue why the compiler doesn't pick the right const function, so here is an explicit call to get the const iterator
|
|
Implemented in NormalNode, and RootNode. |
|
Implemented in NormalNode, and RootNode. |
|
Implemented in NormalNode, and RootNode. |
|
Implemented in NormalNode, and RootNode. |
|
Delete a child from the node Doesn't delete the child.
Definition at line 637 of file node.h. References Node::deleteParent(), Node::isFixed(), Node::m_children, Node::m_left_sibling, Node::m_repairIter, and Node::m_right_sibling. Referenced by Node::deleteChild(). |
|
Delete a child from the node Returns a list of the children of the deleted node. (the list is empty if node is fixed and therefore not deleted, or if the node was a leave)
Definition at line 604 of file node.h. References Node::cutChild(), Node::disconnectChildren(), Node::getLeaves(), Node::isRootNode(), and Node::m_children. |
|
Delete the nodes parent. This method is called if the node as child is removed. Reimplemented in RootNode. Definition at line 701 of file node.h. References Node::isRootNode(), Node::m_parent, and Node::m_root. Referenced by Node::cutChild(), and Node::setParent(). |
|
Delete references to the nodes children. This method is called if the node as child is removed. Definition at line 716 of file node.h. References Node::m_children. Referenced by Node::deleteChild(). |
|
|
|
Get the 'past the end' iterator.
Definition at line 164 of file node.h. Referenced by Node::setParent(). |
|
|
|
Get the 'past the end' iterator.
Definition at line 175 of file node.h. Referenced by LayoutVisitor::calculatePosition(). |
|
Get a list of children of this node.
Definition at line 132 of file node.h. Referenced by LayoutVisitor::calculatePosition(). |
|
|
|
|
|
Get the maximal depth of the tree.
Definition at line 428 of file node.h. References Node::const_all_iterator, and DepthVisitor::getDepth(). |
|
Get a list of leaves of this node. The list differs from the list obtained by 'getChildren()' only if the node is root of a (sub-) tree (= RootNode). Reimplemented in RootNode. Definition at line 136 of file node.h. Referenced by Node::deleteChild(), and Node::isInner(). |
|
|
|
Get the left neighbor (or sister) of this node.
|
|
Get the name of the node.
Definition at line 146 of file node.h. Referenced by TEXGraphOutputStrategy::writeFooter(), TEXGraphOutputStrategy::writeNormalNode(), DefaultOutputStrategy::writeNormalNode(), TEXGraphOutputStrategy::writeRootNode(), and DefaultOutputStrategy::writeRootNode(). |
|
Get the number of direct children of this node.
Definition at line 138 of file node.h. Referenced by DepthVisitor::measure(). |
|
Get the number of descendants of this node. The number differs from the number obtained by 'getNumChildren()' only if the node is root of a (sub-) tree (= RootNode). Reimplemented in RootNode. |
|
|
|
Get the parent of this node.
Definition at line 120 of file node.h. Referenced by LayoutVisitor::calculatePosition(), DepthVisitor::measure(), TEXGraphOutputStrategy::writeEdge(), and TEXGraphOutputStrategy::writeFooter(). |
|
|
|
Get the right neighbor (or sister) of this node.
|
|
|
|
Get the enclosing (sub-)trees root.
Definition at line 123 of file node.h. Referenced by Node::setParent(). |
|
Return fixed state.
Definition at line 148 of file node.h. Referenced by Node::cutChild(), and TEXGraphOutputStrategy::writeEdge(). |
|
Check if the node is inner node of a protected tree. Returns 'True' if yes, 'False' if not. Definition at line 584 of file node.h. References Node::getLeaves(), Node::isProtected(), and Node::m_root. Referenced by Node::addChild(), Node::addChildBack(), and Node::addChildFront(). |
|
Returns protection state.
Definition at line 214 of file node.h. Referenced by Node::isInner(), and Node::setParent(). |
|
Return true is the node is a RootNode This method is nescessary to distinguisch normal and super nodes inside node.
Reimplemented in RootNode. Definition at line 200 of file node.h. Referenced by Node::deleteChild(), Node::deleteParent(), and Node::setParent(). |
|
Sets the sibling links of node's children right.
Definition at line 733 of file node.h. References Node::m_children, and Node::m_left_sibling. Referenced by RootNode::cloneTree(), NormalNode::cloneTree(), RootNode::copy(), and NormalNode::copy(). |
|
Update the list of leaves of this node Does nothing for NormalNodes.
Reimplemented in RootNode. Definition at line 152 of file node.h. Referenced by Node::addChild(), Node::addChildBack(), and Node::addChildFront(). |
|
Reduce connected fixed parts of the tree to RootNodes.
|
|
Make the node fixed. Protect from deleting.
|
|
Set the name of the node.
|
|
Set the nodes parent. This method is called if the node is added as child.
Definition at line 668 of file node.h. References Node::begin(), Node::deleteParent(), Node::end(), Node::getRoot(), Node::isProtected(), Node::isRootNode(), Node::iterator, Node::m_parent, and Node::m_root. Referenced by Node::addChild(), Node::addChildBack(), and Node::addChildFront(). |
|
Set true to make the RootNode a unit in the enclosing tree Does nothing for NormalNodes.
Reimplemented in RootNode. Definition at line 212 of file node.h. Referenced by Node::addChild(), Node::addChildBack(), and Node::addChildFront(). |
|
|
|
|
|
tree layout
Definition at line 226 of file node.h. Referenced by Node::addChild(), Node::addChildBack(), Node::addChildFront(), RootNode::cloneTree(), NormalNode::cloneTree(), RootNode::copy(), NormalNode::copy(), Node::cutChild(), Node::deleteChild(), Node::disconnectChildren(), Node< value_type >::getChildren(), Node< value_type >::getLeaves(), Node< value_type >::getNumChildren(), Node< value_type >::getNumDescendants(), Node::linkSiblings(), and Node::~Node(). |
|
node configuration
Definition at line 229 of file node.h. Referenced by RootNode::cloneNode(), Node< value_type >::getContent(), Node::Node(), and Node::~Node(). |
|
node configuration : if m_fixed is true, connection to parent node cannot be removed
Definition at line 233 of file node.h. Referenced by Node< value_type >::isFixed(), and Node< value_type >::setFixed(). |
|
tree layout
Definition at line 224 of file node.h. Referenced by Node::addChild(), Node::addChildBack(), Node::addChildFront(), Node::cutChild(), Node< value_type >::getLeftSibling(), and Node::linkSiblings(). |
|
node configuration
Definition at line 235 of file node.h. Referenced by Node< value_type >::getName(), and Node< value_type >::setName(). |
|
tree layout
Definition at line 218 of file node.h. Referenced by RootNode::copy(), NormalNode::copy(), RootNode::deleteParent(), Node::deleteParent(), Node< value_type >::getParent(), and Node::setParent(). |
|
node configuration
Definition at line 231 of file node.h. Referenced by Node< value_type >::isProtected(), and RootNode::setProtected(). |
|
this iterator points after every delete action to the child in front of which was deleted so its possible to use insert to repair
Definition at line 240 of file node.h. Referenced by Node::addChild(), and Node::cutChild(). |
|
tree layout
Definition at line 222 of file node.h. Referenced by Node::addChild(), Node::addChildBack(), Node::addChildFront(), Node::cutChild(), and Node< value_type >::getRightSibling(). |
|
tree layout
Definition at line 220 of file node.h. Referenced by RootNode::cloneTree(), RootNode::copy(), NormalNode::copy(), RootNode::deleteParent(), Node::deleteParent(), Node< value_type >::getRoot(), Node::isInner(), RootNode::RootNode(), and Node::setParent(). |