Bridges-Java  3.4.3
Bridges(Java API)
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bridges.base.SLelement< E > Class Template Reference
Inheritance diagram for bridges.base.SLelement< E >:
bridges.base.Element< E > bridges.base.DataStruct bridges.base.CircSLelement< E > bridges.base.DLelement< E > bridges.base.MLelement< E > bridges.base.CircDLelement< E >

Detailed Description

@brief This class can be used to instantiate Singly Linked Elements.

This class extends Element and takes a generic parameter E

representing application specific data. This element forms the basic building block for singly linked lists. Singly linked elements have a field pointing to the next element along the list.

Elements contain a visualizer, ElementVisualizer, 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.

Parameters
EThe generic parameter object that is part of this element, representing application specific data.
See also
Example Tutorial at https://bridgesuncc.github.io/tutorials/SinglyLinkedList.html
Author
Mihai Mehedint, Kalpathi Subramanian
Date
6/22/16, 1/7/17, 5/17/17, 7/14/19

Classes

class  SLelementIterator
 Implements an iterator singly linked list compatible with SLelement for ease iterating over lists. More...
 

Public Member Functions

 SLelement ()
 
 SLelement (String label, E e)
 
 SLelement (E e, SLelement< E > next)
 
 SLelement (E e)
 
 SLelement (SLelement< E > next)
 
String getDataStructType ()
 
SLelement< E > getNext ()
 
void setNext (SLelement< E > next)
 
String toString ()
 
String getDataStructureRepresentation ()
 
Iterator< E > iterator ()
 
- Public Member Functions inherited from bridges.base.Element< E >
 Element ()
 Element constructor. More...
 
 Element (E val)
 the constructor of Element More...
 
 Element (String label, E val)
 Constructor of Element. More...
 
 Element (Element< E > original)
 performing deep copy of an element when needed More...
 
String getIdentifier ()
 
void setSize (double sz)
 
void setColor (Color col)
 
Color getColor ()
 
void setOpacity (float opacity)
 
double getOpacity ()
 
void setShape (String aShape)
 
ElementVisualizer getVisualizer ()
 
void setVisualizer (ElementVisualizer visualizer)
 
LinkVisualizer getLinkVisualizer (Element< E > el)
 Returns the Element's link visualizer object. More...
 
String getClassName ()
 
int compareTo (Element< E > e1)
 
boolean equals (Element< E > e1)
 
String getElementRepresentation ()
 
String getLinkRepresentation (LinkVisualizer lv, String src, String dest)
 
String getLabel ()
 
void setLabel (String label)
 
getValue ()
 
void setValue (E value)
 
double getSize ()
 
void setColor (String col)
 Change the element color. More...
 
String getShape ()
 
void setLocation (double locX, double locY)
 Set the location attributes of an element. More...
 
double getLocationX ()
 
double getLocationY ()
 

Protected Member Functions

void getListElements (Vector< Element< E >> nodes)
 
- Protected Member Functions inherited from bridges.base.Element< E >
void setLinkVisualizer (Element< E > el)
 Sets the link from this element to a new incoming element. More...
 
void removeLinkVisualizer (Element< E > el)
 Removes the link from this element to a new incoming element. More...
 
void validateVal (E value)
 

Protected Attributes

SLelement< E > next = null
 
- Protected Attributes inherited from bridges.base.DataStruct
String QUOTE = "\""
 

Additional Inherited Members

- Package Attributes inherited from bridges.base.DataStruct
String COMMA = ","
 
String COLON = ":"
 
String OPEN_CURLY = "{"
 
String CLOSE_CURLY = "}"
 
String OPEN_PAREN = "("
 
String CLOSE_PAREN = ")"
 
String OPEN_BOX = "["
 
String CLOSE_BOX = "]"
 
- Static Package Attributes inherited from bridges.base.Element< E >
static Integer ids = 0
 

Constructor & Destructor Documentation

◆ SLelement() [1/5]

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

◆ SLelement() [2/5]

bridges.base.SLelement< E >.SLelement ( String  label,
e 
)

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

Parameters
labelthe label of SLelement that shows up on the Bridges visualization
ethe generic object that this SLelement will hold

◆ SLelement() [3/5]

bridges.base.SLelement< E >.SLelement ( e,
SLelement< E >  next 
)

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

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

◆ SLelement() [4/5]

Creates a new element with value "e"

Parameters
ethe generic object that this element will hold

◆ SLelement() [5/5]

Creates a new element and sets the next pointer to the SLelement "next"

Parameters
nextthe SLelement that should be assigned to the next pointer

Member Function Documentation

◆ getDataStructType()

String bridges.base.SLelement< E >.getDataStructType ( )

This method gets the data structure type

Returns
The date structure type as a string

Reimplemented from bridges.base.Element< E >.

Reimplemented in bridges.base.MLelement< E >, bridges.base.DLelement< E >, bridges.base.CircSLelement< E >, and bridges.base.CircDLelement< E >.

◆ getDataStructureRepresentation()

String bridges.base.SLelement< E >.getDataStructureRepresentation ( )

Get the JSON representation of the the data structure

Returns
the JSON string of the element's representation

Reimplemented from bridges.base.Element< E >.

Reimplemented in bridges.base.MLelement< E >, and bridges.base.DLelement< E >.

◆ getListElements()

void bridges.base.SLelement< E >.getListElements ( Vector< Element< E >>  nodes)
protected

Get the elements of the list - used internally for JSON construction

Parameters
nodesa vector of the ndoes in the list

Reimplemented in bridges.base.MLelement< E >.

◆ getNext()

SLelement<E> bridges.base.SLelement< E >.getNext ( )

Retrieves the element following this element

Returns
SLelement<E> assigned to next

Reimplemented in bridges.base.MLelement< E >, bridges.base.DLelement< E >, bridges.base.CircSLelement< E >, and bridges.base.CircDLelement< E >.

◆ iterator()

Iterator<E> bridges.base.SLelement< E >.iterator ( )

Return an iterator over the elements in the array. This is generally not called directly, but is called by Java when used in "simple" for loops

Reimplemented in bridges.base.CircSLelement< E >, and bridges.base.CircDLelement< E >.

◆ setNext()

void bridges.base.SLelement< E >.setNext ( SLelement< E >  next)

Sets the element to point to the next SLelement, updates the link visualizer

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

◆ toString()

String bridges.base.SLelement< E >.toString ( )

Reimplemented from bridges.base.Element< E >.

Reimplemented in bridges.base.CircSLelement< E >.

Member Data Documentation

◆ next

SLelement<E> bridges.base.SLelement< E >.next = null
protected

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