Bridges-C++  3.1.1
Bridges(C++API)
Public Member Functions | List of all members
bridges::datastructure::BinTreeElement< E > Class Template Reference

#include <BinTreeElement.h>

Inheritance diagram for bridges::datastructure::BinTreeElement< E >:
bridges::datastructure::TreeElement< E > bridges::datastructure::Element< E > bridges::datastructure::DataStructure bridges::datastructure::BSTElement< K, E > bridges::datastructure::AVLTreeElement< K, E > bridges::datastructure::KdTreeElement< K, E >

Detailed Description

template<typename E>
class bridges::datastructure::BinTreeElement< E >

This class can be used to create binary tree elements, derived from TreeElement.

This class can be used to create binary tree elements, with left and right children.

See also
There is a tutorial about Binary Trees : http://bridgesuncc.github.io/tutorials/BinTree.html
Parameters
Ethe application data type
Author
Kalpathi Subramanian
Date
6/12/15, 7/12/19

Public Member Functions

 BinTreeElement (BinTreeElement *l, BinTreeElement *r, const E &e=E(), const string &lab=string())
 
 BinTreeElement (const E &e=E(), const string &lab=string())
 
virtual const string getDStype () const override
 
virtual BinTreeElementgetLeft ()
 
virtual const BinTreeElementgetLeft () const
 
void setLeft (BinTreeElement *l)
 
virtual BinTreeElementgetRight ()
 
virtual const BinTreeElementgetRight () const
 
void setRight (BinTreeElement *r)
 
- Public Member Functions inherited from bridges::datastructure::TreeElement< E >
 TreeElement (const E &e=E(), const string &lab=string())
 
vector< TreeElement * > & getChildren ()
 
const vector< TreeElement * > & getChildren () const
 
TreeElementgetChild (const int &n)
 
const TreeElementgetChild (const int &n) const
 
void addChild (TreeElement *child)
 
void setChild (const size_t &index, TreeElement *kid)
 
- Public Member Functions inherited from bridges::datastructure::Element< E >
 Element (const E &val=E(), const string &lab=string())
 
 Element (const Element &e)
 
Elementoperator= (const Element &e)
 
E & operator= (E const &e)
 
virtual ~Element ()
 
ElementVisualizergetVisualizer ()
 
const ElementVisualizergetVisualizer () const
 
LinkVisualizergetLinkVisualizer (const Element *el)
 
LinkVisualizergetLinkVisualizer (const Element *el) const
 
string const & getLabel () const
 
void setLabel (const string &lab)
 
E const & getValue () const
 
E & getValue ()
 
void setValue (const E &val)
 
void setSize (const double &sz)
 Sets size of the element. More...
 
double getSize () const
 
void setColor (const Color &col)
 Set the color of the Element. More...
 
void setColor (const string col)
 Set the color by name. More...
 
Color getColor () const
 Get the current color of the element. More...
 
void setOpacity (double opacity)
 
double getOpacity ()
 
void setShape (const Shape &shp)
 Set the shape of the element. More...
 
Shape getShape () const
 Returns the shape of the element. More...
 
void setLocation (const double &locX, const double &locY)
 
double getLocationX () const
 
double getLocationY () const
 
- Public Member Functions inherited from bridges::datastructure::DataStructure
virtual ~DataStructure ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from bridges::datastructure::Element< E >
virtual const string getElementRepresentation () const
 
- Static Protected Member Functions inherited from bridges::datastructure::Element< E >
static const string getLinkRepresentation (const LinkVisualizer &lv, const string &src, const string &dest)
 
- Protected Attributes inherited from bridges::datastructure::Element< E >
unordered_map< Element *, LinkVisualizerlinks
 

Constructor & Destructor Documentation

◆ BinTreeElement() [1/2]

template<typename E >
bridges::datastructure::BinTreeElement< E >::BinTreeElement ( BinTreeElement< E > *  l,
BinTreeElement< E > *  r,
const E &  e = E(),
const string &  lab = string() 
)
inline

Constructs a BinTreeElement with the provided value, label, left and right BinTreeElements. The defaults will be used if not provided.

Parameters
eThe data to hold
labThe label to show
lThe left TreeElement
rThe right TreeElement

◆ BinTreeElement() [2/2]

template<typename E >
bridges::datastructure::BinTreeElement< E >::BinTreeElement ( const E &  e = E(),
const string &  lab = string() 
)
inline

Constructs a BinTreeElement with the provided value and label, setting the left and right BinTreeElement to NULL. The defaults will be used if not provided.

Parameters
eThe data to hold
labThe label to show

Member Function Documentation

◆ getDStype()

template<typename E >
virtual const string bridges::datastructure::BinTreeElement< E >::getDStype ( ) const
inlineoverridevirtual

◆ getLeft() [1/2]

template<typename E >
virtual BinTreeElement* bridges::datastructure::BinTreeElement< E >::getLeft ( )
inlinevirtual

◆ getLeft() [2/2]

template<typename E >
virtual const BinTreeElement* bridges::datastructure::BinTreeElement< E >::getLeft ( ) const
inlinevirtual

◆ getRight() [1/2]

template<typename E >
virtual BinTreeElement* bridges::datastructure::BinTreeElement< E >::getRight ( )
inlinevirtual

◆ getRight() [2/2]

template<typename E >
virtual const BinTreeElement* bridges::datastructure::BinTreeElement< E >::getRight ( ) const
inlinevirtual

◆ setLeft()

template<typename E >
void bridges::datastructure::BinTreeElement< E >::setLeft ( BinTreeElement< E > *  l)
inline

Sets left child to "l"

Parameters
lleft child pointer

◆ setRight()

template<typename E >
void bridges::datastructure::BinTreeElement< E >::setRight ( BinTreeElement< E > *  r)
inline

Sets right to "r"

Parameters
rright child pointer

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