Moved XML message creation to RaceServer instead of ConnectionAcceptor.

RaceServer does not currently generate new XMLMessages - NYI.
Added a sequence number to RaceDataSource - this is used to indicate that the data source has been modified.
#story[1188]
This commit is contained in:
fjc40
2017-09-01 01:19:17 +12:00
parent d0eebcdb2f
commit 9156bde8af
12 changed files with 154 additions and 120 deletions
@@ -76,6 +76,8 @@ public class EmptyRaceDataSource implements RaceDataSource {
private RaceTypeEnum raceType = RaceTypeEnum.NOT_A_RACE_TYPE;
private int sequenceNumber = 0;
public EmptyRaceDataSource() {
}
@@ -126,4 +128,14 @@ public class EmptyRaceDataSource implements RaceDataSource {
public List<Integer> getParticipants() {
return participants;
}
@Override
public int getSequenceNumber() {
return sequenceNumber;
}
@Override
public void incrementSequenceNumber() {
sequenceNumber++;
}
}
@@ -83,4 +83,16 @@ public interface RaceDataSource {
* @return Bottom right GPS coordinate.
*/
GPSCoordinate getMapBottomRight();
/**
* Returns the sequence number associated with this data source. Used to indicate when it has changed.
* @return Sequence number.
*/
int getSequenceNumber();
/**
* Increments the sequence number for this data source. Used to indicate that it has changed.
*/
void incrementSequenceNumber();
}
@@ -84,6 +84,8 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
private RaceTypeEnum raceType;
private int sequenceNumber = 0;
/**
@@ -491,4 +493,14 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
public List<Corner> getCornersList() {
return cornersList;
}
@Override
public int getSequenceNumber() {
return sequenceNumber;
}
@Override
public void incrementSequenceNumber() {
sequenceNumber++;
}
}
@@ -33,20 +33,23 @@ public class Constants {
* Frame periods are multiplied by this to get the amount of time a single frame represents.
* E.g., frame period = 20ms, scale = 5, frame represents 20 * 5 = 100ms, and so boats are simulated for 100ms, even though only 20ms actually occurred.
*/
public static final int RaceTimeScale = 10;
public static final int RaceTimeScale = 1;//10;
/**
* The race pre-start time, in milliseconds. 3 minutes.
*/
public static final long RacePreStartTime = 1 * 10 * 1000;
public static final long RacePreStartTime = 3 * 60 * 1000;
/**
* The race preparatory time, in milliseconds. 1 minutes.
* The race preparatory time, in milliseconds. 1 minute.
*/
public static final long RacePreparatoryTime = 1 * 60 * 1000;
/**
* The number of milliseconds in one hour.
* <br>