Template Class Tree
Defined in File Tree.h
Class Documentation
-
template<class T>
class Tree an ordered tree, with pointers to parent, first child and next sibling
Public Functions
-
~Tree()
destroys the subtrees of the children, i.e., the whole tree, with a stack of its own rather than by recursion
-
void insertChild(Tree *t)
inserts the tree t as the first child of this node, which then owns it
- Pre:
t is a root, not this node nor the root of its tree (which would make a cycle)
- Post:
t is the first child
-
void insertSibling(Tree *t)
inserts the tree t as the next sibling of this node, which must not be a root; the parent of this node then owns t
- Pre:
t is a root, and this node is not; t is not the root of the tree of this node (which would make a cycle)
- Post:
t is the next sibling
-
bool isLeaf(void) const
true if the node has no child (FOGLIA)
-
bool isLastSibling(void) const
true if the node has no next sibling (ULTIMOFRATELLO)
-
void deleteChild(void)
destroys the subtree rooted in the first child
-
void deleteSibling(void)
destroys the subtree rooted in the next sibling
-
~Tree()