Race events now display the boats heading and direction

- The boats velocity is being read from the config file
- The event text is now being printed when the leg starts #fix

Tags: #story[7] #implement
This commit is contained in:
Michael Rausch
2017-03-08 12:31:31 +13:00
parent 76faa53222
commit ab1445f1c2
8 changed files with 130 additions and 57 deletions
+23
View File
@@ -6,6 +6,10 @@ import java.util.Date;
/**
* Event class containing the time of specific event, related team/boat, and
* event location such as leg.
*
* @param eventTime, what time the event happens
* @param eventBoat, the boat that the event belongs to
* @param eventLeg, the leg the event happens on
*/
public class Event {
@@ -74,4 +78,23 @@ public class Event {
public Leg getLeg() {
return this.leg;
}
/**
* Call when the boat reaches the marker, this will tell the marker the order
* in which boats pass it
*/
public void addBoatToMarker(){
this.leg.addBoatToMarker(boat);
}
/**
* Get a string that contains the timestamp and course information for this event
* @return A string that contains the timestamp and course information for this event
*/
public String getEventString(){
String currentHeading = Integer.toString(this.getLeg().getHeading());
String velocityKnots = String.format("%1.2f", this.getBoat().getVelocity() * 1.943844492); // Convert meters/second to knots
return (this.getTimeString() + ", " + this.getBoat().getTeamName() + " passed " + this.getLeg().getMarkerLabel() + " going heading " + currentHeading + " at " + velocityKnots + " knots.");
}
}