|
Natural Language Processing
0.1.0
|
The Tree class a class to contain a TreeNode*. More...
#include <Tree.h>
Public Member Functions | |
| Tree () | |
| Tree Default Constructor. | |
| Tree (TreeNode< Item > *root) | |
| Tree Constructor. More... | |
| Tree (const Tree< Item > &T) | |
| Tree Copy Constructor. More... | |
| ~Tree () | |
| ~Tree Destructor | |
| Tree< Item > & | operator= (const Tree< Item > &T) |
| operator = assignment operator More... | |
| void | addHere (const Item &item) |
| addHere Adds an item as a child to the current node More... | |
| void | addNode (TreeNode< Item > *parent, const Item &item) |
| addNode Adds an item as a child to the parent More... | |
| TreeNode< Item > * | search (const Item &item) |
| search searches for a specific item More... | |
| bool | inTree (TreeNode< Item > *node) |
| inTree Checks if the node is part of the tree More... | |
| bool | empty () const |
| empty Checks if the tree is empty More... | |
| void | clear () |
| clear Clears the tree | |
| std::size_t | leafNum () |
| leafNum Counts the number of leaves in the tree More... | |
| TreeNode< Item > * | getParent (TreeNode< Item > *branch) |
| getParent Gets the parent of the branch More... | |
| TreeNode< Item > * | getCurrent () |
| getCurrent Returns the current node pointer More... | |
| void | set (const Item &item) |
| set Set the item of the current node More... | |
| void | shiftToRoot () |
| shiftToRoot shift the current to the root | |
| void | shiftUp () |
| shiftUp Shift the current to its parent | |
| void | shiftDown (std::size_t child) |
| shiftDown Shift the current to one of its children More... | |
| void | shiftTo (TreeNode< Item > *target) |
| shiftTo Shift the current to the specified target More... | |
| bool | hasParent () |
| hasParent Checks if current has a parent More... | |
| bool | hasChild () |
| hasChild Checks if current has children More... | |
| std::size_t | childNum () |
| childNum Finds the number of children of current More... | |
| Item & | get () |
| get Returns the item of current More... | |
| std::size_t | size () const |
| size Returns the size of the tree More... | |
| std::vector< TreeNode< Item > * > | getLeaves () |
| getLeaves Returns a vector of the leaves of the tree More... | |
Protected Attributes | |
| TreeNode< Item > * | _root |
| _root the root of the tree | |
| TreeNode< Item > * | _current |
| _current the treenode in which many operations are performed. Can be changed via shift functions | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Tree< Item > T) |
| operator << insertion More... | |
The Tree class a class to contain a TreeNode*.
Tree Constructor.
| root | Sets the root to this root NOTE: Does not copy the root |
|
inline |
addHere Adds an item as a child to the current node
| item | the item to add |
|
inline |
addNode Adds an item as a child to the parent
| parent | the parent |
| item | the item |
|
inline |
childNum Finds the number of children of current
|
inline |
empty Checks if the tree is empty
|
inline |
get Returns the item of current
getCurrent Returns the current node pointer
getLeaves Returns a vector of the leaves of the tree
getParent Gets the parent of the branch
| branch | the branch |
|
inline |
hasChild Checks if current has children
|
inline |
hasParent Checks if current has a parent
inTree Checks if the node is part of the tree
| node | the node |
|
inline |
leafNum Counts the number of leaves in the tree
search searches for a specific item
| item | the target |
|
inline |
set Set the item of the current node
| item | the item |
|
inline |
shiftDown Shift the current to one of its children
| child | the child to shift to NOTE: Does not change current if the child does not exist |
shiftTo Shift the current to the specified target
| target | the target NOTE: Does not change current if the target is not part of the tree |
|
inline |
size Returns the size of the tree
|
friend |
1.8.6