mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-07 19:42:17 +00:00
use the new GPSFixTrack.isValid(FixType) method in mark passing calculator to exclude invalid fixes from candidate determination
Change-Id: Ia6e449f81f57568554bd86baf3f7f58cc4b00539
This commit is contained in:
1 parent
be425b68a5
commit
d24d71c784
9 files changed
+55
-53
No files matched your search
+2
-1
@@ -19,6 +19,7 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.impl.CourseImpl;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
@@ -55,7 +56,7 @@ public class MarkPassingCalculatorTest {
|
||||
mpc.suspend();
|
||||
mpc.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes, Map<Mark, List<GPSFix>> markFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes, Map<Mark, List<GPSFix>> markFixes,
|
||||
List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints, IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
List<Pair<Competitor, Integer>> removedMarkPassings, List<Pair<Competitor, Integer>> suppressedMarkPassings,
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.markpassingcalculation.Candidate;
|
||||
import com.sap.sailing.domain.markpassingcalculation.CandidateChooser;
|
||||
@@ -277,7 +276,7 @@ public abstract class AbstractMarkPassingTest extends OnlineTracTracBasedTest {
|
||||
|
||||
protected void calculateMarkPassingsForPartialTrack(Competitor c, final TimePoint upToTimePoint,
|
||||
CandidateFinder finder, CandidateChooser chooser) {
|
||||
List<GPSFix> fixes = new ArrayList<GPSFix>();
|
||||
List<GPSFixMoving> fixes = new ArrayList<>();
|
||||
try {
|
||||
getTrackedRace().getTrack(c).lockForRead();
|
||||
for (GPSFixMoving fix : getTrackedRace().getTrack(c).getFixes()) {
|
||||
|
||||
+1
-2
@@ -14,7 +14,6 @@ import org.junit.Test;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.common.tracking.impl.GPSFixMovingImpl;
|
||||
import com.sap.sailing.domain.markpassingcalculation.Candidate;
|
||||
@@ -56,7 +55,7 @@ public class MarkPassingCalculatorPerformanceTest extends AbstractMockedRaceMark
|
||||
@Test
|
||||
public void testFinder() {
|
||||
CandidateFinder f = new CandidateFinderImpl(race);
|
||||
List<GPSFix> fixesAdded = new ArrayList<>();
|
||||
List<GPSFixMoving> fixesAdded = new ArrayList<>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
GPSFixMoving fix = rndFix();
|
||||
race.recordFix(ron, fix);
|
||||
|
||||
+5
-6
@@ -8,8 +8,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.NavigableSet;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
@@ -17,7 +17,6 @@ import com.sap.sailing.domain.base.impl.WaypointImpl;
|
||||
import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.common.tracking.impl.GPSFixMovingImpl;
|
||||
import com.sap.sailing.domain.markpassingcalculation.Candidate;
|
||||
@@ -53,7 +52,7 @@ public class MarkPassingWhiteBoxTest extends AbstractMockedRaceMarkPassingTest {
|
||||
race.recordFix(ron, fix2);
|
||||
CandidateFinder finder = new CandidateFinderImpl(race);
|
||||
CandidateChooser chooser = new CandidateChooserImpl(race);
|
||||
List<GPSFix> fixes = new ArrayList<GPSFix>();
|
||||
List<GPSFixMoving> fixes = new ArrayList<>();
|
||||
fixes.add(fix1);
|
||||
fixes.add(fix2);
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> candidateDeltas = finder.getCandidateDeltas(ron, fixes);
|
||||
@@ -95,7 +94,7 @@ public class MarkPassingWhiteBoxTest extends AbstractMockedRaceMarkPassingTest {
|
||||
|
||||
race.recordFix(tom, fix1);
|
||||
race.recordFix(tom, fix3);
|
||||
List<GPSFix> fixes = new ArrayList<>();
|
||||
List<GPSFixMoving> fixes = new ArrayList<>();
|
||||
fixes.add(fix1);
|
||||
fixes.add(fix3);
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> cans = finder.getCandidateDeltas(tom, fixes);
|
||||
@@ -126,7 +125,7 @@ public class MarkPassingWhiteBoxTest extends AbstractMockedRaceMarkPassingTest {
|
||||
CandidateFinderImpl finder = new CandidateFinderImpl(race);
|
||||
race.recordFix(tom, fix1);
|
||||
race.recordFix(tom, fix2);
|
||||
List<GPSFix> fixes = new ArrayList<>();
|
||||
List<GPSFixMoving> fixes = new ArrayList<>();
|
||||
fixes.addAll(Arrays.asList(fix1, fix2));
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> cans = finder.getCandidateDeltas(tom, fixes);
|
||||
Double inFront = cans.getA().iterator().next().getProbability();
|
||||
@@ -194,7 +193,7 @@ public class MarkPassingWhiteBoxTest extends AbstractMockedRaceMarkPassingTest {
|
||||
race.recordFix(ben, fix1);
|
||||
race.recordFix(ben, fix2);
|
||||
race.recordFix(ben, fix3);
|
||||
List<GPSFix> fixes = new ArrayList<>();
|
||||
List<GPSFixMoving> fixes = new ArrayList<>();
|
||||
fixes.addAll(Arrays.asList(fix1, fix2, fix3));
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> cans = finder.getCandidateDeltas(ben, fixes);
|
||||
Candidate inFront = Util.get(cans.getA(), 0);
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
@@ -24,7 +25,7 @@ public interface CandidateFinder {
|
||||
* fixes.
|
||||
* @return new {@link Candidate}s and those that should be removed.
|
||||
*/
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getCandidateDeltas(Competitor c, Iterable<GPSFix> fixes);
|
||||
Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getCandidateDeltas(Competitor c, Iterable<GPSFixMoving> fixes);
|
||||
|
||||
/**
|
||||
* When initializing or refreshing the calculator, the whole race until now is evaluated. For that purpose all of the
|
||||
@@ -40,7 +41,7 @@ public interface CandidateFinder {
|
||||
* @return The fixes for each Competitor that may have changed their status as a {@link Candidate} because of new
|
||||
* mark fixes..
|
||||
*/
|
||||
Map<Competitor, List<GPSFix>> calculateFixesAffectedByNewMarkFixes(Map<Mark, List<GPSFix>> newMarkFixes);
|
||||
Map<Competitor, List<GPSFixMoving>> calculateFixesAffectedByNewMarkFixes(Map<Mark, List<GPSFix>> newMarkFixes);
|
||||
|
||||
/**
|
||||
* Notifies this finder about the race's start time having changed. The finder is only interested in the non-inferred
|
||||
|
||||
+13
-12
@@ -18,6 +18,7 @@ import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.markpassingcalculation.impl.CandidateChooserImpl;
|
||||
import com.sap.sailing.domain.markpassingcalculation.impl.CandidateFinderImpl;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
@@ -61,7 +62,7 @@ public class MarkPassingCalculator {
|
||||
*/
|
||||
private final StorePositionUpdateStrategy endMarker = new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex, List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
List<Pair<Competitor, Integer>> removedMarkPassings,
|
||||
@@ -229,7 +230,7 @@ public class MarkPassingCalculator {
|
||||
try {
|
||||
logger.fine("MarkPassingCalculator is listening on race "+raceName);
|
||||
boolean finished = false;
|
||||
final Map<Competitor, List<GPSFix>> competitorFixes = new HashMap<>();
|
||||
final Map<Competitor, List<GPSFixMoving>> competitorFixes = new HashMap<>();
|
||||
final Map<Mark, List<GPSFix>> markFixes = new HashMap<>();
|
||||
final List<Waypoint> addedWaypoints = new ArrayList<>();
|
||||
final List<Waypoint> removedWaypoints = new ArrayList<>();
|
||||
@@ -361,22 +362,22 @@ public class MarkPassingCalculator {
|
||||
* {@link CandidateChooser} to calculate any new {@link MarkPassing}s (see {@link ComputeMarkPassings}).
|
||||
*
|
||||
*/
|
||||
private void computeMarkPasses(Map<Competitor, List<GPSFix>> newCompetitorFixes,
|
||||
private void computeMarkPasses(Map<Competitor, List<GPSFixMoving>> newCompetitorFixes,
|
||||
Map<Mark, List<GPSFix>> newMarkFixes) {
|
||||
logger.finer("Calculating markpassings for race "+raceName+" with " + newCompetitorFixes.size() + " new competitor Fixes and "
|
||||
+ newMarkFixes.size() + " new mark fixes.");
|
||||
Map<Competitor, Set<GPSFix>> combinedCompetitorFixes = new HashMap<>();
|
||||
Map<Competitor, Set<GPSFixMoving>> combinedCompetitorFixes = new HashMap<>();
|
||||
|
||||
for (Entry<Competitor, List<GPSFix>> competitorEntry : newCompetitorFixes.entrySet()) {
|
||||
Set<GPSFix> fixesForCompetitor = new HashSet<>();
|
||||
for (Entry<Competitor, List<GPSFixMoving>> competitorEntry : newCompetitorFixes.entrySet()) {
|
||||
Set<GPSFixMoving> fixesForCompetitor = new HashSet<>();
|
||||
combinedCompetitorFixes.put(competitorEntry.getKey(), fixesForCompetitor);
|
||||
fixesForCompetitor.addAll(competitorEntry.getValue());
|
||||
}
|
||||
if (!newMarkFixes.isEmpty()) {
|
||||
// FIXME bug 2745 use new mark fixes to invalidate chooser's mark position and mutual mark/waypoint distance cache
|
||||
for (Entry<Competitor, List<GPSFix>> fixesAffectedByNewMarkFixes : finder
|
||||
for (Entry<Competitor, List<GPSFixMoving>> fixesAffectedByNewMarkFixes : finder
|
||||
.calculateFixesAffectedByNewMarkFixes(newMarkFixes).entrySet()) {
|
||||
Set<GPSFix> fixes = combinedCompetitorFixes.get(fixesAffectedByNewMarkFixes.getKey());
|
||||
Set<GPSFixMoving> fixes = combinedCompetitorFixes.get(fixesAffectedByNewMarkFixes.getKey());
|
||||
if (fixes == null) {
|
||||
fixes = new HashSet<>();
|
||||
combinedCompetitorFixes.put(fixesAffectedByNewMarkFixes.getKey(), fixes);
|
||||
@@ -385,7 +386,7 @@ public class MarkPassingCalculator {
|
||||
}
|
||||
}
|
||||
List<Callable<Void>> tasks = new ArrayList<>();
|
||||
for (final Entry<Competitor, Set<GPSFix>> c : combinedCompetitorFixes.entrySet()) {
|
||||
for (final Entry<Competitor, Set<GPSFixMoving>> c : combinedCompetitorFixes.entrySet()) {
|
||||
final Runnable runnable = new ComputeMarkPassings(c.getKey(), c.getValue());
|
||||
tasks.add(new Callable<Void>() {
|
||||
@Override
|
||||
@@ -412,9 +413,9 @@ public class MarkPassingCalculator {
|
||||
|
||||
private class ComputeMarkPassings implements Runnable {
|
||||
final Competitor c;
|
||||
final Iterable<GPSFix> fixes;
|
||||
final Iterable<GPSFixMoving> fixes;
|
||||
|
||||
public ComputeMarkPassings(Competitor c, Iterable<GPSFix> fixes) {
|
||||
public ComputeMarkPassings(Competitor c, Iterable<GPSFixMoving> fixes) {
|
||||
this.c = c;
|
||||
this.fixes = fixes;
|
||||
}
|
||||
@@ -462,7 +463,7 @@ public class MarkPassingCalculator {
|
||||
suspended = false;
|
||||
enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
|
||||
+12
-12
@@ -44,13 +44,13 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void competitorPositionChanged(final GPSFixMoving fix, final Competitor competitor) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
List<Pair<Competitor, Integer>> removedMarkPassings,
|
||||
List<Pair<Competitor, Integer>> suppressedMarkPassings, List<Competitor> unSuppressedMarkPassings, CandidateFinder candidateFinder, CandidateChooser candidateChooser) {
|
||||
List<GPSFix> list = competitorFixes.get(competitor);
|
||||
List<GPSFixMoving> list = competitorFixes.get(competitor);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
competitorFixes.put(competitor, list);
|
||||
@@ -64,7 +64,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void markPositionChanged(final GPSFix fix, final Mark mark, boolean firstInTrack) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -84,7 +84,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void waypointAdded(final int zeroBasedIndex, final Waypoint waypointThatGotAdded) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -102,7 +102,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void waypointRemoved(final int zeroBasedIndex, final Waypoint waypointThatGotRemoved) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -120,7 +120,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
final TimePoint timePointOfFixedPassing) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -135,7 +135,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void removeFixedPassing(final Competitor c, final Integer zeroBasedIndexOfWaypoint) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -150,7 +150,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void addSuppressedPassing(final Competitor c, final Integer zeroBasedIndexOfWaypoint) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -165,7 +165,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void removeSuppressedPassing(final Competitor c) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -180,7 +180,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void startOfRaceChanged(TimePoint oldStartOfRace, TimePoint newStartOfRace) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -199,7 +199,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void startOfTrackingChanged(TimePoint oldStartOfTracking, TimePoint newStartOfTracking) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
@@ -218,7 +218,7 @@ public class MarkPassingUpdateListener extends AbstractRaceChangeListener {
|
||||
public void finishedTimeChanged(TimePoint oldFinishedTime, TimePoint newFinishedTime) {
|
||||
markPassingCalculator.enqueueUpdate(new StorePositionUpdateStrategy() {
|
||||
@Override
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes,
|
||||
public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
|
||||
Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints,
|
||||
IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.Util.Triple;
|
||||
@@ -21,7 +22,7 @@ public interface StorePositionUpdateStrategy {
|
||||
* Adds its fix either to <code>competitorFixes</code> or <code>markFixes</code>, depending what the fix is for. If
|
||||
* no fixes exist yet for that object, a new entry is created.
|
||||
*/
|
||||
void storePositionUpdate(Map<Competitor, List<GPSFix>> competitorFixes, Map<Mark, List<GPSFix>> markFixes,
|
||||
void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes, Map<Mark, List<GPSFix>> markFixes,
|
||||
List<Waypoint> addedWaypoints, List<Waypoint> removedWaypoints, IntHolder smallestChangedWaypointIndex,
|
||||
List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings, List<Pair<Competitor, Integer>> removedMarkPassings,
|
||||
List<Pair<Competitor, Integer>> suppressedMarkPassings, List<Competitor> unSuppressedMarkPassings, CandidateFinder candidateFinder, CandidateChooser candidateChooser);
|
||||
|
||||
+16
-15
@@ -223,7 +223,7 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
}
|
||||
} else {
|
||||
for (final Competitor competitor : race.getRace().getCompetitors()) {
|
||||
final List<GPSFix> newFixesForCompetitor = new ArrayList<>();
|
||||
final List<GPSFixMoving> newFixesForCompetitor = new ArrayList<>();
|
||||
final DynamicGPSFixTrack<Competitor, GPSFixMoving> track = race.getTrack(competitor);
|
||||
if (track != null) {
|
||||
track.lockForRead();
|
||||
@@ -289,7 +289,7 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
|
||||
@Override
|
||||
public Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getAllCandidates(Competitor c) {
|
||||
Set<GPSFix> fixes = getAllFixes(c);
|
||||
Set<GPSFixMoving> fixes = getAllFixes(c);
|
||||
distanceCache.get(c).clear();
|
||||
xteCache.get(c).clear();
|
||||
synchronized (xteCandidates) {
|
||||
@@ -302,9 +302,9 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Competitor, List<GPSFix>> calculateFixesAffectedByNewMarkFixes(Map<Mark, List<GPSFix>> markFixes) {
|
||||
public Map<Competitor, List<GPSFixMoving>> calculateFixesAffectedByNewMarkFixes(Map<Mark, List<GPSFix>> markFixes) {
|
||||
// TODO Right now creates on time stretch between the 2 outside markfixes
|
||||
Map<Competitor, List<GPSFix>> affectedFixes = new HashMap<>();
|
||||
Map<Competitor, List<GPSFixMoving>> affectedFixes = new HashMap<>();
|
||||
TimePoint start = null;
|
||||
TimePoint end = null;
|
||||
for (Entry<Mark, List<GPSFix>> fixes : markFixes.entrySet()) {
|
||||
@@ -317,9 +317,9 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
}
|
||||
}
|
||||
for (Competitor c : race.getRace().getCompetitors()) {
|
||||
List<GPSFix> competitorFixes = new ArrayList<>();
|
||||
List<GPSFixMoving> competitorFixes = new ArrayList<>();
|
||||
DynamicGPSFixTrack<Competitor, GPSFixMoving> track = race.getTrack(c);
|
||||
GPSFix comFix = track.getFirstFixAtOrAfter(start);
|
||||
GPSFixMoving comFix = track.getFirstFixAtOrAfter(start);
|
||||
if (comFix != null) {
|
||||
if (end != null) {
|
||||
while (comFix != null && !comFix.getTimePoint().after(end)) {
|
||||
@@ -345,7 +345,7 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getCandidateDeltas(Competitor c, Iterable<GPSFix> fixes) {
|
||||
public Util.Pair<Iterable<Candidate>, Iterable<Candidate>> getCandidateDeltas(Competitor c, Iterable<GPSFixMoving> fixes) {
|
||||
List<Candidate> newCans = new ArrayList<>();
|
||||
List<Candidate> wrongCans = new ArrayList<>();
|
||||
Course course = race.getRace().getCourse();
|
||||
@@ -408,7 +408,7 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
badCans.addAll(distanceCans.values());
|
||||
distanceCans.clear();
|
||||
}
|
||||
Set<GPSFix> allFixes = getAllFixes(c);
|
||||
Set<GPSFixMoving> allFixes = getAllFixes(c);
|
||||
newCans.addAll(checkForDistanceCandidateChanges(c, allFixes, changedWaypoints).getA());
|
||||
newCans.addAll(checkForXTECandidatesChanges(c, allFixes, changedWaypoints).getA());
|
||||
result.put(c, new Util.Pair<List<Candidate>, List<Candidate>>(newCans, badCans));
|
||||
@@ -525,13 +525,13 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
return instruction;
|
||||
}
|
||||
|
||||
private Set<GPSFix> getAllFixes(Competitor c) {
|
||||
Set<GPSFix> fixes = new TreeSet<GPSFix>(comp);
|
||||
private Set<GPSFixMoving> getAllFixes(Competitor c) {
|
||||
Set<GPSFixMoving> fixes = new TreeSet<>(comp);
|
||||
if (timeRangeForValidCandidates.getTimeRangeOrNull() != null) {
|
||||
DynamicGPSFixTrack<Competitor, GPSFixMoving> track = race.getTrack(c);
|
||||
track.lockForRead();
|
||||
try {
|
||||
for (GPSFix fix : track.getFixes(
|
||||
for (GPSFixMoving fix : track.getFixes(
|
||||
timeRangeForValidCandidates.getTimeRangeOrNull().from(), /* fromInclusive */ true,
|
||||
timeRangeForValidCandidates.getTimeRangeOrNull().to(), /* toInclusive */ true)) {
|
||||
fixes.add(fix);
|
||||
@@ -549,7 +549,7 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
* probability exceeds {@link #penaltyForSkipping}, the fix is considered a candidate.
|
||||
*/
|
||||
private Util.Pair<List<Candidate>, List<Candidate>> checkForDistanceCandidateChanges(Competitor c,
|
||||
Iterable<GPSFix> fixes, Iterable<Waypoint> waypoints) {
|
||||
Iterable<GPSFixMoving> fixes, Iterable<Waypoint> waypoints) {
|
||||
Util.Pair<List<Candidate>, List<Candidate>> result = new Util.Pair<List<Candidate>, List<Candidate>>(
|
||||
new ArrayList<Candidate>(), new ArrayList<Candidate>());
|
||||
TreeSet<GPSFix> affectedFixes = new TreeSet<GPSFix>(comp);
|
||||
@@ -705,12 +705,13 @@ public class CandidateFinderImpl implements CandidateFinder {
|
||||
* @param waypointAsList
|
||||
*/
|
||||
private Util.Pair<List<Candidate>, List<Candidate>> checkForXTECandidatesChanges(Competitor c,
|
||||
Iterable<GPSFix> fixes, Iterable<Waypoint> waypoints) {
|
||||
Iterable<GPSFixMoving> fixes, Iterable<Waypoint> waypoints) {
|
||||
Util.Pair<List<Candidate>, List<Candidate>> result = new Util.Pair<List<Candidate>, List<Candidate>>(
|
||||
new ArrayList<Candidate>(), new ArrayList<Candidate>());
|
||||
DynamicGPSFixTrack<Competitor, GPSFixMoving> track = race.getTrack(c);
|
||||
for (GPSFix fix : fixes) {
|
||||
if (timeRangeForValidCandidates.getTimeRangeOrNull() != null && timeRangeForValidCandidates.getTimeRangeOrNull().includes(fix.getTimePoint())) {
|
||||
for (GPSFixMoving fix : fixes) {
|
||||
if (timeRangeForValidCandidates.getTimeRangeOrNull() != null && timeRangeForValidCandidates.getTimeRangeOrNull().includes(fix.getTimePoint())
|
||||
&& track.isValid(fix)) {
|
||||
TimePoint t = fix.getTimePoint();
|
||||
GPSFix fixBefore;
|
||||
GPSFix fixAfter;
|
||||
|
||||
Reference in new issue
Block a user