RiverRat  - An MIT iCampus project http://web.mit.edu/riverrat/

Main Page | Software Documentation | Hardware Documentation | People | Contact | Wiki

Main Page | Class Hierarchy | Class List | File List | Class Members

riverrat.Race Class Reference

Finished prototype - Handles all the data involved with a specific Race, and handles the communications API used to recieve the XML stream pushed by the Radio Server/Content Server. More...

Inheritance diagram for riverrat.Race:

riverrat.LiveRace riverrat.PlaybackRace List of all members.

Public Member Functions

 Race ()
 Default constructor.

 Race (String host, int port)
 Constructor.

synchronized int numBoats ()
 Returns the number of Boats in the target Race.

synchronized int numMarks ()
 Returns the number of Marks in the target Race.

synchronized void addBoat (Boat newboat)
 Adds a Boat to the Race.

synchronized void addMark (Mark newmark)
 Adds a Mark to the Race.

synchronized void addRaceObject (RaceObject newobject)
 Adds a RaceObject (either a Boat or Mark) to the Race.

synchronized Boat getBoat (int id) throws NoSuchObjectException
 Returns the Boat object with a specific id.

synchronized Mark getMark (int id) throws NoSuchObjectException
 Returns a Mark object with a specific id.

synchronized long getStartTime ()
 Returns the start time of the race, in System.time format.

synchronized int getMode ()
 Returns the mode that the Race data puller is currently in, which can be either MODE_SETUP, MODE_LIVE, or MODE_NONE.

synchronized String getName ()
 Returns the name of the current Regatta or Race.

synchronized int getNum ()
 Returns the number of the current Race in the current Regatta.

synchronized int getID ()
 Returns the unique ID of the current Race.

void startDocument () throws SAXException
 Part of the ContentHandler interface.

void startElement (String uri, String localpart, String rawname, Attributes attrs) throws SAXException
 Part of the ContentHandler interface.

void endDocument () throws SAXException
 Part of the ContentHandler inteface.

void endElement (String uri, String localpart, String rawname) throws SAXException
 Part of the ContentHandler interface.

void characters (char[] ch, int start, int length) throws SAXException
 Part of the ContentHandler interface, unused.

void endPrefixMapping (String prefix) throws SAXException
 Part of the ContentHandler interface, unused.

void ignorableWhitespace (char[] ch, int start, int length) throws SAXException
 Part of the ContentHandler interface, unused.

void processingInstruction (String target, String data) throws SAXException
 Part of the ContentHandler interface, unused.

void setDocumentLocator (Locator locator)
 Part of the ContentHandler interface, unused.

void skippedEntity (String name) throws SAXException
 Part of the ContentHandler interface, unused.

void startPrefixMapping (String prefix, String uri) throws SAXException
 Part of the ContentHandler interface, unused.


Static Public Member Functions

void main (String args[])
 Test case, spawns RiverRatListener and fills the Race.


Static Public Attributes

final int MODE_FINISHED = 3
 The Race XML handler is not ready to recieve data, and the Race is over.

final int MODE_LIVE = 2
 The Race XML handler is in the Live mode, and is ready to receive updates from Marks and Boats.

final int MODE_SETUP = 1
 The Race XML handler is in the Setup mode, and is ready to receive updates about configuration and the states of Marks and Boats.

final int MODE_NONE = 0
 The Race XML handler is not in any mode, and is not ready to receive any information besides a tag specifying a new mode.


Package Attributes

RiverRatListener rrlistener
 Listener used to receive XML stream.

Thread listenthread
 Thread for Listener class.

Vector boatlist
 Vector of boats involved with the Race.

Vector marklist
 Vector of marks involved with the Race.

long starttime
 Starting time of the Race, in System.time format.

int mode
 Mode of the Race XML handler.

String name
 Name of the Regatta the Race is in, or the name of the Race if there is a single Race.

int racenum
 Number of the Race in the given Regatta.

int raceid
 Race ID, a unique identifier.


Detailed Description

Finished prototype - Handles all the data involved with a specific Race, and handles the communications API used to recieve the XML stream pushed by the Radio Server/Content Server.

Definition at line 15 of file Race.java.


Constructor & Destructor Documentation

