Defines tree nodes.
More...
#include <tree.hpp>
template<typename T = char>
class Node< T >
Defines tree nodes.
Class for nodes of a tree. A Node store a tag and can have several children
Class for nodes of a TreeString. A Node store a letter and can have several children.
template<typename T = char>
Copy constructor
- Parameters
-
template<typename T = char>
Simple constructor
- Parameters
-
[in] | data | to store into the Node |
template<typename T = char>
template<typename T = char>
Copy constructor
- Parameters
-
template<typename T = char>
Node< T >::Node |
( |
char |
data, |
|
|
int |
frequency |
|
) |
| |
Simple constructor
- Parameters
-
[in] | data | to store into the Node |
[in] | end | is it the last letter of a word ? |
template<typename T = char>
template<typename T = char>
template<typename T = char>
void Node< T >::append |
( |
T |
n_data | ) |
|
Hook up a new child to the node
- Parameters
-
[in] | n_data | new data to store as a child of the node |
template<typename T = char>
Node* Node< T >::append |
( |
const char |
n_data, |
|
|
int |
frequency |
|
) |
| |
Hook up a new child to the node
- Parameters
-
[in] | n_data | new data to store as a child of the node |
[in] | frequency | if greater than 0, end of a word. |
[out] | newchild | return the adress of the new child created |
template<typename T = char>
bool Node< T >::contains |
( |
T |
element | ) |
|
Do the tag is element or one of his children ?
- Parameters
-
[in] | element | Element to look for |
[out] | bool | True if node or one of his child has the right tag, else false. |
template<typename T = char>
What is the tag of the Node ?
- Parameters
-
[out] | tag | The tag of the node |
template<typename T = char>
char Node< T >::getTag |
( |
| ) |
|
What is the tag of the Node ?
- Parameters
-
[out] | tag | The tag of the node |
template<typename T = char>
int Node< T >::height |
( |
| ) |
|
The height of the node
- Parameters
-
[out] | hgt | height of the node |
template<typename T = char>
int Node< T >::height |
( |
| ) |
|
The height of the node
- Parameters
-
[out] | hgt | height of the node |
template<typename T = char>
bool Node< T >::isLeaf |
( |
| ) |
|
Is the node a leaf ?
- Parameters
-
[out] | bool | true, if no child, else false |
template<typename T = char>
bool Node< T >::isLeaf |
( |
| ) |
|
Is the node a leaf ?
- Parameters
-
[out] | bool | true, if no child, else false |
template<typename T = char>
bool Node< T >::operator!= |
( |
const Node< T > & |
rhs | ) |
|
inequality operator
- Parameters
-
[in] | lhs | first node to compare |
[in] | rhs | second node to compare |
[out] | bool | true if nodes have not the same memory adress, else false |
template<typename T = char>
bool Node< T >::operator!= |
( |
const Node< T > & |
rhs | ) |
|
inequality operator
- Parameters
-
[in] | lhs | first node to compare |
[in] | rhs | second node to compare |
[out] | bool | true if nodes have not the same memory adress, else false |
template<typename T = char>
assignment operator overload
- Parameters
-
[in] | other | node to assign |
[out] | note | assigned node |
template<typename T = char>
assignment operator overload
- Parameters
-
[in] | other | node to assign |
[out] | note | assigned node |
template<typename T = char>
bool Node< T >::operator== |
( |
const Node< T > & |
rhs | ) |
|
equality operator
- Parameters
-
[in] | lhs | left hand side, first node to compare |
[in] | rhs | right hand side, second node to compare |
[out] | bool | true if nodes have the same memory adress, else false |
template<typename T = char>
bool Node< T >::operator== |
( |
const Node< T > & |
rhs | ) |
|
equality operator
- Parameters
-
[in] | lhs | left hand side, first node to compare |
[in] | rhs | right hand side, second node to compare |
[out] | bool | true if nodes have the same memory adress, else false |
template<typename T = char>
void Node< T >::remove |
( |
T |
data | ) |
|
Remove a leaf from the node
- Parameters
-
[in] | data | data of the node's tag to remove |
- Exceptions
-
template<typename T = char>
void Node< T >::toFrequencedList |
( |
forward_list< pair< string, int >> & |
words, |
|
|
string |
word |
|
) |
| |
Put each word in a list
- Parameters
-
[in] | words | List containing all words and his frequency in pairs |
[in] | string | wordCom Word which is currently reconvene |
template<typename T = char>
void Node< T >::toList |
( |
forward_list< string > & |
words, |
|
|
string |
word |
|
) |
| |
Put each words in a list
- Parameters
-
[in] | words | List containing all words |
[in] | string | wordCom Word which is currently reconvene |
template<typename T = char>
string Node< T >::toString |
( |
| ) |
|
Get a string representation of the node and his child
- Parameters
-
[out] | desc | Description of the node (and his child) |
template<typename T = char>
string Node< T >::toString |
( |
| ) |
|
Get a string representation of the node and his child
- Parameters
-
[out] | desc | Description of the node (and his child) |
template<typename T = char>
template<typename T = char>
forward_list<Node<T> > Node< T >::_children |
|
private |
template<typename T = char>
forward_list<Node*> Node< T >::_children |
|
private |
template<typename T = char>
letter stored into Node, the tag
template<typename T = char>
letter stored into Node, the tag
template<typename T = char>
int Node< T >::_wordFrequency |
|
private |
the end of a word and his frequency if _wordFrequency > 0, it's a word end
The documentation for this class was generated from the following files: