|
|
|
|
@ -35,7 +35,7 @@ public class Event {
|
|
|
|
|
|
|
|
|
|
private Polars boatPolars;
|
|
|
|
|
|
|
|
|
|
private ConnectionAcceptor mockOutput;
|
|
|
|
|
private ConnectionAcceptor connectionAcceptor;
|
|
|
|
|
private LatestMessages latestMessages;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -51,7 +51,7 @@ public class Event {
|
|
|
|
|
this.boatPolars = PolarParser.parse("mock/polars/acc_polars.csv");
|
|
|
|
|
|
|
|
|
|
this.latestMessages = new LatestMessages();
|
|
|
|
|
this.mockOutput = new ConnectionAcceptor(latestMessages);
|
|
|
|
|
this.connectionAcceptor = new ConnectionAcceptor(latestMessages);
|
|
|
|
|
}
|
|
|
|
|
catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
@ -67,11 +67,11 @@ public class Event {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getAddress() throws UnknownHostException {
|
|
|
|
|
return mockOutput.getAddress();
|
|
|
|
|
return connectionAcceptor.getAddress();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getPort() {
|
|
|
|
|
return mockOutput.getServerPort();
|
|
|
|
|
return connectionAcceptor.getServerPort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -82,7 +82,7 @@ public class Event {
|
|
|
|
|
* @throws InvalidRegattaDataException Thrown if the regatta xml file cannot be parsed.
|
|
|
|
|
*/
|
|
|
|
|
public void start() throws InvalidRaceDataException, XMLReaderException, InvalidBoatDataException, InvalidRegattaDataException {
|
|
|
|
|
new Thread(mockOutput).start();
|
|
|
|
|
new Thread(connectionAcceptor, "Event.Start()->ConnectionAcceptor thread").start();
|
|
|
|
|
|
|
|
|
|
sendXMLs();
|
|
|
|
|
|
|
|
|
|
@ -94,7 +94,7 @@ public class Event {
|
|
|
|
|
//Create and start race.
|
|
|
|
|
RaceLogic newRace = new RaceLogic(new MockRace(boatDataSource, raceDataSource, regattaDataSource, this.latestMessages, this.boatPolars, Constants.RaceTimeScale), this.latestMessages);
|
|
|
|
|
|
|
|
|
|
new Thread(newRace).start();
|
|
|
|
|
new Thread(newRace, "Event.Start()->RaceLogic thread").start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -102,11 +102,11 @@ public class Event {
|
|
|
|
|
*/
|
|
|
|
|
private void sendXMLs() {
|
|
|
|
|
|
|
|
|
|
mockOutput.setRegattaXml(regattaXML);
|
|
|
|
|
connectionAcceptor.setRegattaXml(regattaXML);
|
|
|
|
|
|
|
|
|
|
mockOutput.setRaceXml(raceXML);
|
|
|
|
|
connectionAcceptor.setRaceXml(raceXML);
|
|
|
|
|
|
|
|
|
|
mockOutput.setBoatsXml(boatXML);
|
|
|
|
|
connectionAcceptor.setBoatsXml(boatXML);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|