riverrat.Race.Race  ) 
 

Default constructor.

Initializes a new Race, sets the starting time to -1.

Definition at line 93 of file Race.java.

References riverrat.Race.boatlist, riverrat.Race.marklist, and riverrat.Race.starttime.

Referenced by riverrat.Race.main().

riverrat.Race.Race String  host,
int  port
 

Constructor.

Takes a host and port as arguments, and passes them to the stream listener to open a connection. Sets the starting time to -1.

Parameters:
host String with hostname to connect to port int with port to connect to

Definition at line 107 of file Race.java.

References riverrat.Race.listenthread, and riverrat.Race.rrlistener.


Member Function Documentation

synchronized void riverrat.Race.addBoat Boat  newboat  ) 
 

Adds a Boat to the Race.

Parameters:
newboat Boat to be added

Definition at line 137 of file Race.java.

References riverrat.Race.boatlist.

Referenced by riverrat.Race.addRaceObject(), and riverrat.Race.startElement().

synchronized void riverrat.Race.addMark Mark  newmark  ) 
 

Adds a Mark to the Race.

Parameters:
newmark Mark to be added

Definition at line 146 of file Race.java.

References riverrat.Race.marklist.

Referenced by riverrat.Race.addRaceObject(), and riverrat.Race.startElement().

synchronized void riverrat.Race.addRaceObject RaceObject  newobject  ) 
 

Adds a RaceObject (either a Boat or Mark) to the Race.

Parameters:
newobject RaceObject to be added

Definition at line 155 of file Race.java.

References riverrat.Race.addBoat(), and riverrat.Race.addMark().

void riverrat.Race.endDocument  )  throws SAXException
 

Part of the ContentHandler inteface.

Called when the parser hits the end of an XML document. This should only happen once per race, at the end of the race.

Definition at line 353 of file Race.java.

void riverrat.Race.endElement String  uri,
String  localpart,
String  rawname
throws SAXException
 

Part of the ContentHandler interface.

Called when the parser hits the beginning of an XML element.

Definition at line 361 of file Race.java.

References riverrat.Race.mode, riverrat.Race.MODE_FINISHED, and riverrat.Race.MODE_NONE.

synchronized Boat riverrat.Race.getBoat int  id  )  throws NoSuchObjectException
 

Returns the Boat object with a specific id.

Parameters:
id int with the id number of the desired boat
Returns:
Boat with that id

Definition at line 166 of file Race.java.

References riverrat.Race.boatlist.

Referenced by riverrat.Race.main(), and riverrat.Race.startElement().

synchronized int riverrat.Race.getID  ) 
 

Returns the unique ID of the current Race.

Returns:
int with the ID of the current Race.

Definition at line 232 of file Race.java.

References riverrat.Race.raceid.

synchronized Mark riverrat.Race.getMark int  id  )  throws NoSuchObjectException
 

Returns a Mark object with a specific id.

Parameters:
id int with the id number of the desired mark
Returns:
Mark with that id

Definition at line 181 of file Race.java.

References riverrat.Race.marklist.

Referenced by riverrat.Race.startElement().

synchronized int riverrat.Race.getMode  ) 
 

Returns the mode that the Race data puller is currently in, which can be either MODE_SETUP, MODE_LIVE, or MODE_NONE.

Returns:
int with the mode of the race

Definition at line 205 of file Race.java.

References riverrat.Race.mode.

Referenced by riverrat.Race.main().

synchronized String riverrat.Race.getName  ) 
 

Returns the name of the current Regatta or Race.

Returns:
String with the Regatta or Race name

Definition at line 214 of file Race.java.

References riverrat.Race.name.

synchronized int riverrat.Race.getNum  ) 
 

Returns the number of the current Race in the current Regatta.

Returns:
int with the number of the current Race

Definition at line 223 of file Race.java.

References riverrat.Race.racenum.

synchronized long riverrat.Race.getStartTime  ) 
 

Returns the start time of the race, in System.time format.

Returns:
long with the start time of the race

Definition at line 195 of file Race.java.

References riverrat.Race.starttime.

synchronized int riverrat.Race.numBoats  ) 
 

Returns the number of Boats in the target Race.

