Did some minor refactoring of Mock module...

Added comments/documentation to most classes.
Cleaned up heaps of repeated code, dead code, redundant stuff, etc...

Mock.App:
Now actually exits the program if catastrophic errors occur, rather than silently doing nothing.

Mock.Constants:
Added race prestart and preparatory times.
Removed TEST_VELOCITIES.

Mock.PolarParser:
Now uses Bearing class.

Mock.Angle:
Now implements the Comparable interface.
Also supports .equals.

Mock.Azimuth and Bearing:
Can convert between them easily.

Mock.Boat:
Now uses Bearing, and has some helper functions like setVMG, calculateMetersTravelled(time), moveforwards(distance, time).

Mock.Marker:
Removed. This wasn't really used, and was redundant.

Mock.GPSCoordinate:
Moved a lot of helper GPS related functions into the GPSCoordinate class, instead of being scattered around the codebase.

Mock.Polars:
Polars now uses Bearing.

Mock.VMG:
Now uses Bearing.

Mock.Race:
Added a RaceStatusEnum member.
Added a RaceTypeEnum member.
Now uses Bearing/Azimuth.
Moved the message creation/sending into their own functions.
The RaceStatus updates correctly through out the race (Prestart, Warning, Preparatory, Started, Finished).

Network.RaceStatusEnum:
Added race status enum.

Network.RaceTypeEnum:
Added.
This commit is contained in:
fjc40
2017-05-19 16:12:47 +12:00
parent a0468f251b
commit c011ccb11b
27 changed files with 1693 additions and 681 deletions
@@ -83,6 +83,7 @@ public class StreamedRace implements Runnable {
int legNumber = boatStatusMessage.getLegNumber();
if (legNumber >= 1 && legNumber < legs.size()) {
boat.setCurrentLeg(legs.get(legNumber));
}
@@ -95,9 +96,9 @@ public class StreamedRace implements Runnable {
boatsFinished++;
boat.setTimeFinished(timeElapsed);
boat.setFinished(true);
//System.out.println("Boat finished");
}
}
//Update the boat display table in the GUI to reflect the leg change
updatePositions();
}