Refactored some of the XMLGenerator code. Added tokens to the generated XML

Refactor not complete. Generation needs some tidying.

#story[1250]
This commit is contained in:
William Muir
2017-08-29 14:56:06 +12:00
parent 2fcff65dd6
commit c15f13bc2c
10 changed files with 128 additions and 62 deletions
@@ -5,28 +5,23 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import seng302.model.ServerYacht;
import seng302.model.token.Token;
/**
* A Race object that can be parsed into XML
*/
public class Race {
public class RaceXMLTemplate {
private List<ServerYacht> yachts;
private LocalDateTime startTime;
private List<Token> tokens;
public Race(){
yachts = new ArrayList<>();
public RaceXMLTemplate(List<ServerYacht> yachts, List<Token> tokens) {
this.yachts = yachts;
this.tokens = tokens;
startTime = LocalDateTime.now();
}
/**
* Add a boat to the race
* @param yacht The boat to add
*/
public void addBoat(ServerYacht yacht) {
yachts.add(yacht);
}
/**
* Get a list of boats in the race
* @return A List of boats
@@ -35,6 +30,15 @@ public class Race {
return Collections.unmodifiableList(yachts);
}
/**
* Get a list of tokens in the race
*
* @return A list of tokens
*/
public List<Token> getTokens() {
return Collections.unmodifiableList(tokens);
}
/**
* Set the time until the race starts
* @param seconds The time in seconds until the race starts
@@ -3,7 +3,7 @@ package seng302.model.stream.xml.generator;
/**
* A Race regatta that can be parsed into XML
*/
public class Regatta {
public class RegattaXMLTemplate {
private final Double DEFAULT_ALTITUDE = 0d;
private final Integer DEFAULT_REGATTA_ID = 0;
@@ -18,7 +18,7 @@ public class Regatta {
private Integer utcOffset;
private Double magneticVariation;
public Regatta(String name, String courseName, Double latitude, Double longitude) {
public RegattaXMLTemplate(String name, String courseName, Double latitude, Double longitude) {
this.name = name;
this.id = DEFAULT_REGATTA_ID;
this.courseName = courseName;