mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 06:49:56 +00:00
Merge branch 'bug3604'
This commit is contained in:
commit
9781659655
9 files changed
+39
-22
No files matched your search
+2
@@ -21,6 +21,8 @@ import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
|
||||
public class CandidateFinderImplWhiteBoxTest {
|
||||
private static class CandidateFinderWithPublicGetProbabilityOfStartBasedOnOtherCompetitorsStartLineDistances extends CandidateFinderImpl {
|
||||
private static final long serialVersionUID = 5472855431045667537L;
|
||||
|
||||
public CandidateFinderWithPublicGetProbabilityOfStartBasedOnOtherCompetitorsStartLineDistances(
|
||||
DynamicTrackedRace race) {
|
||||
super(race);
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
package com.sap.sailing.domain.markpassingcalculation;
|
||||
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sailing.domain.markpassingcalculation.impl.CandidateChooserImpl;
|
||||
import com.sap.sailing.domain.markpassingcalculation.impl.CandidateImpl;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* Represent the possible {@link MarkPassing} of a {@link Waypoint}. It contains the {@link Waypoint} it might be passing, a
|
||||
|
||||
-6
@@ -15,9 +15,6 @@ import com.sap.sse.common.Util;
|
||||
* @author Nicolas Klose
|
||||
*/
|
||||
public interface CandidateFinder {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param fixes
|
||||
* Either new fixes or fixes that may have changed their status, e.g. as a result of new mark
|
||||
@@ -26,8 +23,6 @@ public interface CandidateFinder {
|
||||
*/
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getCandidateDeltas(Competitor c, Iterable<GPSFix> fixes);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* When initializing or refreshing the calculator, the whole race until now is evaluated. For that purpose all of the
|
||||
* {@link Candidate}s are needed instead of just the deltas.
|
||||
@@ -41,5 +36,4 @@ public interface CandidateFinder {
|
||||
* mark fixes..
|
||||
*/
|
||||
Map<Competitor, List<GPSFix>> calculateFixesAffectedByNewMarkFixes(Map<Mark, List<GPSFix>> newMarkFixes);
|
||||
|
||||
}
|
||||
+11
-9
@@ -67,15 +67,17 @@ public class MarkPassingCalculator {
|
||||
this.race = race;
|
||||
finder = new CandidateFinderImpl(race);
|
||||
chooser = new CandidateChooserImpl(race);
|
||||
for (Competitor c : race.getRace().getCompetitors()) {
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> allCandidates = finder.getAllCandidates(c);
|
||||
chooser.calculateMarkPassDeltas(c, allCandidates.getA(), allCandidates.getB());
|
||||
}
|
||||
if (listen) {
|
||||
final Thread listenerThread = new Thread(new Listen(race.getRace().getName()), "MarkPassingCalculator for race " + race.getRace().getName());
|
||||
listenerThread.setDaemon(true);
|
||||
listenerThread.start();
|
||||
}
|
||||
new Thread(() -> {
|
||||
for (Competitor c : race.getRace().getCompetitors()) {
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> allCandidates = finder.getAllCandidates(c);
|
||||
chooser.calculateMarkPassDeltas(c, allCandidates.getA(), allCandidates.getB());
|
||||
}
|
||||
if (listen) {
|
||||
final Thread listenerThread = new Thread(new Listen(race.getRace().getName()), "MarkPassingCalculator for race " + race.getRace().getName());
|
||||
listenerThread.setDaemon(true);
|
||||
listenerThread.start();
|
||||
}
|
||||
}, "MarkPassingCalculator for race "+race.getRace().getName()+" initialization").start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ public class CandidateChooserImpl implements CandidateChooser {
|
||||
private final CandidateWithSettableTime start;
|
||||
private final CandidateWithSettableWaypointIndex end;
|
||||
private final DynamicTrackedRace race;
|
||||
|
||||
|
||||
public CandidateChooserImpl(DynamicTrackedRace race) {
|
||||
this.race = race;
|
||||
waypointPositionAndDistanceCache = new WaypointPositionAndDistanceCache(race, Duration.ONE_MINUTE);
|
||||
|
||||
-1
@@ -49,7 +49,6 @@ import com.sap.sse.common.Util.Pair;
|
||||
*
|
||||
*/
|
||||
public class CandidateFinderImpl implements CandidateFinder {
|
||||
|
||||
// The higher this is, the closer the fixes have to be to waypoint to become a Candidate
|
||||
private final int STRICTNESS_OF_DISTANCE_BASED_PROBABILITY = 7;
|
||||
|
||||
|
||||
+8
-3
@@ -104,9 +104,6 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
this.startTimeChangedListeners = new HashSet<>();
|
||||
this.raceAbortedListeners = new HashSet<>();
|
||||
this.raceIsKnownToStartUpwind = race.getBoatClass().typicallyStartsUpwind();
|
||||
if (markPassingCalculator != null) {
|
||||
logListener.setMarkPassingUpdateListener(markPassingCalculator.getListener());
|
||||
}
|
||||
if (!raceIsKnownToStartUpwind) {
|
||||
Set<WindSource> windSourcesToExclude = new HashSet<WindSource>();
|
||||
for (WindSource windSourceToExclude : getWindSourcesToExclude()) {
|
||||
@@ -135,6 +132,14 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
startTimeChangedListeners = new HashSet<>();
|
||||
raceAbortedListeners = new HashSet<>();
|
||||
}
|
||||
|
||||
protected Object readResolve() {
|
||||
super.readResolve();
|
||||
if (markPassingCalculator != null) {
|
||||
logListener.setMarkPassingUpdateListener(markPassingCalculator.getListener());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link #raceIsKnownToStartUpwind} (see also {@link #raceIsKnownToStartUpwind()}) is initialized based on the <code>race</code>'s
|
||||
|
||||
+14
-1
@@ -281,7 +281,8 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
|
||||
|
||||
private transient ConcurrentHashMap<TimePoint, Future<Wind>> directionFromStartToNextMarkCache;
|
||||
|
||||
protected final MarkPassingCalculator markPassingCalculator;
|
||||
protected transient MarkPassingCalculator markPassingCalculator;
|
||||
private final boolean hasMarkPassingCalculator;
|
||||
|
||||
private final ConcurrentHashMap<Mark, GPSFixTrack<Mark, GPSFix>> markTracks;
|
||||
|
||||
@@ -542,6 +543,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
|
||||
} else {
|
||||
markPassingCalculator = null;
|
||||
}
|
||||
hasMarkPassingCalculator = useInternalMarkPassingAlgorithm;
|
||||
// now wait until wind loading has at least started; then we know that the serialization lock is safely held by the loader
|
||||
try {
|
||||
waitUntilLoadingFromWindStoreComplete();
|
||||
@@ -643,6 +645,17 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
|
||||
triggerManeuverCacheRecalculationForAllCompetitors();
|
||||
logger.info("Deserialized race " + getRace().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* After the object graph has entirely been re-constructed, create the mark passing calculator if
|
||||
* the original object had one.
|
||||
*/
|
||||
protected Object readResolve() {
|
||||
if (hasMarkPassingCalculator) {
|
||||
markPassingCalculator = createMarkPassingCalculator();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the {@link TrackedRace} object and the {@link RaceDefinition} and in particular its {@link CourseImpl} objects are not
|
||||
|
||||
@@ -18,6 +18,7 @@ java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
|
||||
# Overwrite the log leves for specific loggers here
|
||||
com.sap.sailing.level = FINE
|
||||
com.sap.sse.level = FINE
|
||||
#com.sap.sailing.domain.markpassingcalculation.level = FINEST
|
||||
# log at level FINEST for TransientCompetitorStoreIMpl
|
||||
#com.sap.sailing.domain.base.impl.TransientCompetitorStoreImpl.level = FINEST
|
||||
#com.sap.sailing.domain.base.impl.SharedDomainFactoryImpl.level = FINEST
|
||||
|
||||
Reference in new issue
Block a user