DTree< T > Class Template Reference

Binary Tree used with LinAl Trees contain an item and up to two branches. More...

#include <DTree.h>


Public Member Functions

 DTree ()
 Default constructor.
 DTree (const DTree &)
 Copy constructor.
 DTree (const T &)
 Creates a tree whose object is provided.
 DTree (const T &, DTree *, DTree *)
 Creates a tree whose object is provided.
 ~DTree ()
 Destructor.Objects and branches are deleted.
DTreeoperator= (const DTree &)
bool operator== (const DTree &) const
 Tests for equality in the object and the branches.
bool operator!= (const DTree &tree) const
T const *const getItem () const
 Returns the DTree's object.
bool hasLeft () const
 Indicates existance of a Left Tree Node.
DTree getLeft () const
 Retrieves Left tree node.
bool hasRight () const
 Indicates existance of a Left Tree Node.
DTree getRight () const
 Retrieves Left tree node.
void setItem (T *o)
 Sets the item of the tree.
void setLeft (DTree *tree)
 Attaches a tree (via pointer) to the left branch.
void setRight (DTree *tree)
 Attaches a tree (via pointer) to the right branch.
bool isEmpty () const
 Indicates where or not the tree contains an item (regardless of branch count).
utils::DArray< T > decompose () const
 Returns a DArray<T> of all of the branches of the tree.
bool hasChildren () const
 Indicates whether there is a branch, regardless of which one it is.

Static Public Member Functions

static DString getVersion ()

Private Attributes

T * item
DTreeleftNode
DTreerightNode


Detailed Description

template<class T>
class DTree< T >

Binary Tree used with LinAl Trees contain an item and up to two branches.

Copyright 2010 David Coss


Constructor & Destructor Documentation

template<class T >
DTree< T >::DTree (  )  [inline]

Default constructor.

Empty Tree.

References DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.

Referenced by DTree< T >::DTree().

template<class T >
DTree< T >::DTree ( const DTree< T > &  copy  )  [inline]

Copy constructor.

References DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.

template<class T >
DTree< T >::DTree ( const T &  o  )  [inline]

Creates a tree whose object is provided.

There are no branches.

References DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.

template<class T >
DTree< T >::DTree ( const T &  o,
DTree< T > *  leftTree,
DTree< T > *  rightTree 
) [inline]

Creates a tree whose object is provided.

Pointers to the branches are given

References DTree< T >::DTree(), DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.

template<class T >
DTree< T >::~DTree (  )  [inline]

Destructor.Objects and branches are deleted.

References DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.


Member Function Documentation

template<class T >
utils::DArray<T> DTree< T >::decompose (  )  const

Returns a DArray<T> of all of the branches of the tree.

template<class T >
T const* const DTree< T >::getItem (  )  const [inline]

Returns the DTree's object.

References DTree< T >::item.

template<class T >
DTree DTree< T >::getLeft (  )  const [inline]

Retrieves Left tree node.

Returns:
DTree

References DTree< T >::leftNode.

template<class T >
DTree DTree< T >::getRight (  )  const [inline]

Retrieves Left tree node.

Returns:
DTree

References DTree< T >::rightNode.

template<class T >
static DString DTree< T >::getVersion (  )  [inline, static]

template<class T >
bool DTree< T >::hasChildren (  )  const [inline]

Indicates whether there is a branch, regardless of which one it is.

References DTree< T >::leftNode, and DTree< T >::rightNode.

template<class T >
bool DTree< T >::hasLeft (  )  const [inline]

Indicates existance of a Left Tree Node.

References DTree< T >::leftNode.

template<class T >
bool DTree< T >::hasRight (  )  const [inline]

Indicates existance of a Left Tree Node.

References DTree< T >::rightNode.

template<class T >
bool DTree< T >::isEmpty (  )  const [inline]

Indicates where or not the tree contains an item (regardless of branch count).

References DTree< T >::item.

template<class T >
bool DTree< T >::operator!= ( const DTree< T > &  tree  )  const [inline]

template<class T >
DTree< T > & DTree< T >::operator= ( const DTree< T > &  copy  )  [inline]

template<class T >
bool DTree< T >::operator== ( const DTree< T > &  tree  )  const [inline]

Tests for equality in the object and the branches.

References DTree< T >::item, DTree< T >::leftNode, and DTree< T >::rightNode.

template<class T >
void DTree< T >::setItem ( T *  o  )  [inline]

Sets the item of the tree.

References DTree< T >::item.

template<class T >
void DTree< T >::setLeft ( DTree< T > *  tree  )  [inline]

Attaches a tree (via pointer) to the left branch.

References DTree< T >::leftNode.

template<class T >
void DTree< T >::setRight ( DTree< T > *  tree  )  [inline]

Attaches a tree (via pointer) to the right branch.

References DTree< T >::rightNode.


Field Documentation

template<class T >
T* DTree< T >::item [private]

template<class T >
DTree* DTree< T >::leftNode [private]

template<class T >
DTree* DTree< T >::rightNode [private]


The documentation for this class was generated from the following files:

Generated on Fri Jun 11 21:02:36 2010 for libdnstd by  doxygen 1.5.7.1