![]() |
Bridges-Java-2.2
2.2.0
Bridges(JavaAPI)
|
Public Member Functions | |
ADTVisualizer () | |
void | setTitle (String titl) |
void | setDescription (String descr) |
ADTVisualizer (ArrayElement< E >[] elementArray) | |
ADTVisualizer (Object type) | |
void | validateType (Object type) |
String | getVisualizerType () |
void | setVisualizerType (String visualizerType) |
String | getGraphAdjList_Representation (GraphAdjList< K, E > graph) |
String | getGraphAdjMatrix_Representation (GraphAdjMatrix< K, E > graph) |
String | getSLRepresentation (SLelement< E > first_element) |
String | getDLRepresentation (DLelement< E > first_element) |
String | getArrayRepresentation (Element< E >[] el_array, int size) |
String | getTreeRepresentation (TreeElement< E > root) |
String | generateJSON_Array (Element< E >[] el_array, int size) |
String | generateJSON_SLL (LinkedList< SLelement< E >> nodes, LinkedList< SLelement< E >> links) |
String | generateJSON_DLL (LinkedList< DLelement< E >> nodes, LinkedList< DLelement< E >> links) |
String | generateJSON_Graph (LinkedList< Element< E >> nodes, LinkedList< Element< E >> links_src, LinkedList< Element< E >> links_dest) |
boolean | visualizeJSON () |
void | setVisualizeJSON (boolean flag) |
String | build_JSON (StringBuilder nodes_JSON, StringBuilder links_JSON) |
String | build_JSON (String tree_json) |
Static Public Member Functions | |
static StringBuilder | trimComma (StringBuilder in) |
Public Attributes | |
String | visualizerType |
final Map< String, String > | adt_names |
Element< E >[] | elementArray |
Protected Attributes | |
int | arrayIndex |
boolean | json_flag = false |
The Bridges object uses this class to keep track of the Visualization representation prior to passing the information to the Bridges Server.
An end user will generally not need to interact directly with this class.
bridges.base.ADTVisualizer< K, E >.ADTVisualizer | ( | ) |
constructor using the superclass Object when using this constructor the default ADT structure is graph
Exception |
bridges.base.ADTVisualizer< K, E >.ADTVisualizer | ( | ArrayElement< E >[] | elementArray | ) |
Constructor allow visulizations of an array.
adtArray | the array of elements to visualize |
bridges.base.ADTVisualizer< K, E >.ADTVisualizer | ( | Object | type | ) |
Any other object type sent to the ADTVisualizer will throw an exception example sending a String will throw an error
type | an object |
Exception | to indicate that an invalid object was sent to the ADTVisualizer |
String bridges.base.ADTVisualizer< K, E >.build_JSON | ( | StringBuilder | nodes_JSON, |
StringBuilder | links_JSON | ||
) |
This method builds the JSON string
nodes_JSON | the string builder object of existing nodes |
links_JSON | the string builder object of existing links between the nodes |
String bridges.base.ADTVisualizer< K, E >.build_JSON | ( | String | tree_json | ) |
String bridges.base.ADTVisualizer< K, E >.generateJSON_Array | ( | Element< E >[] | el_array, |
int | size | ||
) |
Generating the JSON string for an array of elements
element | array (Element<E>[]) |
size | (size of array) |
String bridges.base.ADTVisualizer< K, E >.generateJSON_DLL | ( | LinkedList< DLelement< E >> | nodes, |
LinkedList< DLelement< E >> | links | ||
) |
This method creates the JSON for a doubly linked list
nodes | - this is the Linked list of DLelements |
links | - this is the list containing the links |
String bridges.base.ADTVisualizer< K, E >.generateJSON_Graph | ( | LinkedList< Element< E >> | nodes, |
LinkedList< Element< E >> | links_src, | ||
LinkedList< Element< E >> | links_dest | ||
) |
This method builds the JSON for the Binary Tree
nodes | - list of the tree nodes |
links | - list of the tree links |
nodes | - list of the tree nodes |
links | - list of the tree links |
String bridges.base.ADTVisualizer< K, E >.generateJSON_SLL | ( | LinkedList< SLelement< E >> | nodes, |
LinkedList< SLelement< E >> | links | ||
) |
Generating the JSON string given a set of nodes and links for the singly linked list
nodes | |
links | |
data | structure type |
String bridges.base.ADTVisualizer< K, E >.getArrayRepresentation | ( | Element< E >[] | el_array, |
int | size | ||
) |
String bridges.base.ADTVisualizer< K, E >.getDLRepresentation | ( | DLelement< E > | first_element | ) |
This method returns the JSON string of a doubly linked list
e |
String bridges.base.ADTVisualizer< K, E >.getGraphAdjList_Representation | ( | GraphAdjList< K, E > | graph | ) |
This method creates a JSON representation of the graph - Adjacency List Representation.
Hashmap<String,SLelement<E> | represents the list of vertices each of which is a singly linked list. |
String bridges.base.ADTVisualizer< K, E >.getGraphAdjMatrix_Representation | ( | GraphAdjMatrix< K, E > | graph | ) |
This method creates a JSON representation of the graph - Adjacency Matrix
e | - is the starting element(node) |
String bridges.base.ADTVisualizer< K, E >.getSLRepresentation | ( | SLelement< E > | first_element | ) |
String bridges.base.ADTVisualizer< K, E >.getTreeRepresentation | ( | TreeElement< E > | root | ) |
This method returns the JSON string representation of the tree made by using preorder traversal
e |
String bridges.base.ADTVisualizer< K, E >.getVisualizerType | ( | ) |
This method returns the visualizer type as a string
void bridges.base.ADTVisualizer< K, E >.setDescription | ( | String | descr | ) |
descr | description to annotate the visualization; |
void bridges.base.ADTVisualizer< K, E >.setTitle | ( | String | titl | ) |
title | title used in the visualization; |
void bridges.base.ADTVisualizer< K, E >.setVisualizeJSON | ( | boolean | flag | ) |
set | the flag to output the JSON |
void bridges.base.ADTVisualizer< K, E >.setVisualizerType | ( | String | visualizerType | ) |
This method sets the visualizer type
visualizerType | a string in ADTVisualizer.ADT_TYPE representing the type of Bridges Visualization (e.g. "graph", "llist", etc.) |
Exception |
|
static |
void bridges.base.ADTVisualizer< K, E >.validateType | ( | Object | type | ) |
Validates whether the "type" is recognized by ADTVisualizer.
type | an object to check whether ADTVisualizer will accept as a valid type |
boolean bridges.base.ADTVisualizer< K, E >.visualizeJSON | ( | ) |
check | if the flag to output the JSON is set |
final Map<String, String> bridges.base.ADTVisualizer< K, E >.adt_names |
|
protected |
Element<E> [] bridges.base.ADTVisualizer< K, E >.elementArray |
|
protected |
String bridges.base.ADTVisualizer< K, E >.visualizerType |