![]() |
Bridges-C++
3.1.1
Bridges(C++API)
|
#include <TreeElement.h>
This class can be used to create tree elements, derived from Element.
This class can be used to create tree elements, with subtrees
Generic Parameters: E the application data type
There is a tutorial about Trees : http://bridgesuncc.github.io/tutorials/Tree.html
Public Member Functions | |
| TreeElement (const E &e=E(), const string &lab=string()) | |
| virtual const string | getDStype () const override |
| vector< TreeElement * > & | getChildren () |
| const vector< TreeElement * > & | getChildren () const |
| TreeElement * | getChild (const int &n) |
| const TreeElement * | getChild (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) | |
| Element & | operator= (const Element &e) |
| E & | operator= (E const &e) |
| virtual | ~Element () |
| ElementVisualizer * | getVisualizer () |
| const ElementVisualizer * | getVisualizer () const |
| LinkVisualizer * | getLinkVisualizer (const Element *el) |
| LinkVisualizer * | getLinkVisualizer (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 *, LinkVisualizer > | links |
|
inline |
Constructs a TreeElement with the provided value and label, setting the left and right TreeElements to NULL. The defaults will be used if not provided.
| e | The data to hold |
| lab | The label to show |
|
inline |
Adds a child to children
| child | The child TreeElement |
|
inline |
Gets the nth child of this TreeElement, returns null if non-existent
| n | The index of the child |
|
inline |
Constant version
Gets the nth child of this TreeElement, returns null if non-existent
| n | The index of the child |
|
inline |
Get the children of this node
|
inline |
Constant version
Get the children of this node
|
inlineoverridevirtual |
Get the data structure name
Implements bridges::datastructure::DataStructure.
Reimplemented in bridges::datastructure::KdTreeElement< K, E >, bridges::datastructure::BSTElement< K, E >, bridges::datastructure::BinTreeElement< E >, bridges::datastructure::BTElement< E >, and bridges::datastructure::AVLTreeElement< K, E >.
|
inline |
Sets child at index to "kid". Will do nothing given invalid index.
| index | of child to replace |
| kid | The child TreeElement |
This simply replaces the element at position index and the old element is lost(actually can create memory leak if it came from dynamic memory Since we cannot distinguish from allocated or static memory from pointers, it is the user's responsibility to keep track of allocated memory its linkage. For new elements, if not null, create linkage
1.8.13