Bug 4387: Moved method addedToTrackedRace from DynamicTrack to

DynamicSensorFixTrack and changed the generic of
TrackedRaceImpl.sensorTracks to be typed by
DynamicSensorFixTrack<Competitor, ?> instead of DynamicTrack<?> to still
be able to call the moved method.
This commit is contained in:
Steffen Schaefer committed 2017-12-04 14:56:38 +01:00
1 parent 2e07176410
commit e6e9a51d22
3 files changed
+8 -10

No files matched your search

@@ -13,4 +13,9 @@ import com.sap.sse.common.WithID;
*/
public interface DynamicSensorFixTrack<ItemType extends WithID & Serializable, FixT extends SensorFix> extends
SensorFixTrack<ItemType, FixT>, DynamicTrack<FixT> {
/**
* Invoked when this track is added to a tracked race. The method is also invoked after de-serializing the
* containing {@link TrackedRace}. This default implementation does nothing.
*/
default void addedToTrackedRace(TrackedRace trackedRace) {}
}
@@ -25,10 +25,4 @@ public interface DynamicTrack<FixType extends Timed> extends Track<FixType> {
* @return <code>true</code> if the element was added, <code>false</code> otherwise.
*/
boolean add(FixType fix, boolean replace);
/**
* Invoked when this track is added to a tracked race. The method is also invoked after de-serializing the
* containing {@link TrackedRace}. This default implementation does nothing.
*/
default void addedToTrackedRace(TrackedRace trackedRace) {}
}
@@ -125,7 +125,6 @@ import com.sap.sailing.domain.ranking.RankingMetric.RankingInfo;
import com.sap.sailing.domain.ranking.RankingMetricConstructor;
import com.sap.sailing.domain.tracking.BravoFixTrack;
import com.sap.sailing.domain.tracking.DynamicSensorFixTrack;
import com.sap.sailing.domain.tracking.DynamicTrack;
import com.sap.sailing.domain.tracking.GPSFixTrack;
import com.sap.sailing.domain.tracking.GPSTrackListener;
import com.sap.sailing.domain.tracking.LineDetails;
@@ -304,11 +303,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
private final ConcurrentMap<Mark, GPSFixTrack<Mark, GPSFix>> markTracks;
/**
* Mapping of {@link Competitor} to generic {@link DynamicTrack} implementation. Because the same competitor could
* Mapping of {@link Competitor} to generic {@link DynamicSensorFixTrack} implementation. Because the same competitor could
* be mapped to several different tracks, a combined key of competitor object and track name identifier string is
* used. This identifier is usually defined within the track interface (e.g. see {@link BravoFixTrack#TRACK_NAME}).
*/
private final Map<Pair<Competitor, String>, DynamicTrack<?>> sensorTracks;
private final Map<Pair<Competitor, String>, DynamicSensorFixTrack<Competitor, ?>> sensorTracks;
private final Map<String, Sideline> courseSidelines;
@@ -636,7 +635,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException, PatchFailedException {
ois.defaultReadObject();
getRace().getCourse().addCourseListener(this);
for (DynamicTrack<?> sensorTrack : sensorTracks.values()) {
for (DynamicSensorFixTrack<Competitor, ?> sensorTrack : sensorTracks.values()) {
sensorTrack.addedToTrackedRace(this);
}
raceStates = new WeakHashMap<>();