Generate StreamedCourse from VisualiserInput
#story[782]
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package seng302.Mock;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
import jdk.internal.util.xml.impl.Input;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.Model.Boat;
|
||||
import seng302.XMLReader;
|
||||
@@ -47,6 +49,10 @@ public class BoatXMLReader extends XMLReader {
|
||||
}
|
||||
}
|
||||
|
||||
public BoatXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
|
||||
super(xmlString);
|
||||
}
|
||||
|
||||
public void read() {
|
||||
readSettings();
|
||||
readShapes();
|
||||
|
||||
@@ -2,6 +2,7 @@ package seng302.Mock;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.XMLReader;
|
||||
|
||||
@@ -42,6 +43,10 @@ public class RegattaXMLReader extends XMLReader {
|
||||
}
|
||||
}
|
||||
|
||||
public RegattaXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
|
||||
super(xmlString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the XML
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@ public class StreamedCourse implements RaceDataSource {
|
||||
BoatXMLReader boatXMLReader = null;
|
||||
RegattaXMLReader regattaXMLReader = null;
|
||||
|
||||
public StreamedCourse() {}
|
||||
|
||||
public StreamedCourse(StreamedCourseXMLReader streamedCourseXMLReader) {
|
||||
this.streamedCourseXMLReader = streamedCourseXMLReader;
|
||||
}
|
||||
@@ -25,15 +27,19 @@ public class StreamedCourse implements RaceDataSource {
|
||||
|
||||
public void setBoatXMLReader(BoatXMLReader boatXMLReader) {
|
||||
this.boatXMLReader = boatXMLReader;
|
||||
if (streamedCourseXMLReader != null) {
|
||||
if (streamedCourseXMLReader != null && boatXMLReader != null) {
|
||||
boatXMLReader.setParticipants(streamedCourseXMLReader.getParticipants());
|
||||
boatXMLReader.read();
|
||||
}
|
||||
}
|
||||
|
||||
public StreamedCourseXMLReader getStreamedCourseXMLReader() {
|
||||
return streamedCourseXMLReader;
|
||||
}
|
||||
|
||||
public void setStreamedCourseXMLReader(StreamedCourseXMLReader streamedCourseXMLReader) {
|
||||
this.streamedCourseXMLReader = streamedCourseXMLReader;
|
||||
if (streamedCourseXMLReader != null) {
|
||||
if (streamedCourseXMLReader != null && boatXMLReader != null) {
|
||||
boatXMLReader.setParticipants(streamedCourseXMLReader.getParticipants());
|
||||
boatXMLReader.read();
|
||||
}
|
||||
@@ -43,10 +49,6 @@ public class StreamedCourse implements RaceDataSource {
|
||||
this.regattaXMLReader = regattaXMLReader;
|
||||
}
|
||||
|
||||
public RegattaXMLReader getRegattaXMLReader() {
|
||||
return regattaXMLReader;
|
||||
}
|
||||
|
||||
public List<Boat> getBoats() {
|
||||
return boatXMLReader.getBoats();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.GPSCoordinate;
|
||||
import seng302.Model.Leg;
|
||||
@@ -63,6 +64,10 @@ public class StreamedCourseXMLReader extends XMLReader {
|
||||
}
|
||||
}
|
||||
|
||||
public StreamedCourseXMLReader(InputSource xmlString) throws IOException, SAXException, ParserConfigurationException {
|
||||
super(xmlString);
|
||||
}
|
||||
|
||||
private void read() throws ParseException, StreamedCourseXMLException {
|
||||
readRace();
|
||||
readParticipants();
|
||||
|
||||
Reference in New Issue
Block a user