Reformatted doctring and import statements

This commit is contained in:
Haoming Yin
2017-03-08 14:45:06 +13:00
parent 245fbc75c2
commit b0cd7c8c08
17 changed files with 773 additions and 722 deletions
+105 -97
View File
@@ -3,117 +3,125 @@ package seng302;
import java.text.SimpleDateFormat;
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 {
private long time;
private Boat boat;
private Leg leg;
private boolean isFinishingEvent = false;
private long time;
private Boat boat;
private Leg leg;
private boolean isFinishingEvent = false;
public Event(long eventTime, Boat eventBoat, Leg eventLeg) {
this.time = eventTime;
this.boat = eventBoat;
this.leg = eventLeg;
}
/**
* 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 Event(long eventTime, Boat eventBoat, Leg eventLeg) {
this.time = eventTime;
this.boat = eventBoat;
this.leg = eventLeg;
}
public Event(long eventTime, Boat eventBoat, Leg eventLeg, boolean isFinishingEvent) {
this.time = eventTime;
this.boat = eventBoat;
this.leg = eventLeg;
this.isFinishingEvent = isFinishingEvent;
}
public Event(long eventTime, Boat eventBoat, Leg eventLeg, boolean isFinishingEvent) {
this.time = eventTime;
this.boat = eventBoat;
this.leg = eventLeg;
this.isFinishingEvent = isFinishingEvent;
}
/**
* Sets the time for the event
* @param eventTime the time for event in millisecond
*/
public void setTime(long eventTime) {
this.time = eventTime;
}
/**
* Gets the time for the event
*
* @return the time for event in millisecond
*/
public long getTime() {
return this.time;
}
/**
* Gets the time for the event
* @return the time for event in millisecond
*/
public long getTime() {
return this.time;
}
/**
* Sets the time for the event
*
* @param eventTime the time for event in millisecond
*/
public void setTime(long eventTime) {
this.time = eventTime;
}
/**
* Gets the time in a formatted string
* @return the string of time
*/
public String getTimeString() {
return (new SimpleDateFormat("mm:ss:SSS")).format(new Date(time));
}
/**
* Gets the time in a formatted string
*
* @return the string of time
*/
public String getTimeString() {
return (new SimpleDateFormat("mm:ss:SSS")).format(new Date(time));
}
/**
* Sets the involved boat
* @param eventBoat the involved boat
*/
public void setBoat(Boat eventBoat) {
this.boat = eventBoat;
}
/**
* Gets the involved boat
*
* @return the boat involved in the event
*/
public Boat getBoat() {
return this.boat;
}
/**
* Gets the involved boat
* @return the boat involved in the event
*/
public Boat getBoat() {
return this.boat;
}
/**
* Sets the involved boat
*
* @param eventBoat the involved boat
*/
public void setBoat(Boat eventBoat) {
this.boat = eventBoat;
}
/**
* Sets the involved location/leg
* @param eventLeg the involved leg
*/
public void setLeg(Leg eventLeg) {
this.leg = eventLeg;
}
/**
* Gets the involved location/leg
*
* @return the leg involved in the event
*/
public Leg getLeg() {
return this.leg;
}
/**
* Gets the involved location/leg
* @return the leg involved in the event
*/
public Leg getLeg() {
return this.leg;
}
/**
* Sets the involved location/leg
*
* @param eventLeg the involved leg
*/
public void setLeg(Leg eventLeg) {
this.leg = eventLeg;
}
/**
* 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);
}
/**
* 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);
}
/**
* Returns true if this event is the boat finishing the race
*
*/
public boolean getIsFinishingEvent(){
return this.isFinishingEvent;
}
/**
* Returns true if this event is the boat finishing the race
*/
public boolean getIsFinishingEvent() {
return this.isFinishingEvent;
}
/**
* 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());
/**
* 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());
if (this.isFinishingEvent){
return (this.getTimeString() + ", " + this.getBoat().getTeamName() + " finished the race");
}
if (this.isFinishingEvent) {
return (this.getTimeString() + ", " + this.getBoat().getTeamName() + " finished the race");
}
return (this.getTimeString() + ", " + this.getBoat().getTeamName() + " passed " + this.getLeg().getMarkerLabel() + " going heading " + currentHeading + "°");
}
return (this.getTimeString() + ", " + this.getBoat().getTeamName() + " passed " + this.getLeg().getMarkerLabel() + " going heading " + currentHeading + "°");
}
}