Base Framework
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
BinaryTree< TYPE > Class Template Reference

Binary tree. More...

#include <base/collection/BinaryTree.h>

Inherits Collection.

Inherited by OrderedBinaryTree< TYPE, KEY > [protected].

Classes

class  BinaryTreeImpl
 

Public Types

typedef TYPE Value
 
typedef BinaryNode< TYPE > Node
 
typedef PrefixOrderEnumerator< EnumeratorTraits< Node > > Enumerator
 
typedef PrefixOrderEnumerator< ReadEnumeratorTraits< Node > > ReadEnumerator
 
typedef PrefixOrderIterator< ReadIteratorTraits< Node > > ReadIterator
 

Public Member Functions

 BinaryTree ()
 
 BinaryTree (const BinaryTree &copy) noexcept
 
BinaryTreeoperator= (const BinaryTree &copy) noexcept
 
bool isEmpty () const noexcept
 
NodegetRoot ()
 
const NodegetRoot () const noexcept
 
Enumerator getEnumerator () noexcept
 
ReadEnumerator getReadEnumerator () const noexcept
 
void setRoot (Node *node)
 
void removeAll ()
 

Protected Attributes

Reference< BinaryTreeImplelements
 

Detailed Description

template<class TYPE>
class BinaryTree< TYPE >

Binary tree.

Binary tree data structure.

Member Typedef Documentation

◆ Node

template<class TYPE >
typedef BinaryNode<TYPE> BinaryTree< TYPE >::Node

The type of a node.

◆ Value

template<class TYPE >
typedef TYPE BinaryTree< TYPE >::Value

The type of the value.

Constructor & Destructor Documentation

◆ BinaryTree() [1/2]

template<class TYPE >
BinaryTree< TYPE >::BinaryTree ( )
inline

Initializes an empty binary tree.

◆ BinaryTree() [2/2]

template<class TYPE >
BinaryTree< TYPE >::BinaryTree ( const BinaryTree< TYPE > &  copy)
inlinenoexcept

Initializes binary tree from other binary tree.

Member Function Documentation

◆ getEnumerator()

template<class TYPE >
Enumerator BinaryTree< TYPE >::getEnumerator ( )
inlinenoexcept

Returns a modifying enumerator of the binary tree.

◆ getReadEnumerator()

template<class TYPE >
ReadEnumerator BinaryTree< TYPE >::getReadEnumerator ( ) const
inlinenoexcept

Returns a non-modifying enumerator of the binary tree.

◆ getRoot() [1/2]

template<class TYPE >
Node* BinaryTree< TYPE >::getRoot ( )
inline

Returns the root node of the binary tree for modifying access.

◆ getRoot() [2/2]

template<class TYPE >
const Node* BinaryTree< TYPE >::getRoot ( ) const
inlinenoexcept

Returns the root node of the binary tree for non-modifying access.

◆ isEmpty()

template<class TYPE >
bool BinaryTree< TYPE >::isEmpty ( ) const
inlinenoexcept

Returns true if the tree has a root node.

◆ operator=()

template<class TYPE >
BinaryTree& BinaryTree< TYPE >::operator= ( const BinaryTree< TYPE > &  copy)
inlinenoexcept

Assignment of binary tree to binary tree.

◆ removeAll()

template<class TYPE >
void BinaryTree< TYPE >::removeAll ( )
inline

Removes all the nodes from the binary tree.

◆ setRoot()

template<class TYPE >
void BinaryTree< TYPE >::setRoot ( Node node)
inline

Sets the binary tree.

Parameters
nodeThe root of the tree.

Member Data Documentation

◆ elements

template<class TYPE >
Reference<BinaryTreeImpl> BinaryTree< TYPE >::elements
protected

The elements of the binary tree.