commit
f1ef75fb81
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,3 +0,0 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
@ -0,0 +1,207 @@
|
||||
package mock.xml;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
import shared.dataInput.RaceXMLReader;
|
||||
import shared.enums.XMLFileType;
|
||||
import shared.exceptions.InvalidRaceDataException;
|
||||
import shared.exceptions.XMLReaderException;
|
||||
import shared.model.*;
|
||||
import shared.xml.Race.*;
|
||||
import shared.xml.XMLUtilities;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.util.JAXBSource;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* Helper Class for creating a Race XML
|
||||
*/
|
||||
public class RaceXMLCreator {
|
||||
|
||||
|
||||
/**
|
||||
* get the windward gate in a race
|
||||
* @param reader reads in the mark
|
||||
* @return the windward gate.
|
||||
*/
|
||||
public static CompoundMark getWindwardGate(RaceXMLReader reader){
|
||||
for (CompoundMark mark: reader.getCompoundMarks()){
|
||||
if (mark.getName().equals("Windward Gate")) return mark;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the leeward gate in a race
|
||||
* @param reader reads in the mark
|
||||
* @return the leeward gate.
|
||||
*/
|
||||
public static CompoundMark getLeewardGate(RaceXMLReader reader){
|
||||
for (CompoundMark mark: reader.getCompoundMarks()){
|
||||
if (mark.getName().equals("Leeward Gate")) return mark;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the race in a specified direction.
|
||||
* @param s xml file name
|
||||
* @param degrees degrees to rotate
|
||||
* @return the new xml file as a string
|
||||
* @throws XMLReaderException if the xml is not readable
|
||||
* @throws InvalidRaceDataException if the race is invalid
|
||||
* @throws JAXBException if the Race class cannot be parsed into a xml.
|
||||
* @throws IOException if the schema file cannot be found
|
||||
* @throws SAXException error in schema file
|
||||
* @throws ParserConfigurationException error in parsing the schema file
|
||||
*/
|
||||
public static String alterRaceToWind(String s, double degrees) throws XMLReaderException, InvalidRaceDataException, JAXBException, IOException, SAXException, ParserConfigurationException {
|
||||
RaceXMLReader reader = new RaceXMLReader(s, XMLFileType.ResourcePath);
|
||||
|
||||
XMLRace race = (XMLRace) XMLUtilities.xmlToClass(RaceXMLCreator.class.getClassLoader().getResourceAsStream(s),
|
||||
RaceXMLCreator.class.getClassLoader().getResource("mock/mockXML/schema/raceSchema.xsd"),
|
||||
XMLRace.class);
|
||||
|
||||
setRaceXMLAtCurrentTimeToNow(race);
|
||||
|
||||
double raceOriginalBearing = getLineAngle(getLeewardGate(reader).getMark1Position(), getWindwardGate(reader).getMark1Position());
|
||||
|
||||
double degreesToRotate = degrees - raceOriginalBearing;
|
||||
|
||||
alterRaceRotation(race, degreesToRotate);
|
||||
|
||||
JAXBContext context = JAXBContext.newInstance(XMLRace.class);
|
||||
Marshaller jaxbMarshaller = context.createMarshaller();
|
||||
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
|
||||
jaxbMarshaller.marshal(race, sw);
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the features in a race such as the boundary, and the marks.
|
||||
* @param race the race to alter
|
||||
* @param degrees the degrees to rotate by.
|
||||
*/
|
||||
public static void alterRaceRotation(XMLRace race, double degrees){
|
||||
GPSCoordinate center = getCenter(race);
|
||||
for(XMLLimit limit: race.getCourseLimit().getLimit()){
|
||||
GPSCoordinate rotatedLim = rotate(center, limitToGPSCoordinate(limit), degrees);
|
||||
limit.setLat(rotatedLim.getLatitude());
|
||||
limit.setLon(rotatedLim.getLongitude());
|
||||
}
|
||||
|
||||
for(XMLCompoundMark compoundMark: race.getCourse().getCompoundMark()){
|
||||
for (XMLMark mark: compoundMark.getMark()){
|
||||
GPSCoordinate rotatedMark = rotate(center, markToGPSCoordinate(mark), degrees);
|
||||
mark.setTargetLat(rotatedMark.getLatitude());
|
||||
mark.setTargetLng(rotatedMark.getLongitude());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Race.CourseLimit.Limit to a GPS coordinate
|
||||
* @param limit limit to convert
|
||||
* @return gps coordinate corresponding to the limit
|
||||
*/
|
||||
public static GPSCoordinate limitToGPSCoordinate(XMLLimit limit){
|
||||
return new GPSCoordinate(limit.getLat(), limit.getLon());
|
||||
}
|
||||
|
||||
/**
|
||||
* get new gps coordinate after rotating
|
||||
* @param pivot center point to rotating from.
|
||||
* @param point point to rotate
|
||||
* @param degrees number of degress to rotate by
|
||||
* @return the new GPSCoordinate of the transformed point.
|
||||
*/
|
||||
public static GPSCoordinate rotate(GPSCoordinate pivot, GPSCoordinate point, double degrees){
|
||||
double radDeg = Math.toRadians(degrees);
|
||||
double deltaLat = (point.getLatitude() - pivot.getLatitude());
|
||||
double deltaLon = (point.getLongitude() - pivot.getLongitude());
|
||||
//map to (0,1) vector and use vector maths to rotate.
|
||||
double resLat = deltaLat * Math.cos(radDeg) - deltaLon * Math.sin(radDeg) + pivot.getLatitude();
|
||||
double resLon = deltaLat * Math.sin(radDeg) + deltaLon * Math.cos(radDeg) + pivot.getLongitude();
|
||||
return new GPSCoordinate(resLat, resLon);
|
||||
}
|
||||
|
||||
/**
|
||||
* obtains the GPSCoordinates of a mark
|
||||
* @param mark mark to obtain the GPSCoordinates of
|
||||
* @return the GPSCOordinatess of a mark
|
||||
*/
|
||||
public static GPSCoordinate markToGPSCoordinate(XMLMark mark){
|
||||
return new GPSCoordinate(mark.getTargetLat(), mark.getTargetLng());
|
||||
}
|
||||
|
||||
/**
|
||||
* get the center of a race
|
||||
* @param race race to get the center of
|
||||
* @return GPSCoordinates of the center
|
||||
*/
|
||||
public static GPSCoordinate getCenter(XMLRace race){
|
||||
double avgLat = 0;
|
||||
double avgLng = 0;
|
||||
for (XMLLimit limit: race.getCourseLimit().getLimit()){
|
||||
avgLat += limit.getLat();
|
||||
avgLng += limit.getLon();
|
||||
}
|
||||
avgLat = avgLat/race.getCourseLimit().getLimit().size();
|
||||
avgLng = avgLng/race.getCourseLimit().getLimit().size();
|
||||
return new GPSCoordinate(avgLat, avgLng);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the angle of a line
|
||||
* @param coord1 point a of the line
|
||||
* @param coord2 point b of the line
|
||||
* @return the angle in degrees that the bearing of the line is [-180, 180]
|
||||
*/
|
||||
public static double getLineAngle(GPSCoordinate coord1, GPSCoordinate coord2){
|
||||
double dx = coord1.getLongitude() - coord2.getLongitude();
|
||||
double dy = coord1.getLatitude() - coord2.getLatitude();
|
||||
return Math.atan2(dy, dx)/Math.PI * 180;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the xml description of the race to show the race was created now, and starts in 4 minutes
|
||||
* @param raceXML The race.xml contents.
|
||||
*/
|
||||
public static void setRaceXMLAtCurrentTimeToNow(XMLRace raceXML) {
|
||||
|
||||
//The start time is current time + 4 minutes. prestart is 3 minutes, and we add another minute.
|
||||
long millisecondsToAdd = Constants.RacePreStartTime + (1 * 60 * 1000);
|
||||
long secondsToAdd = millisecondsToAdd / 1000;
|
||||
//Scale the time using our time scalar.
|
||||
secondsToAdd = secondsToAdd / Constants.RaceTimeScale;
|
||||
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
ZonedDateTime creationTime = ZonedDateTime.now();
|
||||
raceXML.setCreationTimeDate(dateFormat.format(creationTime));
|
||||
raceXML.getRaceStartTime().setTime(dateFormat.format(creationTime.plusSeconds(secondsToAdd)));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package shared.model;
|
||||
|
||||
import shared.xml.Race.XMLCorner;
|
||||
|
||||
/**
|
||||
* Created by Gondr on 3/08/2017.
|
||||
*/
|
||||
public class Corner extends XMLCorner{
|
||||
|
||||
private int id;
|
||||
|
||||
public Corner(int id, int seqID, String rounding, int zoneSize){
|
||||
super();
|
||||
setCompoundMarkID(id);
|
||||
setSeqID(seqID);
|
||||
setRounding(rounding);
|
||||
setZoneSize(zoneSize);
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Mark" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"mark"
|
||||
})
|
||||
public class XMLCompoundMark {
|
||||
|
||||
@XmlElement(name = "Mark", required = true)
|
||||
protected List<XMLMark> mark;
|
||||
@XmlAttribute(name = "CompoundMarkID", required = true)
|
||||
protected int compoundMarkID;
|
||||
@XmlAttribute(name = "Name", required = true)
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
* Gets the value of the mark property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the mark property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getMark().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link XMLMark }
|
||||
*
|
||||
* @return list of marks
|
||||
*/
|
||||
public List<XMLMark> getMark() {
|
||||
if (mark == null) {
|
||||
mark = new ArrayList<XMLMark>();
|
||||
}
|
||||
return this.mark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the compoundMarkID property.
|
||||
* @return the id of the compound mark
|
||||
*/
|
||||
public int getCompoundMarkID() {
|
||||
return compoundMarkID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the compoundMarkID property.
|
||||
* @param value sets ID of the compound mark
|
||||
*/
|
||||
public void setCompoundMarkID(int value) {
|
||||
this.compoundMarkID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Corner" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"corner"
|
||||
})
|
||||
public class XMLCompoundMarkSequence {
|
||||
|
||||
@XmlElement(name = "Corner", required = true)
|
||||
protected List<XMLCorner> corner;
|
||||
|
||||
/**
|
||||
* Gets the value of the corner property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the corner property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getCorner().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link XMLCorner }
|
||||
*
|
||||
* @return getCorners/legs that the boats are to sequentially pass
|
||||
*/
|
||||
public List<XMLCorner> getCorner() {
|
||||
if (corner == null) {
|
||||
corner = new ArrayList<XMLCorner>();
|
||||
}
|
||||
return this.corner;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public class XMLCorner {
|
||||
|
||||
@XmlAttribute(name = "CompoundMarkID", required = true)
|
||||
protected int compoundMarkID;
|
||||
@XmlAttribute(name = "SeqID", required = true)
|
||||
protected int seqID;
|
||||
@XmlAttribute(name = "Rounding", required = true)
|
||||
protected String rounding;
|
||||
@XmlAttribute(name = "ZoneSize", required = true)
|
||||
protected int zoneSize;
|
||||
|
||||
/**
|
||||
* Gets the value of the compoundMarkID property.
|
||||
* @return Id of the compound mark
|
||||
*/
|
||||
public int getCompoundMarkID() {
|
||||
return compoundMarkID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the compoundMarkID property.
|
||||
* @param value sets the id of the compound mark
|
||||
*/
|
||||
public void setCompoundMarkID(int value) {
|
||||
this.compoundMarkID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the seqID property.
|
||||
* @return the order that the mark is to be passed at
|
||||
*/
|
||||
public int getSeqID() {
|
||||
return seqID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the seqID property.
|
||||
* @param value sets the order that this corner is to appear in a race at.
|
||||
*/
|
||||
public void setSeqID(int value) {
|
||||
this.seqID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the rounding property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRounding() {
|
||||
return rounding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the rounding property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRounding(String value) {
|
||||
this.rounding = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the zoneSize property.
|
||||
* @return the size of the leg
|
||||
*/
|
||||
public int getZoneSize() {
|
||||
return zoneSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the zoneSize property.
|
||||
* @param value sets the size of the corner.
|
||||
*/
|
||||
public void setZoneSize(int value) {
|
||||
this.zoneSize = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="CompoundMark" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Mark" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"compoundMark"
|
||||
})
|
||||
public class XMLCourse {
|
||||
|
||||
@XmlElement(name = "CompoundMark", required = true)
|
||||
protected List<XMLCompoundMark> compoundMark;
|
||||
|
||||
/**
|
||||
* Gets the value of the compoundMark property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the compoundMark property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getCompoundMark().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link XMLCompoundMark }
|
||||
*
|
||||
* @return the compound marks in the course.
|
||||
*/
|
||||
public List<XMLCompoundMark> getCompoundMark() {
|
||||
if (compoundMark == null) {
|
||||
compoundMark = new ArrayList<XMLCompoundMark>();
|
||||
}
|
||||
return this.compoundMark;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Limit" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"limit"
|
||||
})
|
||||
public class XMLCourseLimit {
|
||||
|
||||
@XmlElement(name = "Limit", required = true)
|
||||
protected List<XMLLimit> limit;
|
||||
|
||||
/**
|
||||
* Gets the value of the limit property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the limit property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getLimit().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link XMLLimit }
|
||||
*
|
||||
* @return the limits of the race
|
||||
*/
|
||||
public List<XMLLimit> getLimit() {
|
||||
if (limit == null) {
|
||||
limit = new ArrayList<XMLLimit>();
|
||||
}
|
||||
return this.limit;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public class XMLLimit {
|
||||
|
||||
@XmlAttribute(name = "Lat", required = true)
|
||||
protected double lat;
|
||||
@XmlAttribute(name = "Lon", required = true)
|
||||
protected double lon;
|
||||
@XmlAttribute(name = "SeqID", required = true)
|
||||
protected int seqID;
|
||||
|
||||
/**
|
||||
* Gets the value of the lat property.
|
||||
* @return get the latitude of the limit
|
||||
*/
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lat property.
|
||||
* @param value sets the latitude of the limit
|
||||
*/
|
||||
public void setLat(double value) {
|
||||
this.lat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lon property.
|
||||
* @return sets the longitude of the limit
|
||||
*/
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lon property.
|
||||
* @param value sets the longitude of the limit
|
||||
*/
|
||||
public void setLon(double value) {
|
||||
this.lon = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the seqID property.
|
||||
* @return gets the sequence that the limit is at.
|
||||
*/
|
||||
public int getSeqID() {
|
||||
return seqID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the seqID property.
|
||||
* @param value sets the order that this limit is to appear in.
|
||||
*/
|
||||
public void setSeqID(int value) {
|
||||
this.seqID = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import mock.model.collider.Collider;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public class XMLMark{
|
||||
|
||||
@XmlAttribute(name = "SeqId")
|
||||
protected Integer seqId;
|
||||
@XmlAttribute(name = "Name", required = true)
|
||||
protected String name;
|
||||
@XmlAttribute(name = "TargetLat", required = true)
|
||||
protected double targetLat;
|
||||
@XmlAttribute(name = "TargetLng", required = true)
|
||||
protected double targetLng;
|
||||
@XmlAttribute(name = "SourceID", required = true)
|
||||
protected int sourceID;
|
||||
|
||||
/**
|
||||
* Gets the value of the seqId property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getSeqId() {
|
||||
return seqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the seqId property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setSeqId(Integer value) {
|
||||
this.seqId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the targetLat property.
|
||||
* @return latitude that mark is at
|
||||
*/
|
||||
public double getTargetLat() {
|
||||
return targetLat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the targetLat property.
|
||||
* @param value sets the latitude that the mark is at.
|
||||
*/
|
||||
public void setTargetLat(double value) {
|
||||
this.targetLat = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the targetLng property.
|
||||
* @return the longitude the mark is at
|
||||
*/
|
||||
public double getTargetLng() {
|
||||
return targetLng;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the targetLng property.
|
||||
* @param value sets the longitude that the value is at
|
||||
*/
|
||||
public void setTargetLng(double value) {
|
||||
this.targetLng = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the sourceID property.
|
||||
* @return the markerboats source ID
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sourceID property.
|
||||
* @param value sets the id of the boat that the mark is referencing to.
|
||||
*/
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Yacht" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"yacht"
|
||||
})
|
||||
public class XMLParticipants {
|
||||
|
||||
@XmlElement(name = "Yacht", required = true)
|
||||
protected List<XMLYacht> yacht;
|
||||
|
||||
/**
|
||||
* Gets the value of the yacht property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the yacht property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getYacht().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link XMLYacht }
|
||||
*
|
||||
* @return the yachts that are part of the race.
|
||||
*/
|
||||
public List<XMLYacht> getYacht() {
|
||||
if (yacht == null) {
|
||||
yacht = new ArrayList<XMLYacht>();
|
||||
}
|
||||
return this.yacht;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,362 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 03:20:03 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="RaceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
|
||||
* <element name="RaceType" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="CreationTimeDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
|
||||
* <element name="RaceStartTime">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="Postpone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="Time" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="Participants">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Yacht" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="CompoundMarkSequence">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Corner" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="Course">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="CompoundMark" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Mark" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* <attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* <element name="CourseLimit">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <sequence>
|
||||
* <element name="Limit" maxOccurs="unbounded">
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
|
||||
* <attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </element>
|
||||
* </sequence>
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"raceID",
|
||||
"raceType",
|
||||
"creationTimeDate",
|
||||
"raceStartTime",
|
||||
"participants",
|
||||
"compoundMarkSequence",
|
||||
"course",
|
||||
"courseLimit"
|
||||
})
|
||||
@XmlRootElement(name = "Race")
|
||||
public class XMLRace {
|
||||
|
||||
@XmlElement(name = "RaceID")
|
||||
protected int raceID;
|
||||
@XmlElement(name = "RaceType", required = true)
|
||||
protected String raceType;
|
||||
@XmlElement(name = "CreationTimeDate", required = true)
|
||||
protected String creationTimeDate;
|
||||
@XmlElement(name = "RaceStartTime", required = true)
|
||||
protected XMLRaceStartTime raceStartTime;
|
||||
@XmlElement(name = "Participants", required = true)
|
||||
protected XMLParticipants participants;
|
||||
@XmlElement(name = "CompoundMarkSequence", required = true)
|
||||
protected XMLCompoundMarkSequence compoundMarkSequence;
|
||||
@XmlElement(name = "Course", required = true)
|
||||
protected XMLCourse course;
|
||||
@XmlElement(name = "CourseLimit", required = true)
|
||||
protected XMLCourseLimit courseLimit;
|
||||
|
||||
/**
|
||||
* Gets the value of the raceID property.
|
||||
* @return the id of the race
|
||||
*/
|
||||
public int getRaceID() {
|
||||
return raceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceID property.
|
||||
* @param value sets the id of the race
|
||||
*/
|
||||
public void setRaceID(int value) {
|
||||
this.raceID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceType property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRaceType() {
|
||||
return raceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceType property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRaceType(String value) {
|
||||
this.raceType = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the creationTimeDate property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getCreationTimeDate() {
|
||||
return creationTimeDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the creationTimeDate property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setCreationTimeDate(String value) {
|
||||
this.creationTimeDate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceStartTime property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLRaceStartTime }
|
||||
*
|
||||
*/
|
||||
public XMLRaceStartTime getRaceStartTime() {
|
||||
return raceStartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceStartTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLRaceStartTime }
|
||||
*
|
||||
*/
|
||||
public void setRaceStartTime(XMLRaceStartTime value) {
|
||||
this.raceStartTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the participants property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLParticipants }
|
||||
*
|
||||
*/
|
||||
public XMLParticipants getParticipants() {
|
||||
return participants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the participants property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLParticipants }
|
||||
*
|
||||
*/
|
||||
public void setParticipants(XMLParticipants value) {
|
||||
this.participants = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the compoundMarkSequence property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLCompoundMarkSequence }
|
||||
*
|
||||
*/
|
||||
public XMLCompoundMarkSequence getCompoundMarkSequence() {
|
||||
return compoundMarkSequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the compoundMarkSequence property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLCompoundMarkSequence }
|
||||
*
|
||||
*/
|
||||
public void setCompoundMarkSequence(XMLCompoundMarkSequence value) {
|
||||
this.compoundMarkSequence = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the course property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLCourse }
|
||||
*
|
||||
*/
|
||||
public XMLCourse getCourse() {
|
||||
return course;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the course property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLCourse }
|
||||
*
|
||||
*/
|
||||
public void setCourse(XMLCourse value) {
|
||||
this.course = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the courseLimit property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLCourseLimit }
|
||||
*
|
||||
*/
|
||||
public XMLCourseLimit getCourseLimit() {
|
||||
return courseLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the courseLimit property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLCourseLimit }
|
||||
*
|
||||
*/
|
||||
public void setCourseLimit(XMLCourseLimit value) {
|
||||
this.courseLimit = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:41:51 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* This object contains factory methods for each
|
||||
* Java content interface and Java element interface
|
||||
* generated in the shared.xml.Race package.
|
||||
* <p>An ObjectFactory allows you to programatically
|
||||
* construct new instances of the Java representation
|
||||
* for XML content. The Java representation of XML
|
||||
* content can consist of schema derived interfaces
|
||||
* and classes representing the binding of schema
|
||||
* type definitions, element declarations and model
|
||||
* groups. Factory methods for each of these are
|
||||
* provided in this class.
|
||||
*
|
||||
*/
|
||||
@XmlRegistry
|
||||
public class XMLRaceFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: shared.xml.Race
|
||||
*
|
||||
*/
|
||||
public XMLRaceFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLRace }
|
||||
* @return a new instance of a race.
|
||||
*/
|
||||
public XMLRace createRace() {
|
||||
return new XMLRace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLRaceStartTime }
|
||||
* @return a new start time for the race
|
||||
*/
|
||||
public XMLRaceStartTime createXMLRaceStartTime() {
|
||||
return new XMLRaceStartTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLParticipants }
|
||||
* @return a new participant of the race
|
||||
*/
|
||||
public XMLParticipants createXMLParticipants() {
|
||||
return new XMLParticipants();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLCompoundMarkSequence }
|
||||
* @return a new Compound Mark Sequence that hte race is to follow.
|
||||
*/
|
||||
public XMLCompoundMarkSequence createXMLCompoundMarkSequence() {
|
||||
return new XMLCompoundMarkSequence();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLCourse }
|
||||
* @return the course the race is to use.
|
||||
*/
|
||||
public XMLCourse createXMLCourse() {
|
||||
return new XMLCourse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLCourseLimit }
|
||||
* @return the limits/boundaries of the course.
|
||||
*/
|
||||
public XMLCourseLimit createXMLCourseLimit() {
|
||||
return new XMLCourseLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLLimit }
|
||||
* @return a point on hte boundaries
|
||||
*/
|
||||
public XMLLimit createXMLLimit() {
|
||||
return new XMLLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLCompoundMark }
|
||||
* @return a compound mark (made out of multiple marks)
|
||||
*/
|
||||
public XMLCompoundMark createXMLCompoundMark() {
|
||||
return new XMLCompoundMark();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLMark }
|
||||
* @return a mark
|
||||
*/
|
||||
public XMLMark createXMLMark() {
|
||||
return new XMLMark();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLCorner }
|
||||
* @return a corner of a compound mark sequence
|
||||
*/
|
||||
public XMLCorner createXMLCorner() {
|
||||
return new XMLCorner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link XMLYacht }
|
||||
* @return creates a new Yacht.
|
||||
*/
|
||||
public XMLYacht createXMLYacht() {
|
||||
return new XMLYacht();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="Postpone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* <attribute name="Time" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public class XMLRaceStartTime {
|
||||
|
||||
@XmlAttribute(name = "Postpone", required = true)
|
||||
protected String postpone;
|
||||
@XmlAttribute(name = "Time", required = true)
|
||||
protected String time;
|
||||
|
||||
/**
|
||||
* Gets the value of the postpone property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPostpone() {
|
||||
return postpone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the postpone property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPostpone(String value) {
|
||||
this.postpone = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the time property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the time property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setTime(String value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2017.08.14 at 02:54:32 AM NZST
|
||||
//
|
||||
|
||||
|
||||
package shared.xml.Race;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
|
||||
* <attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
|
||||
* </restriction>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "")
|
||||
public class XMLYacht {
|
||||
|
||||
@XmlAttribute(name = "SourceID", required = true)
|
||||
protected int sourceID;
|
||||
@XmlAttribute(name = "Entry")
|
||||
protected String entry;
|
||||
|
||||
/**
|
||||
* Gets the value of the sourceID property.
|
||||
* @return the id of the yacht
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the sourceID property.
|
||||
* @param value sets the source ID of the a yacht that is participating in the race
|
||||
*/
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the entry property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getEntry() {
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the entry property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setEntry(String value) {
|
||||
this.entry = value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package shared.xml;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Created by fwy13 on 13/08/17.
|
||||
*/
|
||||
public class XMLUtilities {
|
||||
|
||||
public static String classToXML(Object o) throws JAXBException {
|
||||
JAXBContext context = JAXBContext.newInstance(o.getClass());
|
||||
Marshaller jaxbMarshaller = context.createMarshaller();
|
||||
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
|
||||
jaxbMarshaller.marshal(o, sw);
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
public static Object xmlToClass(File file, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = parser.parse(file);
|
||||
|
||||
return xmlToClass(document, schemaURL, c);
|
||||
}
|
||||
|
||||
public static Object xmlToClass(String xml, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = parser.parse(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))));
|
||||
|
||||
return xmlToClass(document, schemaURL, c);
|
||||
}
|
||||
|
||||
public static Object xmlToClass(InputStream i, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = parser.parse(i);
|
||||
|
||||
return xmlToClass(document, schemaURL, c);
|
||||
}
|
||||
|
||||
public static Object xmlToClass(Document document, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
|
||||
JAXBContext jc = JAXBContext.newInstance(c);
|
||||
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
||||
|
||||
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
Schema schema = sf.newSchema(schemaURL);
|
||||
unmarshaller.setSchema(schema);
|
||||
|
||||
return unmarshaller.unmarshal(new DOMSource(document));
|
||||
}
|
||||
|
||||
public static boolean validateXML(String file, URL schemaURL){
|
||||
try {
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = parser.parse(new File(file));
|
||||
|
||||
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
Schema schema = sf.newSchema(schemaURL);
|
||||
Validator validator = schema.newValidator();
|
||||
validator.validate(new DOMSource(document));
|
||||
} catch (ParserConfigurationException e) {
|
||||
return false;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} catch (SAXException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<Race>
|
||||
<RaceID>5326</RaceID>
|
||||
<RaceType>FLEET</RaceType>
|
||||
<CreationTimeDate>2017-08-03T02:13:14+1200</CreationTimeDate>
|
||||
<RaceStartTime Postpone="false" Time="2017-08-03T02:08:10+1200"/>
|
||||
<Participants>
|
||||
<Yacht SourceID="125"/>
|
||||
</Participants>
|
||||
<CompoundMarkSequence>
|
||||
<Corner CompoundMarkID="1" SeqID="1" Rounding="SP" ZoneSize="3"/>
|
||||
<Corner CompoundMarkID="2" SeqID="2" Rounding="Port" ZoneSize="3"/>
|
||||
<Corner CompoundMarkID="4" SeqID="3" Rounding="Port" ZoneSize="3"/>
|
||||
<Corner CompoundMarkID="3" SeqID="4" Rounding="Port" ZoneSize="3"/>
|
||||
<Corner CompoundMarkID="4" SeqID="5" Rounding="Port" ZoneSize="3"/>
|
||||
<Corner CompoundMarkID="5" SeqID="6" Rounding="SP" ZoneSize="3"/>
|
||||
</CompoundMarkSequence>
|
||||
<Course>
|
||||
<CompoundMark CompoundMarkID="1" Name="Start Line">
|
||||
<Mark SeqId="1" Name="PRO" TargetLat="32.296577" TargetLng="-64.854304" SourceID="101"/>
|
||||
<Mark SeqId="2" Name="PIN" TargetLat="32.293771" TargetLng="-64.855242" SourceID="102"/>
|
||||
</CompoundMark>
|
||||
<CompoundMark CompoundMarkID="2" Name="Marker 1">
|
||||
<Mark Name="Marker1" TargetLat="32.293039" TargetLng="-64.843983" SourceID="103"/>
|
||||
</CompoundMark>
|
||||
<CompoundMark CompoundMarkID="3" Name="Windward Gate">
|
||||
<Mark Name="WGL" SeqId="1" TargetLat="32.28468" TargetLng="-64.850045" SourceID="104"/>
|
||||
<Mark Name="WGR" SeqId="2" TargetLat="32.280164" TargetLng="-64.847591" SourceID="105"/>
|
||||
</CompoundMark>
|
||||
<CompoundMark CompoundMarkID="4" Name="Leeward Gate">
|
||||
<Mark Name="LGL" SeqId="1" TargetLat="32.309693" TargetLng="-64.835249" SourceID="106"/>
|
||||
<Mark Name="LGR" SeqId="2" TargetLat="32.308046" TargetLng="-64.831785" SourceID="107"/>
|
||||
</CompoundMark>
|
||||
<CompoundMark CompoundMarkID="5" Name="Finish Line">
|
||||
<Mark Name="FL" SeqId="1" TargetLat="32.317379" TargetLng="-64.839291" SourceID="108"/>
|
||||
<Mark Name="FR" SeqId="2" TargetLat="32.317257" TargetLng="-64.83626" SourceID="109"/>
|
||||
</CompoundMark>
|
||||
</Course>
|
||||
<CourseLimit>
|
||||
<Limit Lat="32.313922" Lon="-64.837168" SeqID="1"/>
|
||||
<Limit Lat="32.317379" Lon="-64.839291" SeqID="2"/>
|
||||
<Limit Lat="32.317911" Lon="-64.836996" SeqID="3"/>
|
||||
<Limit Lat="32.317257" Lon="-64.83626" SeqID="4"/>
|
||||
<Limit Lat="32.304273" Lon="-64.822834" SeqID="5"/>
|
||||
<Limit Lat="32.279097" Lon="-64.841545" SeqID="6"/>
|
||||
<Limit Lat="32.279604" Lon="-64.849871" SeqID="7"/>
|
||||
<Limit Lat="32.289545" Lon="-64.854162" SeqID="8"/>
|
||||
<Limit Lat="32.290198" Lon="-64.858711" SeqID="9"/>
|
||||
<Limit Lat="32.297164" Lon="-64.856394" SeqID="10"/>
|
||||
<Limit Lat="32.296148" Lon="-64.849184" SeqID="11"/>
|
||||
</CourseLimit>
|
||||
</Race>
|
||||
@ -0,0 +1,6 @@
|
||||
<jaxb:bindings
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
|
||||
version="2.1">
|
||||
<jaxb:globalBindings localScoping="toplevel"/>
|
||||
</jaxb:bindings>
|
||||
@ -0,0 +1,17 @@
|
||||
<jxb:bindings version="1.0"
|
||||
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
|
||||
jxb:extensionBindingPrefixes="xjc">
|
||||
|
||||
<jxb:bindings schemaLocation="raceSchema.xsd" node="/xs:schema">
|
||||
<jxb:schemaBindings>
|
||||
<jxb:nameXmlTransform>
|
||||
<jxb:typeName prefix="XML"/>
|
||||
<jxb:anonymousTypeName prefix="XML"/>
|
||||
</jxb:nameXmlTransform>
|
||||
</jxb:schemaBindings>
|
||||
<jxb:globalBindings localScoping="toplevel"/>
|
||||
</jxb:bindings>
|
||||
|
||||
</jxb:bindings>
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="Race">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="RaceID" type="xs:int"/>
|
||||
<xs:element name="RaceType" type="xs:string"/>
|
||||
<xs:element name="CreationTimeDate" type="xs:string"/>
|
||||
<xs:element name="RaceStartTime">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="Postpone" type="xs:string" use="required"/>
|
||||
<xs:attribute name="Time" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Participants">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Yacht" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="SourceID" type="xs:int" use="required"/>
|
||||
<xs:attribute name="Entry" type="xs:string"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="CompoundMarkSequence">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Corner" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="CompoundMarkID" type="xs:int" use="required"/>
|
||||
<xs:attribute name="SeqID" type="xs:int" use="required"/>
|
||||
<xs:attribute name="Rounding" type="xs:string" use="required"/>
|
||||
<xs:attribute name="ZoneSize" type="xs:int" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Course">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="CompoundMark" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Mark" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="SeqId" type="xs:int"/>
|
||||
<xs:attribute name="Name" type="xs:string" use="required"/>
|
||||
<xs:attribute name="TargetLat" type="xs:double" use="required"/>
|
||||
<xs:attribute name="TargetLng" type="xs:double" use="required"/>
|
||||
<xs:attribute name="SourceID" type="xs:int" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="CompoundMarkID" type="xs:int" use="required"/>
|
||||
<xs:attribute name="Name" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="CourseLimit">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Limit" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="Lat" type="xs:double" use="required"/>
|
||||
<xs:attribute name="Lon" type="xs:double" use="required"/>
|
||||
<xs:attribute name="SeqID" type="xs:int" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@ -0,0 +1,31 @@
|
||||
package mock.xml;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
import shared.dataInput.RaceXMLReader;
|
||||
import shared.exceptions.InvalidRaceDataException;
|
||||
import shared.exceptions.XMLReaderException;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class RaceXMLCreatorTest {
|
||||
|
||||
String fileToTest = "mock/mockXML/raceSchemaTest.xml";
|
||||
@Mock
|
||||
RaceXMLReader reader;
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() throws XMLReaderException, JAXBException, InvalidRaceDataException {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLineAngleTest(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue