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.RaceObject Class Reference

Finished prototype - Provides a generalized object for physical objects involved in a Race. More...

Inheritance diagram for riverrat.RaceObject:

riverrat.Boat riverrat.Mark riverrat.DynamicMark riverrat.StaticMark List of all members.

Public Member Functions

 RaceObject ()
 Default constructor.

 RaceObject (int newid)
 Constructor.

Vector getTrack ()
 Returns a Vector representing the track of position locations for the target.

void setTrackLength (int length)
 Sets the maximum track length to a specified value.

float getHeading ()
 Returns a float with the target's heading in radians.

Fix getFix ()
 Returns a Fix with the target's current position.

float getLat ()
 Returns a float with the target's current latitude in decimal degrees.

float getLon ()
 Returns a float with the target's current longitude in decimal degrees.

int getID ()
 Returns the target's id.

int getSN ()
 Returns the target's serial number (sn).

void setSN (int newsn)
 Sets the target's serial number (sn).

void update (Fix newfix)
 Updates the target's current position with a Fix.

String objectToString ()
 Returns a String with the target's id, Fix (using Fix.fixToString()) and heading in decimal degrees.


Package Attributes

Fix thefix
Vector track
int id
int sn
int tracklength = 5000

Static Package Attributes

final boolean DEBUG = false

Detailed Description

Finished prototype - Provides a generalized object for physical objects involved in a Race.

From a physical point of view, these may be boats, marks, finish lines, different types of boats, etc.

A RaceObject has a current position, an id, and a position history.

Definition at line 12 of file RaceObject.java.


Constructor & Destructor Documentation

riverrat.RaceObject.RaceObject  ) 
 

Default constructor.

Creates a RaceObject with id of -1, a Fix with the default constructor, and a track with an empty Vector.

Definition at line 26 of file RaceObject.java.

riverrat.RaceObject.RaceObject int  newid  ) 
 

Constructor.

Creates a RaceObject with a specific id, a Fix with the default constructor, and a track with an empty Vector.

Parameters:
newid specifies the id of the RaceObject to be created.

Definition at line 38 of file RaceObject.java.


Member Function Documentation

Fix riverrat.RaceObject.getFix  ) 
 

Returns a Fix with the target's current position.

Returns:
a Fix with the current position.

Definition at line 77 of file RaceObject.java.

float riverrat.RaceObject.getHeading  ) 
 

Returns a float with the target's heading in radians.

Returns:
a float with the heading in radians.

Definition at line 68 of file RaceObject.java.

References riverrat.Fix.getHeading().

int riverrat.RaceObject.getID  ) 
 

Returns the target's id.

Returns:
an int with the target's id

Definition at line 106 of file RaceObject.java.

float riverrat.RaceObject.getLat  ) 
 

Returns a float with the target's current latitude in decimal degrees.

Returns:
a float with the current latitude

Definition at line 87 of file RaceObject.java.

References riverrat.Fix.getLat().

float riverrat.RaceObject.getLon  ) 
 

Returns a float with the target's current longitude in decimal degrees.

Returns:
a float with the current longitude

Definition at line 97 of file RaceObject.java.

References riverrat.Fix.getLon().

int riverrat.RaceObject.getSN  ) 
 

Returns the target's serial number (sn).

Returns:
an int with the target's sn

Definition at line 115 of file RaceObject.java.

Vector riverrat.RaceObject.getTrack  ) 
 

Returns a Vector representing the track of position locations for the target.

Returns:
a Vector of previous Fixes

Definition at line 50 of file RaceObject.java.

String riverrat.RaceObject.objectToString  ) 
 

Returns a String with the target's id, Fix (using Fix.fixToString()) and heading in decimal degrees.

Returns:
a String with the target's major data.

Definition at line 169 of file RaceObject.java.

References riverrat.Fix.fixToString(), and riverrat.Fix.getHeading().

void riverrat.RaceObject.setSN int  newsn  ) 
 

Sets the target's serial number (sn).

Parameters:
newsn an int with the new serial number

Definition at line 124 of file RaceObject.java.

Referenced by riverrat.Race.startElement().

void riverrat.RaceObject.setTrackLength int  length  ) 
 

Sets the maximum track length to a specified value.

Parameters:
length specifies the new maximum length of the track

Definition at line 59 of file RaceObject.java.

void riverrat.RaceObject.update Fix  newfix  ) 
 

Updates the target's current position with a Fix.

Shifts the current position into the top of the track Vector, and updates the target's heading based on the previous position, if the heading has not already been defined in the argument Fix. The track Vector is managed to ensure that it stays the right size.

Parameters:
newfix a Fix with the new position

Reimplemented in riverrat.DynamicMark, and riverrat.StaticMark.

Definition at line 138 of file RaceObject.java.

References riverrat.Fix.getHeading(), riverrat.Fix.getLat(), riverrat.Fix.getLon(), and riverrat.Fix.setHeading().

Referenced by riverrat.Race.startElement().


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

Brought to you by the RiverRat team.