mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
fixed shortcuts in validity assessment
This commit is contained in:
1 parent
445547cd65
commit
047578098d
3 files changed
+10
-5
No files matched your search
@@ -509,6 +509,7 @@ public class TrackTest {
|
||||
TimePoint timePointForLateOutlier = new MillisecondsTimePoint(now.asMillis() + (steps-1)*timeBetweenFixesInMillis + timeBetweenFixesInMillis/2);
|
||||
Position lateOutlierPosition = new DegreePosition(-90, 90);
|
||||
GPSFix lateOutlier = new GPSFixImpl(lateOutlierPosition, timePointForLateOutlier);
|
||||
// adding the outlier invalidates the fix just before the outlier because it now has a single successor that is in range but not reachable
|
||||
track.addGPSFix(lateOutlier);
|
||||
assertEquals(1, invalidationCalls.size());
|
||||
TimePoint timePointOfLastFixBeforeLateOutlier = track.getLastFixBefore(timePointForLateOutlier).getTimePoint();
|
||||
@@ -521,11 +522,13 @@ public class TrackTest {
|
||||
assertEquals(timePointOfLastOriginalFix, stillPresentFullIntervalCacheEntry.getA());
|
||||
assertEquals(now, stillPresentFullIntervalCacheEntry.getB().getA());
|
||||
GPSFix polishedLastFix = track.getLastFixBefore(new MillisecondsTimePoint(Long.MAX_VALUE)); // get the last smoothened fix...
|
||||
// ...which now still is expected to be the lateOutlier because no succeeding fix qualifies it as outlier:
|
||||
assertEquals(lateOutlier, polishedLastFix);
|
||||
// ...which now is expected to be the fix before lateOutlier because lateOutlier has previous fixes within the time range
|
||||
// but none of them is reachable with max speed
|
||||
assertEquals(track.getLastRawFixBefore(lateOutlier.getTimePoint()), polishedLastFix);
|
||||
track.lockForRead();
|
||||
try {
|
||||
assertEquals(steps+1, Util.size(track.getFixes())); // what will later be detected as outlier is now an additional fix
|
||||
assertEquals(steps, Util.size(track.getFixes())); // the lateOutlier already is detected as outlier, so it's not steps+1
|
||||
// which would include the lateOutlier, but it's already only steps valid fixes.
|
||||
} finally {
|
||||
track.unlockAfterRead();
|
||||
}
|
||||
|
||||
+2
-1
@@ -130,7 +130,8 @@ public class DynamicGPSFixMovingTrackImpl<ItemType> extends DynamicTrackImpl<Ite
|
||||
}
|
||||
boolean foundValidNextFixInRange = false;
|
||||
boolean atLeastOneNextFixInRange = false;
|
||||
if (!foundValidPreviousFixInRange) {
|
||||
// only spend the effort to calculate the "next"-related predicate if the "previous"-related part of the disjunction below isn't already false
|
||||
if (!atLeastOnePreviousFixInRange || foundValidPreviousFixInRange) {
|
||||
GPSFixMoving next = rawFixes.higher(e);
|
||||
atLeastOneNextFixInRange = next != null && next.getTimePoint().asMillis() - e.getTimePoint().asMillis() <= getMillisecondsOverWhichToAverageSpeed();
|
||||
Speed speedToNext = null;
|
||||
|
||||
+2
-1
@@ -831,7 +831,8 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
|
||||
}
|
||||
boolean foundValidNextFixInRange = false;
|
||||
boolean atLeastOneNextFixInRange = false;
|
||||
if (!foundValidPreviousFixInRange) {
|
||||
// only spend the effort to calculate the "next"-related predicate if the "previous"-related part of the disjunction below isn't already false
|
||||
if (!atLeastOnePreviousFixInRange || foundValidPreviousFixInRange) {
|
||||
FixType next = rawFixes.higher(e);
|
||||
atLeastOneNextFixInRange = next != null && next.getTimePoint().asMillis() - e.getTimePoint().asMillis() <= getMillisecondsOverWhichToAverageSpeed();
|
||||
Speed speedToNext = null;
|
||||
|
||||
Reference in new issue
Block a user