From 71995accfbdd26e5706781f47172234d7d95afd8 Mon Sep 17 00:00:00 2001 From: Erika Savell Date: Wed, 22 Mar 2017 11:22:05 +1300 Subject: [PATCH] Refactored BoatInRace currentLegName property -Removed current leg name as current leg was already being stored so it was redundant #refactor #story[15] --- src/main/java/seng302/Model/BoatInRace.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/seng302/Model/BoatInRace.java b/src/main/java/seng302/Model/BoatInRace.java index 560feb21..c20770ea 100644 --- a/src/main/java/seng302/Model/BoatInRace.java +++ b/src/main/java/seng302/Model/BoatInRace.java @@ -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.