Commented and javadoc-ed RegattaData and BoatData
#story[9]
This commit is contained in:
@@ -32,6 +32,10 @@ public class BoatData {
|
||||
this.boatData = boatData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of boats competing in a race
|
||||
* @return String containing xml-formatted boats description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
try {
|
||||
@@ -70,6 +74,10 @@ public class BoatData {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs through competing boats, creating an element for each
|
||||
* @param boatsElement boats element to be added to
|
||||
*/
|
||||
private void appendIndividualBoats(Element boatsElement) {
|
||||
|
||||
for (int i=0; i < boatData.size(); i++) {
|
||||
@@ -87,6 +95,10 @@ public class BoatData {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends type attribute of a boat
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendType(Element boat) {
|
||||
//Type attribute
|
||||
Attr attrType = doc.createAttribute("Type");
|
||||
@@ -94,6 +106,11 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends sourceID attribute of a boat
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendSourceID(Element boat, int i) {
|
||||
//SourceID attribute
|
||||
Attr attrSourceID = doc.createAttribute("SourceID");
|
||||
@@ -101,6 +118,10 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrSourceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends shapeID attribute of a boat
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendShapeID(Element boat) {
|
||||
//ShapeID attribute
|
||||
Attr attrShapeID = doc.createAttribute("ShapeID");
|
||||
@@ -108,6 +129,10 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrShapeID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends hull name attribute of a boat
|
||||
* @param boat element being added to
|
||||
*/
|
||||
private void appendHullNum(Element boat) {
|
||||
//HullNum attribute
|
||||
Attr attrHullNum = doc.createAttribute("HullNum");
|
||||
@@ -115,6 +140,11 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrHullNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends stow name attribute of a boat
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendStoweName(Element boat, int i) {
|
||||
//StoweName attribute
|
||||
Attr attrStoweName = doc.createAttribute("StoweName");
|
||||
@@ -122,6 +152,11 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrStoweName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends short name attribute of a boat
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendShortName(Element boat, int i) {
|
||||
//ShortName attribute
|
||||
Attr attrShortName = doc.createAttribute("ShortName");
|
||||
@@ -129,6 +164,11 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrShortName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends boat name attribute of a boat
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendBoatName(Element boat, int i) {
|
||||
//BoatName attribute
|
||||
Attr attrBoatName = doc.createAttribute("BoatName");
|
||||
@@ -136,6 +176,11 @@ public class BoatData {
|
||||
boat.setAttributeNode(attrBoatName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends gps attributes of a boat
|
||||
* @param boat element being added to
|
||||
* @param i boat number
|
||||
*/
|
||||
private void appendGPSCoords(Element boat, int i) {
|
||||
//GPSCoord for element
|
||||
Element GPSCoord = doc.createElement("GPSposition");
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RaceData {
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of a race.
|
||||
* @return String containing xml - formatted race description
|
||||
* @return String containing xml-formatted race description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ public class RegattaData {
|
||||
this.regattaDataSource = regattaDataSource;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an AC35 officially formatted xml description of a regatta
|
||||
* @return String containing xml-formatted regatta description
|
||||
*/
|
||||
public String createXML() {
|
||||
|
||||
try {
|
||||
@@ -62,66 +67,9 @@ public class RegattaData {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void appendRegattaID() {
|
||||
//regattaID element
|
||||
Element regattaID = doc.createElement("RegattaID");
|
||||
regattaID.appendChild(doc.createTextNode(Integer.toString(regattaDataSource.getRegatta().getRegattaID())));
|
||||
rootElement.appendChild(regattaID);
|
||||
}
|
||||
|
||||
private void appendRegattaName() {
|
||||
//regattaName element
|
||||
Element regattaName = doc.createElement("RegattaName");
|
||||
regattaName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getRegattaName()));
|
||||
rootElement.appendChild(regattaName);
|
||||
}
|
||||
|
||||
private void appendCourseName() {
|
||||
//courseName element
|
||||
Element courseName = doc.createElement("CourseName");
|
||||
courseName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getCourseName()));
|
||||
rootElement.appendChild(courseName);
|
||||
}
|
||||
|
||||
private void appendCentralLatitude() {
|
||||
//centralLatitude element
|
||||
Element centralLat = doc.createElement("CentralLatitude");
|
||||
centralLat.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLatitude())));
|
||||
rootElement.appendChild(centralLat);
|
||||
}
|
||||
|
||||
private void appendCentralLongitude() {
|
||||
//centralLongitude element
|
||||
Element centralLong = doc.createElement("CentralLongitude");
|
||||
centralLong.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLongitude())));
|
||||
rootElement.appendChild(centralLong);
|
||||
}
|
||||
|
||||
private void appendCentralAltitude() {
|
||||
//centralAltitude element
|
||||
Element centralAlt = doc.createElement("CentralAltitude");
|
||||
centralAlt.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralAltitude())));
|
||||
rootElement.appendChild(centralAlt);
|
||||
}
|
||||
|
||||
private void appedUtcOffset() {
|
||||
//utcOffset element
|
||||
Element utcOffset = doc.createElement("UtcOffset");
|
||||
utcOffset.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getUtcOffset())));
|
||||
rootElement.appendChild(utcOffset);
|
||||
|
||||
}
|
||||
|
||||
private void appendMagneticVariation() {
|
||||
//magneticVariation element
|
||||
Element magneticVariation = doc.createElement("MagneticVariation");
|
||||
magneticVariation.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getMagneticVariation())));
|
||||
rootElement.appendChild(magneticVariation);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all necessary child elements and appends them to the xml doc
|
||||
*/
|
||||
private void appendChildElements() {
|
||||
appendRegattaID();
|
||||
appendRegattaName();
|
||||
@@ -132,4 +80,86 @@ public class RegattaData {
|
||||
appedUtcOffset();
|
||||
appendMagneticVariation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends regatta id element
|
||||
*/
|
||||
private void appendRegattaID() {
|
||||
//regattaID element
|
||||
Element regattaID = doc.createElement("RegattaID");
|
||||
regattaID.appendChild(doc.createTextNode(Integer.toString(regattaDataSource.getRegatta().getRegattaID())));
|
||||
rootElement.appendChild(regattaID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends regatta name element
|
||||
*/
|
||||
private void appendRegattaName() {
|
||||
//regattaName element
|
||||
Element regattaName = doc.createElement("RegattaName");
|
||||
regattaName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getRegattaName()));
|
||||
rootElement.appendChild(regattaName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends course name element
|
||||
*/
|
||||
private void appendCourseName() {
|
||||
//courseName element
|
||||
Element courseName = doc.createElement("CourseName");
|
||||
courseName.appendChild(doc.createTextNode(regattaDataSource.getRegatta().getCourseName()));
|
||||
rootElement.appendChild(courseName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central latitude element
|
||||
*/
|
||||
private void appendCentralLatitude() {
|
||||
//centralLatitude element
|
||||
Element centralLat = doc.createElement("CentralLatitude");
|
||||
centralLat.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLatitude())));
|
||||
rootElement.appendChild(centralLat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central longitude element
|
||||
*/
|
||||
private void appendCentralLongitude() {
|
||||
//centralLongitude element
|
||||
Element centralLong = doc.createElement("CentralLongitude");
|
||||
centralLong.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralLongitude())));
|
||||
rootElement.appendChild(centralLong);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends central altitude element
|
||||
*/
|
||||
private void appendCentralAltitude() {
|
||||
//centralAltitude element
|
||||
Element centralAlt = doc.createElement("CentralAltitude");
|
||||
centralAlt.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getCentralAltitude())));
|
||||
rootElement.appendChild(centralAlt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends utc offset element
|
||||
*/
|
||||
private void appedUtcOffset() {
|
||||
//utcOffset element
|
||||
Element utcOffset = doc.createElement("UtcOffset");
|
||||
utcOffset.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getUtcOffset())));
|
||||
rootElement.appendChild(utcOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and appends magnetic variation element
|
||||
*/
|
||||
private void appendMagneticVariation() {
|
||||
//magneticVariation element
|
||||
Element magneticVariation = doc.createElement("MagneticVariation");
|
||||
magneticVariation.appendChild(doc.createTextNode(Double.toString(regattaDataSource.getRegatta().getMagneticVariation())));
|
||||
rootElement.appendChild(magneticVariation);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user