Bridges-Java-3.0.2  3.0.2
Bridges(JavaAPI)
Public Member Functions | Static Public Member Functions | 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

http://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 teh 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
http://bridgesuncc.github.io/Hello_World_Tutorials/Overview.html

Public Member Functions

 Bridges ()
 
DataSource getDataSource ()
 
 Bridges (int assignment, String username, String appl_id)
 
void init (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)
 
void setMapOverlay (Boolean flag)
 
void setDisplayMode (String mode) throws IllegalArgumentException
 
void setCoordSystemType (String coord)
 
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 visualizeJSON ()
 
void setVisualizeJSON (boolean flag)
 
void setDataStructure (DataStruct ds) throws NullPointerException
 
void clearAssignment ()
 
void visualize () throws IOException, RateLimitException
 

Static Public Member Functions

static void setDebugFlag (Boolean flag)
 
static Boolean getDebugFlag ()
 
static String getAssignment ()
 
static int getAssignmentID ()
 
static void setAssignment (int assignment)
 
static String getUserName ()
 
static void setUserName (String userName)
 
static String getKey ()
 
static void setKey (String key)
 

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

◆ getDataSource()

DataSource bridges.connect.Bridges.getDataSource ( )

◆ getDebugFlag()

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

◆ getKey()

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

Get application key

Returns
application key value (string)

◆ getUserName()

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

This exists to prevent duplicate error traces.

Returns
user id (string)

◆ init()

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

Initialize Bridges

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)

◆ 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)
Parameters
coordthis is the desired coordinate space argument 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().

◆ setDataStructure()

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

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

◆ 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'].

◆ setKey()

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

Set application key

Parameters
keyapplication key value (string)

◆ 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)
Parameters
serverserver to which to connect. Options are: ['live', 'local', 'clone'], and 'live' is the default;

◆ 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)

◆ setVisualizeJSON()

void bridges.connect.Bridges.setVisualizeJSON ( boolean  flag)
Parameters
flagthe flag to print the JSON represenation of the data structure to standard output

◆ setWindow() [1/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
y1minimum window y
x2maximum window x
y2maximum 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().

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

◆ setWindow() [3/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().

Parameters
x1minimum window x
y1minimum window y
x2maximum window x
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

◆ visualizeJSON()

boolean bridges.connect.Bridges.visualizeJSON ( )
Returns
check if the flag to output the JSON is set

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