Race clock now works and the setup for the racestart now checks if the tag has "Start" or "Time". #story[782]

main
Joseph Gardner 9 years ago
parent 8bbea28cab
commit 2a2fe6de59

@ -189,8 +189,12 @@ public class StartController extends Controller implements Observer {
if(((StreamedCourse) o).getBoats() != null) {
initialiseTables();
}
if(((StreamedCourse)o).getZonedDateTime() != null) {
setRaceClock();
if (((StreamedCourse) o).getZonedDateTime() != null) {
Platform.runLater(() -> {
{
setRaceClock();
}
});
}
}
}

@ -1,5 +1,6 @@
package seng302.Mock;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.joda.time.DateTime;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@ -71,20 +72,22 @@ public class StreamedCourseXMLReader extends XMLReader {
}
private void read() throws ParseException, StreamedCourseXMLException {
// readRace();
readRace();
readParticipants();
readCourse();
}
private void readRace() throws ParseException {
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
Element settings = (Element) doc.getElementsByTagName("Race").item(0);
System.out.println(getTextValueOfNode(settings, "CreationTimeDate"));
raceID = Integer.parseInt(getTextValueOfNode(settings, "RaceID"));
raceType = getTextValueOfNode(settings, "RaceType");
creationTimeDate = ZonedDateTime.parse(getTextValueOfNode(settings, "CreationTimeDate"), dateFormat);
NamedNodeMap raceTimeTag = doc.getElementsByTagName("RaceStartTime").item(0).getAttributes();
raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Time").getTextContent(), dateFormat);
if (raceTimeTag.getNamedItem("Time") != null) raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Time").getTextContent(), dateFormat);
else raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Start").getTextContent(), dateFormat);
postpone = Boolean.parseBoolean(raceTimeTag.getNamedItem("Postpone").getTextContent());
}

@ -39,8 +39,8 @@ public class VisualiserInput implements Runnable
public VisualiserInput(StreamedCourse course) throws IOException{
connectionSocket = new Socket(InetAddress.getLocalHost(), 4942);
// this.connectionSocket = new Socket("livedata.americascup.com",4941);
//connectionSocket = new Socket(InetAddress.getLocalHost(), 4942);
this.connectionSocket = new Socket("livedata.americascup.com",4941);
this.course = course;
this.boatLocation = new HashMap<>();

Loading…
Cancel
Save