mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
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:
+15
-11
@@ -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
|
||||
+2
-2
@@ -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;
|
||||
Reference in New Issue
Block a user