mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 22:01:02 +00:00
made windStore in Simulator final to ensure proper initialization
This commit is contained in:
1 parent
f355770c1b
commit
1d6739b230
3 files changed
+12
-9
No files matched your search
+8
-5
@@ -29,17 +29,21 @@ public class Simulator {
|
|||||||
private static final Logger logger = Logger.getLogger(Simulator.class.getName());
|
private static final Logger logger = Logger.getLogger(Simulator.class.getName());
|
||||||
|
|
||||||
private DynamicTrackedRace trackedRace;
|
private DynamicTrackedRace trackedRace;
|
||||||
private WindStore windStore;
|
private final WindStore windStore;
|
||||||
private long advanceInMillis = -1;
|
private long advanceInMillis = -1;
|
||||||
private Timer timer = new Timer("Timer for TracTrac Simulator");
|
private Timer timer = new Timer("Timer for TracTrac Simulator");
|
||||||
private boolean stopped;
|
private boolean stopped;
|
||||||
|
|
||||||
|
public Simulator(WindStore windStore) {
|
||||||
|
super();
|
||||||
|
assert windStore != null;
|
||||||
|
this.windStore = windStore;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a wind store which replays the wind store events against a tracked race, correcting the wind fixes with
|
* The wind store returned is an {@link EmptyWindStore}.
|
||||||
* the simulation delay. The wind store returned is an {@link EmptyWindStore}.
|
|
||||||
*/
|
*/
|
||||||
public WindStore simulatingWindStore(WindStore windStore) {
|
public WindStore simulatingWindStore(WindStore windStore) {
|
||||||
this.windStore = windStore;
|
|
||||||
return EmptyWindStore.INSTANCE;
|
return EmptyWindStore.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +67,6 @@ public class Simulator {
|
|||||||
*/
|
*/
|
||||||
private void startWindPlayer() {
|
private void startWindPlayer() {
|
||||||
assert this.trackedRace != null;
|
assert this.trackedRace != null;
|
||||||
assert this.windStore != null;
|
|
||||||
for (final Map.Entry<? extends WindSource, ? extends WindTrack> windSourceAndTrack : windStore.loadWindTracks(
|
for (final Map.Entry<? extends WindSource, ? extends WindTrack> windSourceAndTrack : windStore.loadWindTracks(
|
||||||
trackedRace.getTrackedRegatta(), trackedRace,
|
trackedRace.getTrackedRegatta(), trackedRace,
|
||||||
/* millisecondsOverWhichToAverageWind doesn't matter because we only use raw fixes */ 10000).entrySet()) {
|
/* millisecondsOverWhichToAverageWind doesn't matter because we only use raw fixes */ 10000).entrySet()) {
|
||||||
|
|||||||
+1
-1
@@ -192,7 +192,7 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
|||||||
this.domainFactory = domainFactory;
|
this.domainFactory = domainFactory;
|
||||||
final Simulator simulator;
|
final Simulator simulator;
|
||||||
if (simulateWithStartTimeNow) {
|
if (simulateWithStartTimeNow) {
|
||||||
simulator = new Simulator();
|
simulator = new Simulator(windStore);
|
||||||
} else {
|
} else {
|
||||||
simulator = null;
|
simulator = null;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -31,7 +31,7 @@ import com.sap.sailing.domain.tracking.Wind;
|
|||||||
|
|
||||||
public class DynamicTrackedRaceLogListener implements RaceLogEventVisitor {
|
public class DynamicTrackedRaceLogListener implements RaceLogEventVisitor {
|
||||||
|
|
||||||
public static final Logger log = Logger.getLogger(DynamicTrackedRaceLogListener.class.getName());
|
private static final Logger logger = Logger.getLogger(DynamicTrackedRaceLogListener.class.getName());
|
||||||
|
|
||||||
private DynamicTrackedRace trackedRace;
|
private DynamicTrackedRace trackedRace;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class DynamicTrackedRaceLogListener implements RaceLogEventVisitor {
|
|||||||
// ... onCourseDesignChangedByRaceCommittee() might be called more than once.
|
// ... onCourseDesignChangedByRaceCommittee() might be called more than once.
|
||||||
trackedRace.onCourseDesignChangedByRaceCommittee(courseDesign);
|
trackedRace.onCourseDesignChangedByRaceCommittee(courseDesign);
|
||||||
} else {
|
} else {
|
||||||
log.info("Could not find any course design update on race log of " + trackedRace.getRace().getName() + "! Not sending out any events.");
|
logger.info("Could not find any course design update on race log of " + trackedRace.getRace().getName() + "! Not sending out any events.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ public class DynamicTrackedRaceLogListener implements RaceLogEventVisitor {
|
|||||||
/* invoke listeners with received start time, this will also trigger tractrac update */
|
/* invoke listeners with received start time, this will also trigger tractrac update */
|
||||||
trackedRace.onStartTimeChangedByRaceCommittee(startTime);
|
trackedRace.onStartTimeChangedByRaceCommittee(startTime);
|
||||||
} else {
|
} else {
|
||||||
log.info("Could not find any valid start time on race log of " + trackedRace.getRace().getName() + "! Not sending out any events.");
|
logger.info("Could not find any valid start time on race log of " + trackedRace.getRace().getName() + "! Not sending out any events.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user