Bridges-Java  3.4.3
Bridges(Java API)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Package Functions | Static Package Attributes | List of all members
bridges.connect.Bridges Class Reference

Detailed Description

The Bridges class is the main class that provides interfaces to datasets, maintains user and assignment information, and connects to the Bridges server.

The Bridges class is responsible for initializing the Bridges system, specifying parameters (user id, assignment id, title, description, data structure type, etc) for the student assignment, generating the data structure representation and transmission to the Bridges server. In addition, it provides interfaces to a number of real-world datasets, that makes it easy to access the data for use algorithms/data structure assignments.

Datasets. The datasets that are currently supported through the BRIDGES API include USGS Earthquake Data, IMDB Actor/Movie Data (2 versions), Gutenberg Book Collection Meta Data, a Video Game Dataset and Shakespeare Dataset. More information is found in the respective methods (below) and at

https://bridgesuncc.github.io/datasets.html

A typical Bridges program includes creating the Bridges object, followed by creation of the data structure by the user, assigning visual attributes to elements of the data structure, followed by specification of the data structure type and the call to visualize the data structure (Bridges::setDataStructure() and visualize() methods).

Author
Sean Gallagher, Kalpathi Subramanaian, Mihai Mehedint, David Burlinson.
Date
1/16/17, 5/19/17
See also
Tutorial examples at
https://bridgesuncc.github.io/tutorials/Overview.html

Public Member Functions

 Bridges ()
 
DataSource getDataSource ()
 get the current data source object being used by BRIDGES More...
 
 Bridges (int assignment, String username, String appl_id)
 
void setTitle (String title)
 Change the title of the assignment. More...
 
void setDescription (String description)
 Change the textual description of the assignment. More...
 
void setServer (String server)
 sets the server type. More...
 
void setMapOverlay (Boolean flag)
 Turns on map overlay for subsequent visualizations - used with location specific datasets. More...
 
void setMap (String map, String info)
 Sets the type of map overlay to use. More...
 
void setDisplayMode (String mode) throws IllegalArgumentException
 
void setCoordSystemType (String coord)
 Sets the coordinate system type. More...
 
void setWindow (int x1, int x2, int y1, int y2)
 Specify the window that will be used to render the view by default. More...
 
void setWindow (float x1, float x2, float y1, float y2)
 Specify the window that will be used to render the view by default. More...
 
void setWindow (double x1, double x2, double y1, double y2)
 Specify the window that will be used to render the view by default. More...
 
boolean getJSONFlag ()
 Flag to control printing the JSON of the data structure. Used only for debugging BRIDGES. More...
 
void setJSONFlag (boolean flag)
 
void setLabelFlag (boolean flag)
 
void postVisualizationLink (boolean link_url_flag)
 
void setDataStructure (DataStruct ds) throws NullPointerException
 Provide BRIDGES a handle to the data structure to be visualized. More...
 
void clearAssignment ()
 
void visualize () throws IOException, RateLimitException
 
String getVisualizeURL ()
 

Static Public Member Functions

static void setDebugFlag (Boolean flag)
 sets a debug flag, used for debugging BRIDGES More...
 
static Boolean getDebugFlag ()
 gets the debug flag value, used for debugging BRIDGES More...
 
static String getAssignment ()
 Get the assignment id. More...
 
static int getAssignmentID ()
 Get the assignment id as an integer. More...
 
static void setAssignment (int assignment)
 
static String getUserName ()
 
static void setUserName (String userName)
 
static String getKey ()
 
static void setKey (String key)
 

Protected Member Functions

void init (int assignment, String username, String appl_id)
 

Package Functions

String getJSONHeader ()
 
String getServerURL ()
 

Static Package Attributes

static String vis_type
 
static String title = ""
 
static String description = ""
 
static Integer MaxDescrSize = 1000
 
static String COMMA = ","
 
static String COLON = ":"
 
static String OPEN_CURLY = "{"
 
static String CLOSE_CURLY = "}"
 
static String OPEN_PAREN = "("
 
static String CLOSE_PAREN = ")"
 
static String OPEN_BOX = "["
 
static String CLOSE_BOX = "]"
 

Constructor & Destructor Documentation

◆ Bridges() [1/2]

bridges.connect.Bridges.Bridges ( )

Constructors

If the FORCE_BRIDGES_APIKEY environment variable is set, use the environment variable as APIkey in all cases.

If the FORCE_BRIDGES_USERNAME environment variable is set, use the environment variable as username in all cases.

If the FORCE_BRIDGES_ASSIGNMENT environment variable is set, use the environment variable as assignment number in all cases.

