Created a setWind(bearing, knots) in Race, which updates the Wind with new values.

MockRace now uses Wind.
VisualiserRace now uses Wind.
#story[1093]
This commit is contained in:
fjc40
2017-08-01 18:45:17 +12:00
parent 5af3053537
commit 99f3310d8b
3 changed files with 43 additions and 22 deletions
@@ -166,8 +166,7 @@ public abstract class Race implements Runnable {
this.raceType = raceDataSource.getRaceType();
//Wind.
Wind wind = new Wind(Bearing.fromDegrees(0), 0);
this.raceWind.setValue(wind);
this.setWind(Bearing.fromDegrees(0), 0);
}
@@ -248,6 +247,18 @@ public abstract class Race implements Runnable {
return regattaName;
}
/**
* Updates the race to have a specified wind bearing and speed.
* @param windBearing New wind bearing.
* @param windSpeedKnots New wind speed, in knots.
*/
protected void setWind(Bearing windBearing, double windSpeedKnots) {
Wind wind = new Wind(windBearing, windSpeedKnots);
this.raceWind.setValue(wind);
}
/**
* Returns the wind bearing.
* @return The wind bearing.