David Wu 9 years ago
commit d08a1c325f

@ -19,7 +19,7 @@ public class App extends Application {
/** /**
* Entry point for running the programme * Entry point for running the programme
* *
* @param args * @param args for starting the programme
*/ */
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);
@ -28,8 +28,8 @@ public class App extends Application {
/** /**
* Loads and sets up the GUI elements * Loads and sets up the GUI elements
* *
* @param primaryStage * @param primaryStage Base for all scenes
* @throws Exception * @throws Exception Error in initialising programme
*/ */
@Override @Override
public void start(Stage primaryStage) throws Exception { public void start(Stage primaryStage) throws Exception {
@ -58,8 +58,8 @@ public class App extends Application {
/** /**
* Loads panes for use in the GUI * Loads panes for use in the GUI
* *
* @param fxmlName * @param fxmlName name of resource fxml file
* @throws Exception * @throws Exception critical error in loading file
*/ */
public void loadPane(String fxmlName) throws Exception { public void loadPane(String fxmlName) throws Exception {
FXMLLoader loader = new FXMLLoader(); FXMLLoader loader = new FXMLLoader();

@ -16,7 +16,7 @@ public abstract class Controller implements Initializable {
/** /**
* Sets the parent of the application * Sets the parent of the application
* *
* @param parent * @param parent controller
*/ */
public void setParent(App parent) { public void setParent(App parent) {
this.parent = parent; this.parent = parent;
@ -25,8 +25,8 @@ public abstract class Controller implements Initializable {
/** /**
* Sets the loads a pane into the parent. * Sets the loads a pane into the parent.
* *
* @param fxmlName * @param fxmlName fxml resource file to be loaded
* @throws Exception * @throws Exception error in loading file
*/ */
public void loadPane(String fxmlName) throws Exception { public void loadPane(String fxmlName) throws Exception {
this.parent.loadPane(fxmlName); this.parent.loadPane(fxmlName);
@ -35,8 +35,8 @@ public abstract class Controller implements Initializable {
/** /**
* Initialisation class that is run on start up. * Initialisation class that is run on start up.
* *
* @param location * @param location resources location
* @param resources * @param resources resources bundle
*/ */
@Override @Override
public abstract void initialize(URL location, ResourceBundle resources); public abstract void initialize(URL location, ResourceBundle resources);

@ -11,8 +11,8 @@ public class MainController extends Controller {
/** /**
* Main Controller for the applications will house the menu and the displayed pane. * Main Controller for the applications will house the menu and the displayed pane.
* *
* @param location * @param location of resources
* @param resources * @param resources bundle
*/ */
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {

@ -18,6 +18,7 @@ public class Boat {
* *
* @param name Name of the Boat. * @param name Name of the Boat.
* @param velocity Speed in m/s that the boat travels at. * @param velocity Speed in m/s that the boat travels at.
* @param abbrev nam abbreviation
*/ */
public Boat(String name, double velocity, String abbrev) { public Boat(String name, double velocity, String abbrev) {
this.velocity = velocity; this.velocity = velocity;
@ -36,7 +37,7 @@ public class Boat {
/** /**
* Sets the boat name * Sets the boat name
* *
* @param name * @param name of boat
*/ */
public void setName(String name) { public void setName(String name) {
this.name.setValue(name); this.name.setValue(name);

@ -33,6 +33,7 @@ public class BoatInRace extends Boat {
* @param name Name of the boat. * @param name Name of the boat.
* @param velocity Speed that the boat travels. * @param velocity Speed that the boat travels.
* @param colour Colour the boat will be displayed as on the map * @param colour Colour the boat will be displayed as on the map
* @param abbrev of boat
*/ */
public BoatInRace(String name, double velocity, Color colour, String abbrev) { public BoatInRace(String name, double velocity, Color colour, String abbrev) {
super(name, velocity, abbrev); super(name, velocity, abbrev);
@ -112,7 +113,7 @@ public class BoatInRace extends Boat {
/** /**
* Sets the boat's scaled velocity * Sets the boat's scaled velocity
* *
* @param velocity * @param velocity of boat
*/ */
public void setScaledVelocity(double velocity) { public void setScaledVelocity(double velocity) {
this.scaledVelocity = velocity; this.scaledVelocity = velocity;
@ -225,7 +226,7 @@ public class BoatInRace extends Boat {
/** /**
* Sets whether boat is finished or not * Sets whether boat is finished or not
* *
* @param bool * @param bool is finished value
*/ */
public void setFinished(boolean bool) { public void setFinished(boolean bool) {
this.finished = bool; this.finished = bool;

@ -16,10 +16,10 @@ public class ConstantVelocityRace extends Race {
/** /**
* Initialiser for a constant velocity race * Initialiser for a constant velocity race
* *
* @param startingBoats * @param startingBoats in race
* @param legs * @param legs in race
* @param controller * @param controller of race
* @param scaleFactor * @param scaleFactor of race
*/ */
public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> legs, RaceController controller, int scaleFactor) { public ConstantVelocityRace(BoatInRace[] startingBoats, ArrayList<Leg> legs, RaceController controller, int scaleFactor) {
super(startingBoats, legs, controller, scaleFactor); super(startingBoats, legs, controller, scaleFactor);
@ -29,8 +29,8 @@ public class ConstantVelocityRace extends Race {
/** /**
* Calculates the distance a boat has travelled and updates its current position according to this value. * Calculates the distance a boat has travelled and updates its current position according to this value.
* *
* @param boat * @param boat to be updated
* @param millisecondsElapsed * @param millisecondsElapsed since last update
*/ */
protected void updatePosition(BoatInRace boat, int millisecondsElapsed) { protected void updatePosition(BoatInRace boat, int millisecondsElapsed) {

@ -18,6 +18,9 @@ public class Leg {
* Leg Initialiser * Leg Initialiser
* *
* @param name Name of the Leg * @param name Name of the Leg
* @param start marker
* @param end marker
* @param number Leg's position in race
*/ */
public Leg(String name, Marker start, Marker end, int number) { public Leg(String name, Marker start, Marker end, int number) {
this.name = name; this.name = name;
@ -31,6 +34,7 @@ public class Leg {
* Construction Method * Construction Method
* *
* @param name Name of the Leg * @param name Name of the Leg
* @param number leg number
*/ */
public Leg(String name, int number) { public Leg(String name, int number) {
this.name = name; this.name = name;
@ -86,8 +90,6 @@ public class Leg {
/** /**
* Calculates the distance that the legs are in nautical miles (1.852 km). * Calculates the distance that the legs are in nautical miles (1.852 km).
*
* @return Returns the leg distance.
*/ */
public void calculateDistance() { public void calculateDistance() {

@ -39,6 +39,8 @@ public abstract class Race implements Runnable {
* *
* @param boats Takes in an array of boats that are participating in the race. * @param boats Takes in an array of boats that are participating in the race.
* @param legs Number of marks in order that the boats pass in order to complete the race. * @param legs Number of marks in order that the boats pass in order to complete the race.
* @param controller race controller
* @param scaleFactor for race
*/ */
public Race(BoatInRace[] boats, ArrayList<Leg> legs, RaceController controller, int scaleFactor) { public Race(BoatInRace[] boats, ArrayList<Leg> legs, RaceController controller, int scaleFactor) {
@ -288,8 +290,8 @@ public abstract class Race implements Runnable {
/** /**
* Updates the boat's gps coordinates depending on time elapsed * Updates the boat's gps coordinates depending on time elapsed
* *
* @param boat * @param boat to be updated
* @param millisecondsElapsed * @param millisecondsElapsed time since last update
*/ */
protected abstract void updatePosition(BoatInRace boat, int millisecondsElapsed); protected abstract void updatePosition(BoatInRace boat, int millisecondsElapsed);

@ -35,7 +35,7 @@ public class ResizableRaceCanvas extends Canvas {
/** /**
* Sets the boats that are to be displayed in this race. * Sets the boats that are to be displayed in this race.
* *
* @param boats * @param boats in race
*/ */
public void setBoats(BoatInRace[] boats) { public void setBoats(BoatInRace[] boats) {
this.boats = boats; this.boats = boats;
@ -66,7 +66,7 @@ public class ResizableRaceCanvas extends Canvas {
/** /**
* Sets the RaceMap that the RaceCanvas is to be displaying for. * Sets the RaceMap that the RaceCanvas is to be displaying for.
* *
* @param map * @param map race map
*/ */
public void setMap(RaceMap map) { public void setMap(RaceMap map) {
this.map = map; this.map = map;
@ -373,7 +373,7 @@ public class ResizableRaceCanvas extends Canvas {
/** /**
* Returns the preferred width of the Canvas * Returns the preferred width of the Canvas
* *
* @param width * @param width of canvas
* @return Returns the width of the Canvas * @return Returns the width of the Canvas
*/ */
@Override @Override
@ -384,7 +384,7 @@ public class ResizableRaceCanvas extends Canvas {
/** /**
* Returns the preferred height of the Canvas * Returns the preferred height of the Canvas
* *
* @param height * @param height of canvas
* @return Returns the height of the Canvas * @return Returns the height of the Canvas
*/ */
@Override @Override

@ -27,9 +27,9 @@ public class RaceXMLReader extends XMLReader {
/** /**
* Constractor for Race XML * Constractor for Race XML
* @param filePath path of the file * @param filePath path of the file
* @throws IOException * @throws IOException error
* @throws SAXException * @throws SAXException error
* @throws ParserConfigurationException * @throws ParserConfigurationException error
*/ */
public RaceXMLReader(String filePath) throws IOException, SAXException, ParserConfigurationException { public RaceXMLReader(String filePath) throws IOException, SAXException, ParserConfigurationException {
this(filePath, true); this(filePath, true);
@ -39,9 +39,9 @@ public class RaceXMLReader extends XMLReader {
* COnstructor for Race XML * COnstructor for Race XML
* @param filePath file path to read * @param filePath file path to read
* @param read whether or not to read and store the files straight away. * @param read whether or not to read and store the files straight away.
* @throws IOException * @throws IOException error
* @throws SAXException * @throws SAXException error
* @throws ParserConfigurationException * @throws ParserConfigurationException error
*/ */
public RaceXMLReader(String filePath, boolean read) throws IOException, SAXException, ParserConfigurationException { public RaceXMLReader(String filePath, boolean read) throws IOException, SAXException, ParserConfigurationException {
super(filePath); super(filePath);

@ -37,7 +37,6 @@ public class RaceTest {
assertTrue(System.currentTimeMillis() - timeStarted < 4000); assertTrue(System.currentTimeMillis() - timeStarted < 4000);
} }
@Test @Test
public void checkPositionUpdatesNumberFinishedBoats() { public void checkPositionUpdatesNumberFinishedBoats() {
@ -75,7 +74,6 @@ public class RaceTest {
assertEquals(race.boatsFinished, 0); assertEquals(race.boatsFinished, 0);
} }
@Test @Test
public void distanceTravelledBeforeUpdatingLegIsRetained() { public void distanceTravelledBeforeUpdatingLegIsRetained() {

Loading…
Cancel
Save