mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-23 04:23:54 +00:00
The advanceInMillis in the Simulator can now also be set by a given start time when no markpassdata is available, by calling advanceStartTime(TimePoint raceStartTime).
This commit is contained in:
1 parent
f3df166f60
commit
9618b28ef8
2 files changed
+21
-7
No files matched your search
+17
-3
@@ -154,11 +154,25 @@ public class Simulator {
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@link #advanceInMillis} is already set to a non-negative value, it is left alone, and {@link #delay(TimePoint)} is called.
|
||||
* Otherwise, <code>time</code> is taken to be the original start time of the race which is then used to compute
|
||||
* {@link #advanceInMillis} such that <code>time.asMillis() + advanceInMillis == System.currentTimeMillis()</code>.
|
||||
* If {@link #advanceInMillis} is already set to a non-negative value, it is left alone, and
|
||||
* {@link #delay(TimePoint)} is called. Otherwise, <code>time</code> is taken to be the original start time of the
|
||||
* race which is then used to compute {@link #advanceInMillis} such that
|
||||
* <code>time.asMillis() + advanceInMillis == System.currentTimeMillis()</code>.
|
||||
*/
|
||||
public TimePoint advanceMarkPassingTimePoint(TimePoint time) {
|
||||
return advanceTimePointAndUseAsStartTimeIfNeeded(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@link #advanceInMillis} is already set to a non-negative value, it is left alone, and
|
||||
* {@link #delay(TimePoint)} is called. Otherwise, the given start time <code>time</code> is used to compute
|
||||
* {@link #advanceInMillis} such that <code>time.asMillis() + advanceInMillis == System.currentTimeMillis()</code>.
|
||||
*/
|
||||
public TimePoint advanceStartTime(TimePoint raceStartTime) {
|
||||
return advanceTimePointAndUseAsStartTimeIfNeeded(raceStartTime);
|
||||
}
|
||||
|
||||
private TimePoint advanceTimePointAndUseAsStartTimeIfNeeded(TimePoint time){
|
||||
if (isAdvanceInMilliseSet()) {
|
||||
return advance(time);
|
||||
} else {
|
||||
|
||||
+4
-4
@@ -517,6 +517,10 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
if (currentRace != null) {
|
||||
final DynamicTrackedRace trackedRace = getTrackedRegatta().getExistingTrackedRace(currentRace);
|
||||
if (trackedRace != null) {
|
||||
TimePoint raceStartTime = clientParams.getRace().getStartTime();
|
||||
if (raceStartTime != null) {
|
||||
trackedRace.setStartTimeReceived(simulator == null ? raceStartTime : simulator.advanceStartTime(raceStartTime));
|
||||
}
|
||||
TimePoint startOfTracking = clientParams.getRace().getTrackingStartTime();
|
||||
if (startOfTracking != null) {
|
||||
trackedRace.setStartOfTrackingReceived(simulator == null ? startOfTracking : simulator
|
||||
@@ -527,10 +531,6 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
trackedRace.setEndOfTrackingReceived(simulator == null ? endOfTracking : simulator
|
||||
.advance(endOfTracking));
|
||||
}
|
||||
TimePoint raceStartTime = clientParams.getRace().getStartTime();
|
||||
if (raceStartTime != null) {
|
||||
trackedRace.setStartTimeReceived(raceStartTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user