OpenWalnut
1.5.0dev
|
A node in a tree, holding an index, a level in the tree and pointers to its child nodes. More...
#include <WTreeNode.h>
Public Types | |
typedef std::shared_ptr< WTreeNode > | SPtr |
Shared pointer abbreviation. More... | |
Public Member Functions | |
WTreeNode (size_t index, double level) | |
Constructs a new TreeNode. More... | |
WTreeNode (const WDendrogram &dendrogram) | |
Constructs a tree of WTreeNodes from a WDendrogram with this WTreeNode as root. More... | |
~WTreeNode () | |
Default destructor. More... | |
void | addChild (WTreeNode::SPtr child) |
Adds a childnode to this node. More... | |
size_t | index () |
Returns the index of the TreeNode. More... | |
double | level () |
Returns the level of the TreeNode. More... | |
std::vector< WTreeNode::SPtr > | getChildren () |
Returns the child nodes of this node. More... | |
WTreeNode::SPtr | getParent () |
Returns the parent node of this node. More... | |
Private Attributes | |
std::vector< WTreeNode::SPtr > | m_children |
Stores the childnodes of this node. More... | |
double | m_level |
Stores the level of this node. More... | |
size_t | m_index |
Stores the index of this node. More... | |
WTreeNode::SPtr | m_parent |
Stores the parent node. More... | |
A node in a tree, holding an index, a level in the tree and pointers to its child nodes.
Definition at line 38 of file WTreeNode.h.
typedef std::shared_ptr< WTreeNode > WTreeNode::SPtr |
Shared pointer abbreviation.
Definition at line 44 of file WTreeNode.h.
WTreeNode::WTreeNode | ( | size_t | index, |
double | level | ||
) |
Constructs a new TreeNode.
index | the index of the new Node. |
level | the level of the Node in the Tree |
Definition at line 32 of file WTreeNode.cpp.
Referenced by WTreeNode().
|
explicit |
Constructs a tree of WTreeNodes from a WDendrogram with this WTreeNode as root.
dendrogram | Reference to the dendrogram to construct the tree from |
Definition at line 39 of file WTreeNode.cpp.
References WDendrogram::getHeights(), WDendrogram::getParents(), index(), m_children, m_index, m_level, and WTreeNode().
WTreeNode::~WTreeNode | ( | ) |
Default destructor.
Definition at line 74 of file WTreeNode.cpp.
void WTreeNode::addChild | ( | WTreeNode::SPtr | child | ) |
Adds a childnode to this node.
child | the child node to add |
Definition at line 88 of file WTreeNode.cpp.
References m_children.
std::vector< WTreeNode::SPtr > WTreeNode::getChildren | ( | ) |
Returns the child nodes of this node.
Definition at line 99 of file WTreeNode.cpp.
References m_children.
WTreeNode::SPtr WTreeNode::getParent | ( | ) |
Returns the parent node of this node.
Definition at line 94 of file WTreeNode.cpp.
References m_parent.
size_t WTreeNode::index | ( | ) |
Returns the index of the TreeNode.
Definition at line 83 of file WTreeNode.cpp.
References m_index.
Referenced by WTreeNode().
double WTreeNode::level | ( | ) |
Returns the level of the TreeNode.
All level-0-nodes are leaves.
Definition at line 78 of file WTreeNode.cpp.
References m_level.
|
private |
Stores the childnodes of this node.
Definition at line 105 of file WTreeNode.h.
Referenced by addChild(), getChildren(), and WTreeNode().
|
private |
Stores the index of this node.
Definition at line 115 of file WTreeNode.h.
Referenced by index(), and WTreeNode().
|
private |
Stores the level of this node.
Definition at line 110 of file WTreeNode.h.
Referenced by level(), and WTreeNode().
|
private |