Marker tests added

#story[20]
This commit is contained in:
Erika Savell
2017-03-29 12:37:53 +13:00
parent eb4c02557d
commit 40a6801477
4 changed files with 79 additions and 38 deletions
@@ -187,43 +187,6 @@ public class RaceController extends Controller{
});
}
//
// /**
// * Function for the Bermuda Race.
// * @return legs in the Bermuda Race.
// */
// private ArrayList<Leg> generateBermudaCourseLegs() {
// ArrayList<Leg> legs = new ArrayList<>();
// Leg leg1 = new Leg("Start to Marker 1", Constants.startLineMarker1, Constants.startLineMarker2, Constants.mark1, null, 0);
// Leg leg2 = new Leg("Marker 1 to Leeward Gate", Constants.mark1, Constants.leewardGate1, 1);
// Leg leg3 = new Leg("Leeward Gate to Windward Gate", Constants.leewardGate1, Constants.windwardGate1, 2);
// Leg leg4 = new Leg("Windward Gate to Leeward Gate", Constants.windwardGate1, Constants.leewardGate1, 3);
// Leg leg5 = new Leg("Leeward Gate to Finish", Constants.leewardGate1, Constants.finishLineMarker1, 4);
// legs.add(leg1);
// legs.add(leg2);
// legs.add(leg3);
// legs.add(leg4);
// legs.add(leg5);
// return legs;
// }
//
// /**
// * Generates an example list of competitors (Official AC35 competitors)
// * @return List of official AC35 competing boats
// */
// private BoatInRace[] generateAC35Competitors() {
//
// BoatInRace[] boats = new BoatInRace[6];
//
// int i = 0;
// for (BoatInRace boat : Constants.OFFICIAL_AC35_COMPETITORS) {
// boat.setCurrentPosition(Constants.startLineMarker1);
// boats[i] = boat;
// i++;
// }
// return boats;
// }
/**
* Set the value for the race clock label
* @param time time that the label will be updated to
+21
View File
@@ -47,5 +47,26 @@ public class GPSCoordinate {
return String.format("Latitude: %f, Longitude: %f", latitude, longitude);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GPSCoordinate that = (GPSCoordinate) o;
if (Math.abs(this.latitude - latitude) > 1e-6) return false;
return (Math.abs(this.longitude - longitude) < 1e-6);
}
@Override
public int hashCode() {
int result;
long temp;
temp = Double.doubleToLongBits(latitude);
result = (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(longitude);
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ public class RaceXMLReader extends XMLReader{
GPSCoordinate side1 = getCoordinates((Element) nCoordinates.item(0));
GPSCoordinate side2;
if (nCoordinates.getLength() > 1) {
side2 = getCoordinates((Element) nCoordinates.item(0));
side2 = getCoordinates((Element) nCoordinates.item(1));
} else {
side2 = side1;
}