Last minute changes to get ready for DoD
#story[875]
This commit is contained in:
@@ -50,8 +50,8 @@ public abstract class XMLReader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Alternate constructor
|
* Alternate constructor
|
||||||
* @param xmlFile
|
* @param xmlFile File to be read
|
||||||
* @param isWholeFile
|
* @param isWholeFile boolean value whether entire file is being passed
|
||||||
*/
|
*/
|
||||||
public XMLReader(String xmlFile, Boolean isWholeFile) {
|
public XMLReader(String xmlFile, Boolean isWholeFile) {
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ public abstract class XMLReader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the contents of the XML FILe.
|
* Get the contents of the XML FILe.
|
||||||
* @param document
|
* @param document holds all xml information
|
||||||
* @return
|
* @return String representation of document
|
||||||
* @throws TransformerException
|
* @throws TransformerException when document is malformed, and cannot be turned into a string
|
||||||
*/
|
*/
|
||||||
public static String getContents(Document document) throws TransformerException {
|
public static String getContents(Document document) throws TransformerException {
|
||||||
DOMSource source = new DOMSource(document);
|
DOMSource source = new DOMSource(document);
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public class MockOutput implements Runnable
|
|||||||
* @param lon longitude of boat
|
* @param lon longitude of boat
|
||||||
* @param heading heading of boat
|
* @param heading heading of boat
|
||||||
* @param speed speed of boat
|
* @param speed speed of boat
|
||||||
|
* @param time historical time of race
|
||||||
*/
|
*/
|
||||||
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading, double speed, long time){
|
public synchronized void parseBoatLocation(int sourceID, double lat, double lon, double heading, double speed, long time){
|
||||||
|
|
||||||
|
|||||||
@@ -374,26 +374,29 @@ public class Race implements Runnable {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Otherwise, the race is over!
|
//Otherwise, the race is over!
|
||||||
|
System.out.println("test");
|
||||||
raceFinished.start();
|
raceFinished.start();
|
||||||
setRaceStatusEnum(RaceStatusEnum.FINISHED);
|
setRaceStatusEnum(RaceStatusEnum.FINISHED);
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change wind direction
|
if (getNumberOfActiveBoats() != 0) {
|
||||||
changeWindDir();
|
// Change wind direction
|
||||||
|
changeWindDir();
|
||||||
|
|
||||||
//Parse the boat locations.
|
//Parse the boat locations.
|
||||||
parseBoatLocations();
|
parseBoatLocations();
|
||||||
|
|
||||||
//Parse the marks.
|
//Parse the marks.
|
||||||
parseMarks();
|
parseMarks();
|
||||||
|
|
||||||
//Parse the race status.
|
//Parse the race status.
|
||||||
parseRaceStatus();
|
parseRaceStatus();
|
||||||
|
|
||||||
|
|
||||||
//Update the last frame time.
|
//Update the last frame time.
|
||||||
this.lastFrameTime = currentTime;
|
this.lastFrameTime = currentTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -404,7 +407,7 @@ public class Race implements Runnable {
|
|||||||
int iters = 0;
|
int iters = 0;
|
||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, null);
|
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 4, startTime, 0, 2300, 2, new ArrayList<>());
|
||||||
mockOutput.parseRaceStatus(raceStatus);
|
mockOutput.parseRaceStatus(raceStatus);
|
||||||
if (iters > 500){
|
if (iters > 500){
|
||||||
mockOutput.stop();
|
mockOutput.stop();
|
||||||
@@ -625,10 +628,10 @@ public class Race implements Runnable {
|
|||||||
boat.setVMG(newVMG);
|
boat.setVMG(newVMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateEstimatedTime(boat);
|
||||||
//Check the boats position (update leg and stuff).
|
//Check the boats position (update leg and stuff).
|
||||||
this.checkPosition(boat, totalTimeElapsed);
|
this.checkPosition(boat, totalTimeElapsed);
|
||||||
this.updateEstimatedTime(boat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -751,7 +754,6 @@ public class Race implements Runnable {
|
|||||||
boat.setTimeFinished(timeElapsed);
|
boat.setTimeFinished(timeElapsed);
|
||||||
boat.setCurrentSpeed(0);
|
boat.setCurrentSpeed(0);
|
||||||
boat.setStatus(BoatStatusEnum.FINISHED);
|
boat.setStatus(BoatStatusEnum.FINISHED);
|
||||||
|
|
||||||
} else if (doNotFinish()) {
|
} else if (doNotFinish()) {
|
||||||
//Boat has pulled out of race.
|
//Boat has pulled out of race.
|
||||||
boat.setTimeFinished(timeElapsed);
|
boat.setTimeFinished(timeElapsed);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<SplitPane fx:id="race" dividerPositions="0.7" prefHeight="431.0" prefWidth="610.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
<SplitPane fx:id="race" dividerPositions="0.7" prefHeight="431.0" prefWidth="610.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.RaceController">
|
||||||
<items>
|
<items>
|
||||||
<GridPane fx:id="canvasBase">
|
<GridPane fx:id="canvasBase">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class RaceConnectionTest {
|
|||||||
assertTrue(onlineConnection.check());
|
assertTrue(onlineConnection.check());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void offlineConnectionStatusOffline() {
|
public void offlineConnectionStatusOffline() {
|
||||||
assertFalse(offlineConnection.check());
|
assertFalse(offlineConnection.check());
|
||||||
|
|||||||
Reference in New Issue
Block a user