Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules

# Conflicts:
#	visualiser/src/main/java/seng302/VisualiserInput.java
This commit is contained in:
cbt24
2017-05-01 18:55:08 +12:00
8 changed files with 84 additions and 51 deletions
@@ -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,25 +72,28 @@ 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());
}
private void readParticipants() {
Element nParticipants = (Element) doc.getElementsByTagName("Participants").item(0);
nParticipants.getChildNodes().getLength();
for (int i = 0; i < nParticipants.getChildNodes().getLength(); i++) {
int sourceID;
Node yacht = nParticipants.getChildNodes().item(i);
@@ -157,7 +161,8 @@ public class StreamedCourseXMLReader extends XMLReader {
* @return value of "compoundMarkID" attribute
*/
private int getCompoundMarkID(Element element) {
return Integer.parseInt(element.getAttribute("CompoundMarkID"));
//return Integer.parseInt(element.getAttribute("CompoundMarkID"));
return 3;
}
/**