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

Detailed Description

This class can be used to create K-d Tree elements, derived from BSTElement. K-D trees can be thought of as the spatial equivalent of binary search trees and operate on multiple dimensions (2D and 3D are most common). These trees serve as a representation of the underlying geometrically defined spaces. Specialized versions of these trees include quadtrees and octrees, which subdivide into equal sized quadrants and octants at each level, respectively.

This class extends the BSTElement class by adding a dimension property, that specifies the partitioning dimension. The partitioner value is set by the generic parameter, K, or using setPartition() method. It also includes a thickness property for displaying the partitioning lines generated by the subdivision.

Parameters
Kthat is the partitioner value - this is usually a number, integer or float, given a chosen dimension of partititioning
Ethe application data type
See also
Example tutorial using KDTreeElement at https://bridgesuncc.github.io/tutorials/KdTree.html
Author
Kalpathi Subramanian
Date
12/26/18, 7/12/19

Public Member Functions

 KdTreeElement (K k, int dim, float th, KdTreeElement< K, E > l, KdTreeElement< K, E > r, E val, String lab)
 
 KdTreeElement ()
 
 KdTreeElement (E e, KdTreeElement< K, E > left, KdTreeElement< K, E > right)
 
 KdTreeElement (K partitioner, E e, KdTreeElement< K, E > left, KdTreeElement< K, E > right)
 
 KdTreeElement (E e)
 
 KdTreeElement (K key, int dim)
 
String getDataStructType ()
 
 KdTreeElement (K key, E e)
 
 KdTreeElement (String label, E e)
 
 KdTreeElement (String label, K key, E e)
 
 KdTreeElement (KdTreeElement< K, E > left, KdTreeElement< K, E > right)
 
int getDimension ()
 
void setDimension (int dim)
 
getPartitioner ()
 
void setPartitioner (K partitioner)
 
float getThickness ()
 
void setThickness (float th)
 
KdTreeElement< K, E > getLeft ()
 
KdTreeElement< K, E > getRight ()
 
String getElementRepresentation ()
 
- Public Member Functions inherited from bridges.base.BSTElement< K, E >
 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)
 
 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)
 
- 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

◆ KdTreeElement() [1/10]

bridges.base.KdTreeElement< K, E >.KdTreeElement ( k,
int  dim,
float  th,
KdTreeElement< K, E >  l,
KdTreeElement< K, E >  r,
val,
String  lab 
)

Constructs a KdTreeElement with the provided value, label, partitioner, dimension, thickness, left and right KdTree elements. The defaults will be used params are not provided.

Parameters
kThe key for ordering
dimnumber of dimensions
ththickness (used in rendering)
lThe left KdTree Element
rThe right KdTree Element
valThe data to hold
labThe label to show

◆ KdTreeElement() [2/10]

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

◆ KdTreeElement() [3/10]

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

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

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

◆ KdTreeElement() [4/10]

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

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

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

◆ KdTreeElement() [5/10]

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

Parameters
ethe object this KdTreeElement is holding

◆ KdTreeElement() [6/10]

bridges.base.KdTreeElement< K, E >.KdTreeElement ( key,
int  dim 
)

Construct a KdTreeElement given the key and dimension

Parameters
keythe key to be used in a binary search tree implementation
dimthe dimension of partitioning

◆ KdTreeElement() [7/10]

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

Construct a KdTreeElement 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 KdTreeElement is holding

◆ KdTreeElement() [8/10]

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

Construct a KdTreeElement 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 KdTreeElement that shows up on the Bridges visualization
ethe object this KdTreeElement is holding

◆ KdTreeElement() [9/10]

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

Construct a KdTreeElement 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 KdTreeElement that shows up on the Bridges visualization
keythe key to be used in a binary search tree implementation
ethe object this KdTreeElement is holding

◆ KdTreeElement() [10/10]

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

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

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

Member Function Documentation

◆ getDataStructType()

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

This method gets the data structure type

Returns
The date structure type as a string

Reimplemented from bridges.base.BSTElement< K, E >.

◆ getDimension()

int bridges.base.KdTreeElement< K, E >.getDimension ( )

Return the partitioning dimension

Returns
the partitioning dimension of this KdTreeElement

◆ getElementRepresentation()

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

Augment the element with the "height" and "balance factor" fields.

Returns
the augmented JSON string

Reimplemented from bridges.base.BSTElement< K, E >.

◆ getLeft()

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

Return the left child

Returns
the left child of this KdTreeElement

Reimplemented from bridges.base.BSTElement< K, E >.

◆ getPartitioner()

K bridges.base.KdTreeElement< K, E >.getPartitioner ( )

Return the partitioner value

Returns
the partitioner value

◆ getRight()

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

Return the right child

Returns
the right child of this KdTreeElement

Reimplemented from bridges.base.BSTElement< K, E >.

◆ getThickness()

float bridges.base.KdTreeElement< K, E >.getThickness ( )

Return the thickness of the KdtreeElement; thickness is used in the visualization to draw the partitioning lines

Returns
the thickness of this KdTreeElement

◆ setDimension()

void bridges.base.KdTreeElement< K, E >.setDimension ( int  dim)

Set the dimension of the KdTreElement to key

Parameters
dimthe dimension to set

◆ setPartitioner()

void bridges.base.KdTreeElement< K, E >.setPartitioner ( partitioner)

Set the dimension of the KdTreElement to key

Parameters
partitionerthe partitioner value to set

◆ setThickness()

void bridges.base.KdTreeElement< K, E >.setThickness ( float  th)

Set the thickness of the KdTreeElement; thickness can used in the visualization to draw the partitioning lines

Parameters
ththickness of the partitioner to set

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