@ -22,12 +22,12 @@ import java.util.List;
* /
public class StreamedRace implements Runnable {
private final VisualiserInput visualiserInput ;
pr otected final ObservableList < Boat > startingBoats ;
pr otected final ObservableList < Marker > boatMarkers ;
pr otected final List < Leg > legs ;
pr ivate final ObservableList < Boat > startingBoats ;
pr ivate final ObservableList < Marker > boatMarkers ;
pr ivate final List < Leg > legs ;
private RaceController controller ;
protected FinishController finishController ;
pr otected int boatsFinished = 0 ;
pr ivate int boatsFinished = 0 ;
private long totalTimeElapsed ;
private int lastFPS = 20 ;
@ -46,7 +46,7 @@ public class StreamedRace implements Runnable {
this . visualiserInput = visualiserInput ;
}
p ublic void initialiseBoats ( ) {
p rivate void initialiseBoats ( ) {
Leg officialStart = legs . get ( 0 ) ;
String name = officialStart . getName ( ) ;
Marker endMarker = officialStart . getEndMarker ( ) ;
@ -75,7 +75,7 @@ public class StreamedRace implements Runnable {
* @param boat Boat that the position is to be updated for .
* @param timeElapsed Time that has elapse since the start of the the race .
* /
pr otected void checkPosition ( Boat boat , long timeElapsed ) {
pr ivate void checkPosition ( Boat boat , long timeElapsed ) {
StreamedCourse raceData = visualiserInput . getCourse ( ) ;
BoatStatus boatStatusMessage = visualiserInput . getBoatStatusMap ( ) . get ( boat . getSourceID ( ) ) ;
if ( boatStatusMessage ! = null ) {
@ -95,7 +95,7 @@ public class StreamedRace implements Runnable {
boatsFinished + + ;
boat . setTimeFinished ( timeElapsed ) ;
boat . setFinished ( true ) ;
System . out . println ( "Boat finished" ) ;
//System.out.println("Boat finished");
}
}
//Update the boat display table in the GUI to reflect the leg change
@ -108,7 +108,7 @@ public class StreamedRace implements Runnable {
* @param boat to be updated
* @param millisecondsElapsed time since last update
* /
pr otected void updatePosition ( Boat boat , int millisecondsElapsed ) {
pr ivate void updatePosition ( Boat boat , int millisecondsElapsed ) {
int sourceID = boat . getSourceID ( ) ;
BoatLocation boatLocation = visualiserInput . getBoatLocationMessage ( sourceID ) ;
if ( boatLocation ! = null ) {
@ -126,7 +126,7 @@ public class StreamedRace implements Runnable {
*
* @param mark to be updated
* /
pr otected void updateMarker ( Marker mark ) {
pr ivate void updateMarker ( Marker mark ) {
int sourceID = mark . getSourceId1 ( ) ;
BoatLocation boatLocation1 = visualiserInput . getBoatLocationMessage ( sourceID ) ;
if ( boatLocation1 ! = null ) {
@ -143,16 +143,6 @@ public class StreamedRace implements Runnable {
}
}
/ * *
* sets the position of a boat from coordinate
* @param boat the boat to set
* @param coordinate the position of the boat
* /
protected void setPosition ( Boat boat , GPSCoordinate coordinate ) {
boat . setCurrentPosition ( coordinate ) ;
}
public void setController ( RaceController controller ) {
this . controller = controller ;
}
@ -164,7 +154,7 @@ public class StreamedRace implements Runnable {
public void run ( ) {
setControllerListeners ( ) ;
initialiseBoats ( ) ;
s imulateRace ( ) ;
s tartRaceStream ( ) ;
}
@ -181,7 +171,7 @@ public class StreamedRace implements Runnable {
* Starts the Race Simulation , playing the race start to finish with the timescale .
* This prints the boats participating , the order that the events occur in time order , and the respective information of the events .
* /
private void s imulateRace ( ) {
private void s tartRaceStream ( ) {
System . setProperty ( "javafx.animation.fullspeed" , "true" ) ;
@ -235,7 +225,7 @@ public class StreamedRace implements Runnable {
/ * *
* Update position of boats in race , no position if on starting leg or DNF .
* /
pr otected void updatePositions ( ) {
pr ivate void updatePositions ( ) {
FXCollections . sort ( startingBoats , ( a , b ) - > b . getCurrentLeg ( ) . getLegNumber ( ) - a . getCurrentLeg ( ) . getLegNumber ( ) ) ;
for ( Boat boat : startingBoats ) {
if ( boat ! = null ) {