Method getUpdatedMarkPassings was moved to TrackedRace interface

This commit is contained in:
Stsiapan_Tsybulski committed 2016-10-24 16:15:41 +03:00
1 parent d7350239cb
commit 7e0a27f767
7 files changed
+27 -19

No files matched your search

@@ -681,4 +681,9 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace {
public Iterable<RaceLog> getAttachedRaceLogs() { public Iterable<RaceLog> getAttachedRaceLogs() {
return Collections.emptySet(); return Collections.emptySet();
} }
@Override
public NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor) {
return null;
}
} }
@@ -1,7 +1,5 @@
package com.sap.sailing.domain.tracking; package com.sap.sailing.domain.tracking;
import java.util.NavigableSet;
import com.sap.sailing.domain.abstractlog.race.CompetitorResult; import com.sap.sailing.domain.abstractlog.race.CompetitorResult;
import com.sap.sailing.domain.abstractlog.race.RaceLog; import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent; import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
@@ -70,12 +68,6 @@ public interface DynamicTrackedRace extends TrackedRace {
boolean recordWind(Wind wind, WindSource windSource, boolean applyFilter); boolean recordWind(Wind wind, WindSource windSource, boolean applyFilter);
void removeWind(Wind wind, WindSource windSource); void removeWind(Wind wind, WindSource windSource);
/**
* Returns competitor's mark passings after all calculations. The method uses a lock to block the thread until all
* calculations will be finished.
*/
NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor);
/** /**
* The raw, updating feed of a single competitor participating in this race * The raw, updating feed of a single competitor participating in this race
@@ -434,6 +434,12 @@ public interface TrackedRace extends Serializable, IsManagedByCache<SharedDomain
* lock. * lock.
*/ */
NavigableSet<MarkPassing> getMarkPassings(Competitor competitor); NavigableSet<MarkPassing> getMarkPassings(Competitor competitor);
/**
* Returns competitor's mark passings after all calculations. The method uses a lock to block the thread until all
* calculations will be finished.
*/
NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor);
/** /**
* This obtains the course's read lock before asking for the read lock for the <code>markPassings</code> structure. * This obtains the course's read lock before asking for the read lock for the <code>markPassings</code> structure.
@@ -1177,14 +1177,4 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
}); });
notifyListeners(track); notifyListeners(track);
} }
@Override
public NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor) {
markPassingCalculator.lockForRead();
try {
return getMarkPassings(competitor);
} finally {
markPassingCalculator.unlockForRead();
}
}
} }
@@ -709,6 +709,16 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
public NavigableSet<MarkPassing> getMarkPassings(Competitor competitor) { public NavigableSet<MarkPassing> getMarkPassings(Competitor competitor) {
return markPassingsForCompetitor.get(competitor); return markPassingsForCompetitor.get(competitor);
} }
@Override
public NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor) {
markPassingCalculator.lockForRead();
try {
return getMarkPassings(competitor);
} finally {
markPassingCalculator.unlockForRead();
}
}
protected NavigableSet<MarkPassing> getMarkPassingsInOrderAsNavigableSet(Waypoint waypoint) { protected NavigableSet<MarkPassing> getMarkPassingsInOrderAsNavigableSet(Waypoint waypoint) {
return markPassingsForWaypoint.get(waypoint); return markPassingsForWaypoint.get(waypoint);
@@ -5812,7 +5812,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
public Map<Integer, Date> getCompetitorMarkPassings(RegattaAndRaceIdentifier race, CompetitorDTO competitorDTO, public Map<Integer, Date> getCompetitorMarkPassings(RegattaAndRaceIdentifier race, CompetitorDTO competitorDTO,
boolean waitForCalculations) { boolean waitForCalculations) {
Map<Integer, Date> result = new HashMap<>(); Map<Integer, Date> result = new HashMap<>();
final DynamicTrackedRace trackedRace = (DynamicTrackedRace) getExistingTrackedRace(race); final TrackedRace trackedRace = getExistingTrackedRace(race);
if (trackedRace != null) { if (trackedRace != null) {
Competitor competitor = getCompetitorByIdAsString(trackedRace.getRace().getCompetitors(), competitorDTO.getIdAsString()); Competitor competitor = getCompetitorByIdAsString(trackedRace.getRace().getCompetitors(), competitorDTO.getIdAsString());
Set<MarkPassing> competitorMarkPassings; Set<MarkPassing> competitorMarkPassings;
@@ -656,4 +656,9 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials {
public Iterable<RaceLog> getAttachedRaceLogs() { public Iterable<RaceLog> getAttachedRaceLogs() {
return Collections.emptySet(); return Collections.emptySet();
} }
@Override
public NavigableSet<MarkPassing> getUpdatedMarkPassings(Competitor competitor) {
return null;
}
} }