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

#include <MLelement.h>

Inheritance diagram for bridges::datastructure::MLelement< E >:
bridges::datastructure::SLelement< E > bridges::datastructure::Element< E > bridges::datastructure::DataStructure

Detailed Description

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

This class can be used to instantiate Multi-list Elements.

This class extends SLelement (singly linked list element) to build multi-lists; Multilist elements contain a tag (boolean) that indicates if the element contains a sublist or not; if the tag is true, then there is a sublist beginning at this node and the starting point is the ‘sublist’ field in the element. If the tag is false, then the list continues as a normal singly linked list. The sublists are re recursive: any sublist can have its own sublists and so on. As in singly linked elements, the next pointer points to the following list element and each element contains a generic application specific object.

Multi-list elements contain a visualizer (ElementVisualizer) object for setting visual attributes (color, shape, opacity, size), necessary for displaying them in a web browser.

Elements also have a LinkVisualizer object, that is used when they are linked to another element, appropriate for setting link attributes, for instance, between the current element and its next element. In this case, the link in question is that which connects the element to the following elements; a similar logic follows for sublists.

See also
There is a tutorial about Multi Lists : https://bridgesuncc.github.io/tutorials/MultiList.html
Author
Kalpathi Subramanian
Date
5/24/17, 7/12/19, 12/28/20
Parameters
EThe generic parameter object that is part of this element, representing either application specific data, or a pointer to a sublist.

Public Member Functions

 MLelement (const E &val=E(), const string &lab=string())
 constructor More...
 
 MLelement (string label)
 Creates an MLelement object. More...
 
 MLelement (E e, MLelement< E > *next)
 Creates an MLelement object. More...
 
void setSubList (MLelement< E > *sl)
 Sets the start of a new sublist to the MLelement "next". More...
 
MLelementgetSubList ()
 Gets the sublist at this node, if it exists. More...
 
MLelement< E > * getNext () override
 Retrieves the element following this element. More...
 
MLelement< E > * getNext () const override
 Retrieves the element following this element - const version. More...
 
void setNext (MLelement< E > *n)
 Sets the element to point to the next MLelement. More...
 
void setTag (bool t)
 Sets the tag of the element. More...
 
bool getTag ()
 Gets the tag of the element. More...
 
virtual const string getDStype () const override
 Return the string representaion of element. More...
 
- Public Member Functions inherited from bridges::datastructure::SLelement< E >
 SLelement (SLelement *next, const E &val=E(), const string &lab=string())
 Constructs an slelement with the provided value. More...
 
 SLelement (const E &val=E(), const string &lab=string())
 Constructs an slelement with the provided value. More...
 
void setNext (SLelement *n)
 
- 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 ()
 Get the element visualizer object. More...
 
const ElementVisualizergetVisualizer () const
 Get the element visualizer object - constant version. More...
 
LinkVisualizergetLinkVisualizer (const Element *el)
 Returns the LinkVisualizer of element. More...
 
LinkVisualizergetLinkVisualizer (const Element *el) const
 Returns the LinkVisualizer of element. More...
 
string const & getLabel () const
 Gets the label of this element. More...
 
void setLabel (const string &lab)
 Sets label of this element. More...
 
E const & getValue () const
 Gets the object held in the generic object E. More...
 
E & getValue ()
 Gets the object held in the generic object E. More...
 
void setValue (const E &val)
 Sets generic object to "val". More...
 
void setSize (const double &sz)
 Sets size of the element. More...
 
double getSize () const
 Get element size. More...
 
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)
 Set opacity of element - use the 4th color component. More...
 
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)
 Sets the location attributes of an element. More...
 
double getLocationX () const
 Gets the X coordinate of the location. More...
 
double getLocationY () const
 Gets the Y coordinate of the location. More...
 
- Public Member Functions inherited from bridges::datastructure::DataStructure
virtual ~DataStructure ()=default
 

Protected Attributes

MLelement< E > * sub_list = nullptr
 
