"post-fix" for bug 1054: mark position updates didn't invalidate the maneuver cache; fixed NPE for modified affected interval method on GPSFixTrackImpl

This commit is contained in:
Axel Uhl
2012-11-23 18:05:32 +01:00
parent 4839f03c36
commit abb7272256
4 changed files with 15 additions and 7 deletions
@@ -50,11 +50,11 @@ public interface Position extends Serializable {
Distance crossTrackError(Position p, Bearing bearing);
/**
* Computes how far along the great circle starting at <code>p</code> and pointing
* Computes how far along the great circle starting at <code>from</code> and pointing
* to <code>bearing</code> one has to travel to reach the projection of this position
* onto the great circle described by <code>p</code> and <code>bearing</code>. Note that
* onto the great circle described by <code>from</code> and <code>bearing</code>. Note that
* if the angle between this position and the great circle is 90 degrees then there is
* no solution, and a <code>NaN</code> or exception will result.
*/
Distance alongTrackDistance(Position p, Bearing bearing);
Distance alongTrackDistance(Position from, Bearing bearing);
}
@@ -6,7 +6,6 @@ import java.util.List;
import com.sap.sailing.domain.base.Competitor;
import com.sap.sailing.domain.base.Leg;
import com.sap.sailing.domain.base.SpeedWithBearing;
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
import com.sap.sailing.domain.common.Distance;
import com.sap.sailing.domain.common.LegType;
import com.sap.sailing.domain.common.NoWindException;
@@ -192,5 +191,5 @@ public interface TrackedLegOfCompetitor extends Serializable {
* and the resulting extrapolated position's "windward distance" is computed to the competitor's actual position
* at that time. This distance is returned as the result of this method.
*/
Distance getManeuverLoss(MillisecondsTimePoint timePointBeforeManeuver, MillisecondsTimePoint timePointAfterManeuver) throws NoWindException;
Distance getManeuverLoss(TimePoint timePointBeforeManeuver, TimePoint timePointAfterManeuver) throws NoWindException;
}
@@ -167,6 +167,7 @@ public class DynamicTrackedRaceImpl extends TrackedRaceImpl implements
@Override
public void gpsFixReceived(GPSFix fix, Mark mark) {
triggerManeuverCacheRecalculationForAllCompetitors();
notifyListeners(fix, mark);
}
@@ -287,7 +287,11 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
start = fix.getTimePoint();
}
} else {
start = fixesForPositionEstimation.getA().getTimePoint();
if (fixesForPositionEstimation.getA() == null) {
start = new MillisecondsTimePoint(0);
} else {
start = fixesForPositionEstimation.getA().getTimePoint();
}
}
final TimePoint end;
if (fix.equals(fixesForPositionEstimation.getB())) {
@@ -298,7 +302,11 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
end = fix.getTimePoint();
}
} else {
end = fixesForPositionEstimation.getB().getTimePoint();
if (fixesForPositionEstimation.getB() == null) {
end = new MillisecondsTimePoint(Long.MAX_VALUE);
} else {
end = fixesForPositionEstimation.getB().getTimePoint();
}
}
return new Pair<TimePoint, TimePoint>(start, end);
} finally {