Created Schema for Race xml's and generated classes for reading xml with xjc, made the RaceXMLReader read Corner classes in as well as making a corner class #story[1092]

This commit is contained in:
Fan-Wu Yang
2017-08-03 02:42:33 +12:00
parent a8701d8a1f
commit 4e8d4f2433
8 changed files with 1782 additions and 2 deletions
@@ -51,6 +51,10 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
*/
private final List<Leg> legs = new ArrayList<>();
/**
* List of corners in the race
*/
private final List<Corner> cornersList = new ArrayList<>();
/**
* The time that the race.xml file was created.
@@ -331,6 +335,10 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
//Gets the ID number of this corner element.
int cornerID = getCompoundMarkID(cornerElement);
int cornerSeq = Integer.parseInt(getAttribute(cornerElement, "SeqID"));
cornersList.add(new Corner(cornerID, cornerSeq));
//Gets the CompoundMark associated with this corner.
CompoundMark lastCompoundMark = this.compoundMarkMap.get(cornerID);
@@ -346,6 +354,9 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
//Gets the ID number of this corner element.
cornerID = getCompoundMarkID(cornerElement);
cornerSeq = Integer.parseInt(getAttribute(cornerElement, "SeqID"));
cornersList.add(new Corner(cornerID, cornerSeq));
//Gets the CompoundMark associated with this corner.
CompoundMark currentCompoundMark = this.compoundMarkMap.get(cornerID);
@@ -460,4 +471,8 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
public List<Integer> getParticipants() {
return participants;
}
public List<Corner> getCornersList() {
return cornersList;
}
}
@@ -0,0 +1,23 @@
package shared.model;
/**
* Created by Gondr on 3/08/2017.
*/
public class Corner {
private int id;
private int seqID;
public Corner(int id, int seqID){
this.id = id;
this.seqID = seqID;
}
public int getId() {
return id;
}
public int getSeqID() {
return seqID;
}
}