◆ Bridges() [2/2]

bridges.connect.Bridges.Bridges ( int  assignment,
String  username,
String  appl_id 
)

Initialize Bridges (Constructor)

If the FORCE_BRIDGES_APIKEY environment variable is set, use the environment variable as APIkey in all cases.

If the FORCE_BRIDGES_USERNAME environment variable is set, use the environment variable as username in all cases.

If the FORCE_BRIDGES_ASSIGNMENT environment variable is set, use the environment variable as assignment number in all cases.

Parameters
assignmentthis is the assignmen id (integer)
appl_idthis is the appl authentication key(from the Bridges account)
usernamethis is the username (from the Bridges account)

Member Function Documentation

◆ clearAssignment()

void bridges.connect.Bridges.clearAssignment ( )

This method deletes the user's current assignment from the Bridges server

Exceptions
IOException

◆ getAssignment()

static String bridges.connect.Bridges.getAssignment ( )
static

Get the assignment id.

Returns
assignment as a string

◆ getAssignmentID()

static int bridges.connect.Bridges.getAssignmentID ( )
static

Get the assignment id as an integer.

Returns
assignment as a string

◆ getDataSource()

DataSource bridges.connect.Bridges.getDataSource ( )

get the current data source object being used by BRIDGES

Returns
data source object

◆ getDebugFlag()

static Boolean bridges.connect.Bridges.getDebugFlag ( )
static

gets the debug flag value, used for debugging BRIDGES

Returns
boolean flag

◆ getJSONFlag()

boolean bridges.connect.Bridges.getJSONFlag ( )

Flag to control printing the JSON of the data structure. Used only for debugging BRIDGES.

Returns
check if the flag to output the JSON is set

◆ getJSONHeader()

String bridges.connect.Bridges.getJSONHeader ( )
package

◆ getKey()

static String bridges.connect.Bridges.getKey ( )
static

Get application key

Returns
application key value (string)

◆ getServerURL()

String bridges.connect.Bridges.getServerURL ( )
package

◆ getUserName()

static String bridges.connect.Bridges.getUserName ( )
static

This exists to prevent duplicate error traces.

Returns
user id (string)

◆ getVisualizeURL()

String bridges.connect.Bridges.getVisualizeURL ( )

◆ init()

void bridges.connect.Bridges.init ( int  assignment,
String  username,
String  appl_id 
)
protected

Initialize Bridges with assignment number, user name and application id

Parameters
assignmentthis is the assignmen id (integer)
appl_idthis is the appl authentication key(from the Bridges account)
usernamethis is the username (from the Bridges account)

◆ postVisualizationLink()

void bridges.connect.Bridges.postVisualizationLink ( boolean  link_url_flag)

This method is used to suppress the visualization link that is usually printed to the console

Parameters
link_url_flag- flag that controls if the link is printed to console
Returns
none

◆ setAssignment()

static void bridges.connect.Bridges.setAssignment ( int  assignment)
static

set the assignment id

Parameters
assignmentnumber (int)

◆ setCoordSystemType()

void bridges.connect.Bridges.setCoordSystemType ( String  coord)

Sets the coordinate system type.

Coordinate system type options are: ['cartesian', 'albersusa', 'equirectangular', 'window'], and 'cartesian' is the default; The "window" option only works for graphs and will automatically scale the view on the browser to include all vertices which have a fixed location. A different window can be specified using setWindow().

Parameters
coordthis is the desired coordinate space

◆ setDataStructure()

void bridges.connect.Bridges.setDataStructure ( DataStruct  ds) throws NullPointerException

Provide BRIDGES a handle to the data structure to be visualized.

This method sets the handle to the current data structure; this can be an array, the head of a linked list, root of a tree structure, a graph Arrays of upto 3 dimensions are suppported. It can be any of the data structures supported by BRIDGES. Polymorphism and type casting is used to determine the actual data structure and extract its representtion.

Parameters
dsThe data structure to set (any of the subclasses of DataStruct)

◆ setDebugFlag()

static void bridges.connect.Bridges.setDebugFlag ( Boolean  flag)
static

sets a debug flag, used for debugging BRIDGES

Parameters
flagboolean

◆ setDescription()

void bridges.connect.Bridges.setDescription ( String  description)

Change the textual description of the assignment.

This description is capped at MaxDescrSize characters.

Parameters
descriptiondescription to annotate the visualization;

◆ setDisplayMode()

void bridges.connect.Bridges.setDisplayMode ( String  mode) throws IllegalArgumentException

