|
SubcloneSeeker
1.0.0
Subclone deconvolution software framework
|
Base class for any object that can seve as a tree node. More...
#include <TreeNode.h>
Public Member Functions | |
| TreeNode () | |
| virtual | ~TreeNode () |
| TreeNodeVec_t & | getVecChildren () |
| TreeNode * | getParent () |
| void | addChild (TreeNode *child) |
| void | removeChild (TreeNode *child) |
| bool | isLeaf () const |
| bool | isRoot () const |
Static Public Member Functions | |
| static void | PreOrderTraverse (TreeNode *root, TreeTraverseDelegate &traverseDelegate) |
| static void | PostOrderTraverse (TreeNode *root, TreeTraverseDelegate &traverseDelegate) |
Protected Attributes | |
| TreeNodeVec_t | children |
| TreeNode * | parent |
Friends | |
| class | TreeTraverseDelegate |
Base class for any object that can seve as a tree node.
This class implements the basic tree operations, such as adding and removing children nodes, checking whether self is a root or a leaf, etc. It also implements, as class method, two basic traversing algorithm: . PreOrderTraverse . PostOrderTraverse Since the tree is not required to be binary, InOrder traverse makes little sense.
|
inline |
minimal constructor, reset all member variables
|
inlinevirtual |
declaring destructor to be virtual
| void TreeNode::addChild | ( | TreeNode * | child | ) |
append a given node to this node's children list
| child | A pointer to the node which which will be added as a child |
|
inline |
returns the node's parent.
|
inline |
returns a reference to the children vector
|
inline |
whether the node is a leaf node
|
inline |
whether the node is a root node
|
static |
Post-Order traverse algorithm
This method process the root node first, then all the children nodes (recursively), The actual action performed on the nodes are defined by the TreeTraverseDelegate object
| root | The root node of the (sub)tree the traversing takes place |
| traverseDelegate | An TreeTraverseDelegate object which defines the action performed on nodes |
|
static |
Pre-Order traverse algorithm
This method process all the children nodes first (recursively), and then process the root. The actual action performed on the nodes are defined by the TreeTraverseDelegate object
| root | The root node of the (sub)tree the traversing takes place |
| traverseDelegate | An TreeTraverseDelegate object which defines the action performed on nodes |
| void TreeNode::removeChild | ( | TreeNode * | child | ) |
remove a child of this node
| child | A pointer to the children node to be removed |
|
protected |
children node list
|
protected |
parent node