bool tag = false
 
- Protected Attributes inherited from bridges::datastructure::SLelement< E >
SLelementnext = nullptr
 
- Protected Attributes inherited from bridges::datastructure::Element< E >
unordered_map< Element *, LinkVisualizerlinks
 

Additional Inherited Members

- Protected Member Functions inherited from bridges::datastructure::SLelement< E >
virtual const pair< string, string > generateJSON (vector< const SLelement< E > * > nodes) const
 Generates the JSON representation of the element. More...
 
virtual void getListElements (vector< const SLelement< E > * > &nodes) const
 Get the list of nodes. More...
 
- Protected Member Functions inherited from bridges::datastructure::Element< E >
virtual const string getElementRepresentation () const
 Gets the JSON string of the element representation. More...
 
- Static Protected Member Functions inherited from bridges::datastructure::Element< E >
static const string getLinkRepresentation (const LinkVisualizer &lv, const string &src, const string &dest)
 

Constructor & Destructor Documentation

◆ MLelement() [1/3]

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

constructor

This constructor creates an MLelement object and sets the next pointer to null

Parameters
valgeneric object
lablabel

◆ MLelement() [2/3]

template<typename E >
bridges::datastructure::MLelement< E >::MLelement ( string  label)
inline

Creates an MLelement object.

This constructor creates an MLelement object of generic parameter object E, and label "label" and sets the next pointer to null

Parameters
labelthe label of MLelement that shows up on the Bridges visualization

◆ MLelement() [3/3]

template<typename E >
bridges::datastructure::MLelement< E >::MLelement ( e,
MLelement< E > *  next 
)
inline

Creates an MLelement object.

Creates a new element with value "e" and sets the next pointer to the MLelement referenced by the "next" argument

Parameters
ethe generic object that this element will hold
nextthe element that should be assigned to the next pointer

Member Function Documentation

◆ getDStype()

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

Return the string representaion of element.

Returns
The string representation of this data structure type

Reimplemented from bridges::datastructure::SLelement< E >.

◆ getNext() [1/2]

template<typename E >
MLelement<E>* bridges::datastructure::MLelement< E >::getNext ( ) const
inlineoverridevirtual

Retrieves the element following this element - const version.

Returns
MLelement<E> assigned to next

Reimplemented from bridges::datastructure::SLelement< E >.

◆ getNext() [2/2]

template<typename E >
MLelement<E>* bridges::datastructure::MLelement< E >::getNext ( )
inlineoverridevirtual

Retrieves the element following this element.

Returns
MLelement<E> assigned to next

Reimplemented from bridges::datastructure::SLelement< E >.

◆ getSubList()

template<typename E >
MLelement* bridges::datastructure::MLelement< E >::getSubList ( )
inline

Gets the sublist at this node, if it exists.

Returns
the sublist head element, if it exists

◆ getTag()

template<typename E >
bool bridges::datastructure::MLelement< E >::getTag ( )
inline

Gets the tag of the element.

Returns
tag of the element

◆ setNext()

template<typename E >
void bridges::datastructure::MLelement< E >::setNext ( MLelement< E > *  n)
inline

Sets the element to point to the next MLelement.

Parameters
nMLelement<E> that should be assigned to the next pointer

◆ setSubList()

template<typename E >
void bridges::datastructure::MLelement< E >::setSubList ( MLelement< E > *  sl)
inline

Sets the start of a new sublist to the MLelement "next".

Parameters
slthe MLelement that is the beginning of a sublist

◆ setTag()

template<typename E >
void bridges::datastructure::MLelement< E >::setTag ( bool  t)
inline

Sets the tag of the element.

Parameters
ttag to set

Member Data Documentation

◆ sub_list

template<typename E >
MLelement<E>* bridges::datastructure::MLelement< E >::sub_list = nullptr
protected

◆ tag

template<typename E >
bool bridges::datastructure::MLelement< E >::tag = false
protected

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