Returns:
int with the number of Boats

Definition at line 119 of file Race.java.

References riverrat.Race.boatlist.

Referenced by riverrat.Race.main().

synchronized int riverrat.Race.numMarks  ) 
 

Returns the number of Marks in the target Race.

Returns:
int with the number of Marks

Definition at line 128 of file Race.java.

References riverrat.Race.marklist.

void riverrat.Race.startDocument  )  throws SAXException
 

Part of the ContentHandler interface.

Called when the parser hits the beginning of an XML document. This should only happen once per race, at the beginning of the race.

Definition at line 241 of file Race.java.

void riverrat.Race.startElement String  uri,
String  localpart,
String  rawname,
Attributes  attrs
throws SAXException
 

Part of the ContentHandler interface.

Called when the parser hits the beginning of an XML element.

Definition at line 249 of file Race.java.

References riverrat.Race.addBoat(), riverrat.Race.addMark(), riverrat.Race.getBoat(), riverrat.Race.getMark(), riverrat.Race.mode, riverrat.Race.MODE_LIVE, riverrat.Race.MODE_SETUP, riverrat.Race.name, riverrat.Race.raceid, riverrat.Race.racenum, riverrat.RaceObject.setSN(), riverrat.Race.starttime, and riverrat.RaceObject.update().


Member Data Documentation

Thread riverrat.Race.listenthread [package]
 

Thread for Listener class.

Must run multithreaded so that parsing does not block action from happening in the parent application (e.g. the GUI). If RiverRatListener is a thread instead of this class, implementation in the parent application is easier.

Definition at line 56 of file Race.java.

Referenced by riverrat.Race.Race().

int riverrat.Race.mode [package]
 

Mode of the Race XML handler.

This can be Race.MODE_NONE, Race.MODE_LIVE, or Race.MODE_SETUP.

Definition at line 71 of file Race.java.

Referenced by riverrat.Race.endElement(), riverrat.Race.getMode(), and riverrat.Race.startElement().

final int riverrat.Race.MODE_FINISHED = 3 [static]
 

The Race XML handler is not ready to recieve data, and the Race is over.

A new Race must be started (created) to recieve data. This is the case after the closing race element.

Definition at line 21 of file Race.java.

Referenced by riverrat.Race.endElement(), and riverrat.Race.main().

final int riverrat.Race.MODE_LIVE = 2 [static]
 

The Race XML handler is in the Live mode, and is ready to receive updates from Marks and Boats.

This is the case when the XML stream is inside a live element.

Definition at line 28 of file Race.java.

Referenced by riverrat.Race.startElement().

final int riverrat.Race.MODE_NONE = 0 [static]
 

The Race XML handler is not in any mode, and is not ready to receive any information besides a tag specifying a new mode.

This occurs when the XML stream is not inside a setup or live element.

Definition at line 42 of file Race.java.

Referenced by riverrat.Race.endElement().

final int riverrat.Race.MODE_SETUP = 1 [static]
 

The Race XML handler is in the Setup mode, and is ready to receive updates about configuration and the states of Marks and Boats.

This is the case when the XML stream is inside a setup element.

Definition at line 35 of file Race.java.

Referenced by riverrat.Race.startElement().

String riverrat.Race.name [package]
 

Name of the Regatta the Race is in, or the name of the Race if there is a single Race.

Definition at line 77 of file Race.java.

Referenced by riverrat.Race.getName(), and riverrat.Race.startElement().

int riverrat.Race.raceid [package]
 

Race ID, a unique identifier.

Every Race has a unique identifier that refers to it in a Race database.

Definition at line 88 of file Race.java.

Referenced by riverrat.Race.getID(), and riverrat.Race.startElement().

int riverrat.Race.racenum [package]
 

Number of the Race in the given Regatta.

Definition at line 82 of file Race.java.

Referenced by riverrat.Race.getNum(), and riverrat.Race.startElement().

RiverRatListener riverrat.Race.rrlistener [package]
 

Listener used to receive XML stream.

Initializes the incoming XML stream and starts parsing using this class for callbacks.

Definition at line 48 of file Race.java.

Referenced by riverrat.Race.Race().


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

Brought to you by the RiverRat team.