Bridges-Java  3.4.2
Bridges(Java API)
Public Member Functions | List of all members
bridges.base.BSTElement< K, E > Class Template Reference
Inheritance diagram for bridges.base.BSTElement< K, E >:
bridges.base.BinTreeElement< E > bridges.base.TreeElement< E > bridges.base.Element< E > bridges.base.DataStruct bridges.base.AVLTreeElement< K, E > bridges.base.KdTreeElement< K, E >

Detailed Description

The BSTElement class is the building block for creating binary search trees.

It contains two children (left, right), and a search key, to be used in search operations. The search key is a generic parameter and should be orderable, such as numeric value, string, etc.

BSTElement contains a visualizer (ElementVisualizer) object for setting visual attributes (color, shape, opacity, size), necessary for displaying them in a web browser.

BST 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 left or right child

See also
Example tutorial using BSTElement at https://bridgesuncc.github.io/tutorials/BinarySearchTree.html
Parameters
Ethe generic parameter object that is part of this element, representing application specific data.
Kis the search key parameter in the BST node; K must be orderable, such as integer, float, string, etc., on which relational operators work.
Author
Kalpathi Subramanian, Mihai Mehedint
Date
6/22/16, 1/7/17, 5/17/17

This class extends the BinTreeElement class by adding a 'key' value for use in a binary search tree implementations.

Public Member Functions

 BSTElement ()
 
 BSTElement (E e, BSTElement< K, E > left, BSTElement< K, E > right)
 
 BSTElement (K key, E e, BSTElement< K, E > left, BSTElement< K, E > right)
 
 BSTElement (E e)
 
String getDataStructType ()
 
 BSTElement (K key, E e)
 
 BSTElement (String label, E e)
 
 BSTElement (String label, K key, E e)
 
 BSTElement (BSTElement< K, E > left, BSTElement< K, E > right)
 
getKey ()
 
void setKey (K key)
 
BSTElement< K, E > getLeft ()
 
BSTElement< K, E > getRight ()
 
String getElementRepresentation ()
 
- Public Member Functions inherited from bridges.base.BinTreeElement< E >
 BinTreeElement ()
 
 BinTreeElement (E e)
 
 BinTreeElement (String label, E e)
 
 BinTreeElement (BinTreeElement< E > left, BinTreeElement< E > right)
 
 BinTreeElement (E e, BinTreeElement< E > left, BinTreeElement< E > right)
 
void setLeft (BinTreeElement< E > left)
 
void setRight (BinTreeElement< E > right)
 
- Public Member Functions inherited from bridges.base.TreeElement< E >
 TreeElement ()
 
 TreeElement (E e)
 
 TreeElement (String label, E e)
 
void addChild (TreeElement< E > child)
 
int getNumberOfChildren ()
 
void setChild (int index, TreeElement< E > child)
 
TreeElement< E > getChild (int index)
 
String getDataStructureRepresentation ()
 
- 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 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 ()
 
String toString ()
 

Additional Inherited Members

- 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 inherited from bridges.base.DataStruct
String QUOTE = "\""
 
- 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

◆ BSTElement() [1/8]

Construct an empty BSTElement with no key assigned and left and right pointers set to null.

◆ BSTElement() [2/8]

bridges.base.BSTElement< K, E >.BSTElement ( e,
BSTElement< K, E >  left,
BSTElement< K, E >  right 
)

Construct a BSTElement holding an object "e" with a left pointer assigned to "left" and a right pointer assigned to "right".

Parameters
ethe object that BSTElement is holding
leftthe BSTElement that should be assigned to the left pointer
rightthe BSTElemetn taht should be assigned to the right pointer

◆ BSTElement() [3/8]

bridges.base.BSTElement< K, E >.BSTElement ( key,
e,
BSTElement< K, E >  left,
BSTElement< K, E >  right 
)

Construct a BSTElement with a key "key", holding an object "e" with a left pointer assigned to "left" and a right pointer assigned to "right".

Parameters
keythe key to be used in a binary search tree implementation
ethe object this BSTElement is holding
leftthe BSTElement that should be assigned to the left pointer
rightthe BSTElement that should be assigned to the right pointer

◆ BSTElement() [4/8]

Construct a BSTElement holding the object "e", with no key assigned and left and right pointers set to null.

Parameters
ethe object this BSTElement is holding

◆ BSTElement() [5/8]

bridges.base.BSTElement< K, E >.BSTElement ( key,
e 
)

Construct a BSTElement holding the object "e", with key "key" assigned and left and right pointers set to null.

Parameters
keythe key to be used in a binary search tree implementation
ethe object this BSTElement is holding

◆ BSTElement() [6/8]

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

Construct a BSTElement holding the object "e", with label set to "label", with no key assigned, and left and right pointers set to null.

Parameters
labelthe label of BSTElement that shows up on the Bridges visualization
ethe object this BSTElement is holding

◆ BSTElement() [7/8]

bridges.base.BSTElement< K, E >.BSTElement ( String  label,
key,
e 
)

Construct a BSTElement holding the object "e", with label set to "label", with "key" assigned to key, and left and right pointers set to null.

Parameters
labelthe label of BSTElement that shows up on the Bridges visualization
keythe key to be used in a binary search tree implementation
ethe object this BSTElement is holding

◆ BSTElement() [8/8]

bridges.base.BSTElement< K, E >.BSTElement ( BSTElement< K, E >  left,
BSTElement< K, E >  right 
)

Construct an empty BSTElement, with no key assigned, and left and right pointers set to null.

Parameters
leftthe BSTElement that should be assigned to the left pointer
rightthe BSTElement that should be assigned to the right pointer

Member Function Documentation

◆ getDataStructType()

String bridges.base.BSTElement< K, E >.getDataStructType ( )

This method gets the data structure type

Returns
The date structure type as a string

Reimplemented from bridges.base.BinTreeElement< E >.

Reimplemented in bridges.base.KdTreeElement< K, E >, and bridges.base.AVLTreeElement< K, E >.

◆ getElementRepresentation()

String bridges.base.BSTElement< K, E >.getElementRepresentation ( )

Augment the element with the "key" field.

Returns
the augmented JSON string

Reimplemented from bridges.base.Element< E >.

Reimplemented in bridges.base.KdTreeElement< K, E >, and bridges.base.AVLTreeElement< K, E >.

◆ getKey()

K bridges.base.BSTElement< K, E >.getKey ( )

Return the key of the BSTElement

Returns
the key of this BSTElement

◆ getLeft()

BSTElement<K, E> bridges.base.BSTElement< K, E >.getLeft ( )

Return the left child of the BSTElement

Returns
the left child of this BSTElement

Reimplemented from bridges.base.BinTreeElement< E >.

Reimplemented in bridges.base.KdTreeElement< K, E >, and bridges.base.AVLTreeElement< K, E >.

◆ getRight()

BSTElement<K, E> bridges.base.BSTElement< K, E >.getRight ( )

Return the right child of the BSTElement

Returns
the right child of this BSTElement

Reimplemented from bridges.base.BinTreeElement< E >.

Reimplemented in bridges.base.KdTreeElement< K, E >, and bridges.base.AVLTreeElement< K, E >.

◆ setKey()

void bridges.base.BSTElement< K, E >.setKey ( key)

Set the key of the BSTElement to key

Parameters
keythe key to set

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