Set the current assignment display mode to slide or stack, or throw an error;

Parameters
modeOne of: ['slide', 'stack'].

◆ setJSONFlag()

void bridges.connect.Bridges.setJSONFlag ( boolean  flag)
Parameters
flagthe flag to print the JSON represenation of the data structure to standard output. Used for debugging BRIDGES

◆ setKey()

static void bridges.connect.Bridges.setKey ( String  key)
static

Set application key

Parameters
keyapplication key value (string)

◆ setLabelFlag()

void bridges.connect.Bridges.setLabelFlag ( boolean  flag)
Parameters
flagthe flag to turn labels on/off on the entire visualization

◆ setMap()

void bridges.connect.Bridges.setMap ( String  map,
String  info 
)

Sets the type of map overlay to use.

Parameters
mapthis is an Array describing the map overlay. The first element of the array is which map to use: "world" or "us" and the second element is what attribute from the map to show: a country from world map, or a state from US map.

◆ setMapOverlay()

void bridges.connect.Bridges.setMapOverlay ( Boolean  flag)

Turns on map overlay for subsequent visualizations - used with location specific datasets.

Parameters
flagthis is the boolean flag for displaying a map overlay

◆ setServer()

void bridges.connect.Bridges.setServer ( String  server)

sets the server type.

Options are: ['live', 'local', 'clone'], and 'live' is the default;

Parameters
serverserver to which to connect.

◆ setTitle()

void bridges.connect.Bridges.setTitle ( String  title)

Change the title of the assignment.

The title is capped at MaxTitleSize characters.

Parameters
titletitle used in the visualization;

◆ setUserName()

static void bridges.connect.Bridges.setUserName ( String  userName)
static

set User id

Parameters
userName(string)

◆ setWindow() [1/3]

void bridges.connect.Bridges.setWindow ( double  x1,
double  x2,
double  y1,
double  y2 
)

Specify the window that will be used to render the view by default.

This function enables specifying the window that will rendered by default in the view. This only works for graph data types. And the coordinate system need ot be set to "window" using setCoordSystemType().

@param x1   minimum window x
@param x2   maximum window x
@param y1   minimum window y
@param y2   maximum window y

◆ setWindow() [2/3]

void bridges.connect.Bridges.setWindow ( float  x1,
float  x2,
float  y1,
float  y2 
)

Specify the window that will be used to render the view by default.

This function enables specifying the window that will rendered by default in the view. This only works for graph data types. And the coordinate system need ot be set to "window" using setCoordSystemType().

@param x1   minimum window x
@param x2   maximum window x
@param y1   minimum window y
@param y2   maximum window y

◆ setWindow() [3/3]

void bridges.connect.Bridges.setWindow ( int  x1,
int  x2,
int  y1,
int  y2 
)

Specify the window that will be used to render the view by default.

This function enables specifying the window that will rendered by default in the view. This only works for graph data types. And the coordinate system need ot be set to "window" using setCoordSystemType().

Parameters
x1minimum window x
x2maximum window x
y1minimum window y
y2maximum window y

◆ visualize()

void bridges.connect.Bridges.visualize ( ) throws IOException, RateLimitException

This method generates the representation of the current data structure (JSON) and sends that to the Bridges server for generating a visualization.

Exceptions
RateLimitException
IOException

Member Data Documentation

◆ CLOSE_BOX

String bridges.connect.Bridges.CLOSE_BOX = "]"
staticpackage

◆ CLOSE_CURLY

String bridges.connect.Bridges.CLOSE_CURLY = "}"
staticpackage

◆ CLOSE_PAREN

String bridges.connect.Bridges.CLOSE_PAREN = ")"
staticpackage

◆ COLON

String bridges.connect.Bridges.COLON = ":"
staticpackage

◆ COMMA

String bridges.connect.Bridges.COMMA = ","
staticpackage

◆ description

String bridges.connect.Bridges.description = ""
staticpackage

◆ MaxDescrSize

Integer bridges.connect.Bridges.MaxDescrSize = 1000
staticpackage

◆ OPEN_BOX

String bridges.connect.Bridges.OPEN_BOX = "["
staticpackage

◆ OPEN_CURLY

String bridges.connect.Bridges.OPEN_CURLY = "{"
staticpackage

◆ OPEN_PAREN

String bridges.connect.Bridges.OPEN_PAREN = "("
staticpackage

◆ title

String bridges.connect.Bridges.title = ""
staticpackage

◆ vis_type

String bridges.connect.Bridges.vis_type
staticpackage

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