From cf5c193ec5aea4987a6451669e0a07c2a88c1511 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Tue, 17 Nov 2015 21:23:56 +0100 Subject: [PATCH] made test case for bug 3364 succeed for correct implementation; extended interval of fixes whose position estimation is affected: so far, the getEstimatedPositionTimePeriodAffectedBy method on GPSFixTrackImpl returned only the singular interval shaped by the fix just added; this seems non-sensical given that when such a fix is inserted, the adjacent fixes before and after and everything in between will have their position estimation affected as well. --- .../impl/WaypointPositionAndDistanceCacheTest.java | 4 ++-- .../com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/markpassing/impl/WaypointPositionAndDistanceCacheTest.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/markpassing/impl/WaypointPositionAndDistanceCacheTest.java index 958652b7e99..0c426ea995d 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/markpassing/impl/WaypointPositionAndDistanceCacheTest.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/markpassing/impl/WaypointPositionAndDistanceCacheTest.java @@ -148,8 +148,8 @@ public class WaypointPositionAndDistanceCacheTest { assertEquals(60+new NauticalMileDistance(20).scale(timeRangeResolution.divide(Duration.ONE_HOUR)).getNauticalMiles(), cache.getApproximateDistance(start, windwardWaypoint, now.plus(timeRangeResolution)).getNauticalMiles(), 0.01); assertEquals(60+new NauticalMileDistance(20).scale(timeRangeResolution.times(2).divide(Duration.ONE_HOUR)).getNauticalMiles(), cache.getApproximateDistance(start, windwardWaypoint, now.plus(timeRangeResolution.times(2))).getNauticalMiles(), 0.01); trackedRace.getOrCreateTrack(windward).add(new GPSFixImpl(new DegreePosition(1, 0).translateGreatCircle( - new DegreeBearingImpl(0), new KnotSpeedImpl(20).travel(now, now.plus(timeRangeResolution.divide(5)))), - now.plus(timeRangeResolution.divide(5)))); // cause cache invalidation with several entries in the map + new DegreeBearingImpl(0), new KnotSpeedImpl(20).travel(now, now.plus(timeRangeResolution.minus(1)))), + now.plus(timeRangeResolution.minus(1)))); // cause cache invalidation with several entries in the map recalculations = 0; assertEquals(60+new NauticalMileDistance(20).scale(timeRangeResolution.divide(Duration.ONE_HOUR)).getNauticalMiles(), cache.getApproximateDistance(start, windwardWaypoint, now.plus(timeRangeResolution)).getNauticalMiles(), 0.01); assertEquals(2, recalculations); // distance calculation also requires position calculation, therefore 2, not 1 diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java index f59c561b2e3..c522dafb9e5 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java @@ -388,7 +388,7 @@ public class GPSFixTrackImpl extends TrackImpl } lockForRead(); try { - Util.Pair fixesForPositionEstimation = getFixesForPositionEstimation(fix.getTimePoint(), /* inclusive */ true); + Util.Pair fixesForPositionEstimation = getFixesForPositionEstimation(fix.getTimePoint(), /* inclusive */ false); final TimePoint start; if (fix.equals(fixesForPositionEstimation.getA())) { if (getLastFixBefore(fix.getTimePoint()) == null) {