mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added some missing fields. Added missing getters.
#story[820]
This commit is contained in:
@@ -136,6 +136,11 @@ public class StreamParser {
|
|||||||
try {
|
try {
|
||||||
db = dbf.newDocumentBuilder();
|
db = dbf.newDocumentBuilder();
|
||||||
doc = db.parse(new InputSource(new StringReader(xmlMessage)));
|
doc = db.parse(new InputSource(new StringReader(xmlMessage)));
|
||||||
|
if (xmlMessageSubType == 6) {
|
||||||
|
System.out.println(xmlMessage);
|
||||||
|
XMLParser x = new XMLParser();
|
||||||
|
XMLParser.RaceXMLObject y = x.createRaceXML(doc);
|
||||||
|
}
|
||||||
} catch (ParserConfigurationException|SAXException|IOException e) {
|
} catch (ParserConfigurationException|SAXException|IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,19 +166,19 @@ class XMLParser {
|
|||||||
class RaceXMLObject {
|
class RaceXMLObject {
|
||||||
|
|
||||||
// Race Info
|
// Race Info
|
||||||
Integer raceID;
|
private Integer raceID;
|
||||||
String raceType;
|
private String raceType;
|
||||||
String creationTimeDate; // XML Creation Time
|
private String creationTimeDate; // XML Creation Time
|
||||||
|
|
||||||
//Race Start Details
|
//Race Start Details
|
||||||
String raceStartTime;
|
private String raceStartTime;
|
||||||
Boolean postponeStatus;
|
private Boolean postponeStatus;
|
||||||
|
|
||||||
//Non atomic race attributes
|
//Non atomic race attributes
|
||||||
ArrayList<Participant> participants;
|
private ArrayList<Participant> participants;
|
||||||
ArrayList<CompoundMark> course;
|
private ArrayList<CompoundMark> course;
|
||||||
ArrayList<Corner> compoundMarkSequence;
|
private ArrayList<Corner> compoundMarkSequence;
|
||||||
ArrayList<Limit> courseLimit;
|
private ArrayList<Limit> courseLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a RaceXMLObject.
|
* Constructor for a RaceXMLObject.
|
||||||
@@ -187,6 +187,17 @@ class XMLParser {
|
|||||||
*/
|
*/
|
||||||
RaceXMLObject(Document doc) {
|
RaceXMLObject(Document doc) {
|
||||||
Element docEle = doc.getDocumentElement();
|
Element docEle = doc.getDocumentElement();
|
||||||
|
|
||||||
|
//Atomic and Semi-Atomic Elements
|
||||||
|
this.raceID = getElementInt(docEle, "RaceID");
|
||||||
|
this.raceType = getElementString(docEle, "RaceType");
|
||||||
|
this.creationTimeDate = getElementString(docEle, "CreationTimeDate");
|
||||||
|
|
||||||
|
Node raceStart = docEle.getElementsByTagName("RaceStartTime").item(0);
|
||||||
|
this.raceStartTime = getNodeAttributeString(raceStart, "Start") ;
|
||||||
|
this.postponeStatus = Boolean.parseBoolean(getNodeAttributeString(raceStart, "Postpone"));
|
||||||
|
|
||||||
|
//Participants
|
||||||
participants = new ArrayList<>();
|
participants = new ArrayList<>();
|
||||||
|
|
||||||
NodeList pList = docEle.getElementsByTagName("Participants").item(0).getChildNodes();
|
NodeList pList = docEle.getElementsByTagName("Participants").item(0).getChildNodes();
|
||||||
@@ -207,6 +218,7 @@ class XMLParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Course
|
||||||
course = new ArrayList<>();
|
course = new ArrayList<>();
|
||||||
|
|
||||||
NodeList cMarkList = docEle.getElementsByTagName("Course").item(0).getChildNodes();
|
NodeList cMarkList = docEle.getElementsByTagName("Course").item(0).getChildNodes();
|
||||||
@@ -218,6 +230,7 @@ class XMLParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Course Mark Sequence
|
||||||
compoundMarkSequence = new ArrayList<>();
|
compoundMarkSequence = new ArrayList<>();
|
||||||
|
|
||||||
NodeList cornerList = docEle.getElementsByTagName("CompoundMarkSequence").item(0).getChildNodes();
|
NodeList cornerList = docEle.getElementsByTagName("CompoundMarkSequence").item(0).getChildNodes();
|
||||||
@@ -229,6 +242,7 @@ class XMLParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Course Limits
|
||||||
courseLimit = new ArrayList<>();
|
courseLimit = new ArrayList<>();
|
||||||
|
|
||||||
NodeList limitList = docEle.getElementsByTagName("CourseLimit").item(0).getChildNodes();
|
NodeList limitList = docEle.getElementsByTagName("CourseLimit").item(0).getChildNodes();
|
||||||
@@ -241,6 +255,12 @@ class XMLParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getRaceID() { return raceID; }
|
||||||
|
public String getRaceType() { return raceType; }
|
||||||
|
public String getCreationTimeDate() { return creationTimeDate; }
|
||||||
|
public String getRaceStartTime() { return raceStartTime; }
|
||||||
|
public Boolean getPostponeStatus() { return postponeStatus; }
|
||||||
|
|
||||||
public ArrayList<Participant> getParticipants() { return participants; }
|
public ArrayList<Participant> getParticipants() { return participants; }
|
||||||
public ArrayList<CompoundMark> getCompoundMarks() { return course; }
|
public ArrayList<CompoundMark> getCompoundMarks() { return course; }
|
||||||
public ArrayList<Corner> getCompoundMarkSequence() { return compoundMarkSequence; }
|
public ArrayList<Corner> getCompoundMarkSequence() { return compoundMarkSequence; }
|
||||||
|
|||||||
Reference in New Issue
Block a user