Refactored BoatInRace currentLegName property
-Removed current leg name as current leg was already being stored so it was redundant #refactor #story[15]
This commit is contained in:
@@ -20,7 +20,6 @@ public class BoatInRace extends Boat {
|
||||
private long timeFinished;
|
||||
private Color colour;
|
||||
private boolean finished = false;
|
||||
private StringProperty currentLegName;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
@@ -31,7 +30,6 @@ public class BoatInRace extends Boat {
|
||||
public BoatInRace(String name, double velocity, Color colour, String abbrev) {
|
||||
super(name, velocity, abbrev);
|
||||
setColour(colour);
|
||||
currentLegName = new SimpleStringProperty("");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,10 +90,15 @@ public class BoatInRace extends Boat {
|
||||
*/
|
||||
public void setCurrentLeg(Leg currentLeg) {
|
||||
this.currentLeg = currentLeg;
|
||||
this.currentLegName.setValue(currentLeg.getName());
|
||||
}
|
||||
|
||||
public StringProperty getCurrentLegName(){
|
||||
|
||||
StringProperty currentLegName = new SimpleStringProperty("");
|
||||
if (currentLeg != null) {
|
||||
currentLegName.setValue(currentLeg.getName());
|
||||
}
|
||||
|
||||
return currentLegName;
|
||||
}
|
||||
|
||||
@@ -132,7 +135,6 @@ public class BoatInRace extends Boat {
|
||||
this.finished = bool;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the bearing of the travel via map coordinates of the raceMarkers
|
||||
* @return the heading that the boat is heading towards in degrees.
|
||||
|
||||
Reference in New Issue
Block a user