From 4f3420564b837a147e952ed99d817489a7710750 Mon Sep 17 00:00:00 2001 From: Finn Huelsbusch Date: Fri, 12 Aug 2022 09:56:01 +0200 Subject: [PATCH] whitespace happiness --- .../dto/SeriesCreationParametersDTO.java | 16 +- .../LeaderboardScoringAndRankingTest.java | 146 ++++----- .../domain/test/RaceColumnCacheTest.java | 2 +- .../domain/test/mock/MockedTrackedRace.java | 16 +- .../mock/MockedTrackedRaceWithFixedRank.java | 14 +- ...ockedTrackedRaceWithStartTimeAndRanks.java | 24 +- .../domain/base/RaceColumnListener.java | 22 +- .../com/sap/sailing/domain/base/Series.java | 36 +-- .../RaceColumnListenerWithDefaultAction.java | 40 +-- .../sailing/domain/base/impl/RegattaImpl.java | 54 ++-- .../domain/leaderboard/Leaderboard.java | 149 +++++---- .../impl/AbstractLeaderboardImpl.java | 36 +-- .../impl/AbstractSimpleLeaderboardImpl.java | 25 +- ...aLeaderboardWithCompetitorElimination.java | 20 +- .../meta/MetaLeaderboardColumn.java | 12 +- .../domain/tracking/DummyTrackedRace.java | 16 +- .../sailing/domain/tracking/TrackedRace.java | 276 ++++++++-------- .../domain/tracking/impl/TrackedRaceImpl.java | 280 ++++++++-------- .../util/impl/RaceColumnListeners.java | 12 +- .../GetSixtyInchStatisticAction.java | 3 +- .../adminconsole/RegattaDetailsComposite.java | 8 +- .../ui/adminconsole/RegattaListComposite.java | 26 +- ...egattaWithSeriesAndFleetsCreateDialog.java | 2 +- .../gwt/ui/adminconsole/SeriesDescriptor.java | 16 +- .../gwt/ui/adminconsole/SeriesEditDialog.java | 82 ++--- .../SeriesWithFleetsCreateDialog.java | 30 +- .../SeriesWithFleetsDefaultListEditor.java | 4 +- .../gwt/ui/client/SailingServiceWrite.java | 36 +-- .../ui/client/SailingServiceWriteAsync.java | 38 +-- .../gwt/ui/server/SailingServiceImpl.java | 304 +++++++++--------- .../ui/server/SailingServiceWriteImpl.java | 90 +++--- .../sap/sailing/gwt/ui/shared/SeriesDTO.java | 12 +- .../regatta/SeriesCreateDialogPO.java | 18 +- .../regatta/SeriesEditDialogPO.java | 70 ++-- .../gateway/jaxrs/api/EventsResource.java | 48 +-- .../gateway/jaxrs/api/RegattasResource.java | 70 ++-- .../api/v1/regattaUpdateOrCreateSeries.html | 6 +- .../UpdateSeries.java | 8 +- .../test/RegattaReplicationTest.java | 34 +- ...BoatCompetitorMetadataReplicationTest.java | 14 +- .../server/test/SearchServiceTest.java | 4 +- .../server/impl/RacingEventServiceImpl.java | 222 ++++++------- .../xrr/structureimport/SeriesParameters.java | 6 +- 43 files changed, 1171 insertions(+), 1176 deletions(-) diff --git a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/SeriesCreationParametersDTO.java b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/SeriesCreationParametersDTO.java index e4ce15be283..e3e761c4d2f 100755 --- a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/SeriesCreationParametersDTO.java +++ b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/dto/SeriesCreationParametersDTO.java @@ -13,17 +13,17 @@ public class SeriesCreationParametersDTO implements Serializable { private boolean isFleetsCanRunInParallel; private boolean isStartsWithZeroScore; - + private boolean firstColumnIsNonDiscardableCarryForward; private int[] discardingThresholds; private boolean hasSplitFleetContiguousScoring; - - private boolean hasCrossFleetMergedRanking; - + + private boolean hasCrossFleetMergedRanking; + private Integer maximumNumberOfDiscards; - + SeriesCreationParametersDTO() {} public SeriesCreationParametersDTO(List fleets, boolean isMedal, boolean isFleetsCanRunInParallel, boolean isStartsWithZeroScore, boolean firstColumnIsNonDiscardableCarryForward, @@ -34,7 +34,7 @@ public class SeriesCreationParametersDTO implements Serializable { this.isFleetsCanRunInParallel = isFleetsCanRunInParallel; this.isStartsWithZeroScore = isStartsWithZeroScore; this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; - this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; + this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; this.discardingThresholds = discardingThresholds; this.maximumNumberOfDiscards = maximumNumberOfDiscards; @@ -55,11 +55,11 @@ public class SeriesCreationParametersDTO implements Serializable { public boolean isFleetsCanRunInParallel() { return isFleetsCanRunInParallel; } - + public boolean hasSplitFleetContiguousScoring() { return hasSplitFleetContiguousScoring; } - + public boolean hasCrossFleetMergedRanking() { return hasCrossFleetMergedRanking; } diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/LeaderboardScoringAndRankingTest.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/LeaderboardScoringAndRankingTest.java index 6f64f9996bd..847e90fc4d4 100644 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/LeaderboardScoringAndRankingTest.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/LeaderboardScoringAndRankingTest.java @@ -242,7 +242,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki List rankedCompetitorsWithOneRaceMissingInQ2 = leaderboard.getCompetitorsFromBestToWorst(later); // scores: C1=1, C2=2, C3=3, C4=5, C5=7, C6=4, C7=6, C8=8, C9=4, C10=5 // ordered by scores: C1, C2, C3, C6/C9, C4/C10, C7, C5, C8 - // incomplete fleets are ordered now also by scores + // incomplete fleets are ordered now also by scores assertEquals(Arrays.asList(new Competitor[] { competitors.get(0), competitors.get(1), competitors.get(2), competitors.get(5), competitors.get(8), competitors.get(3), competitors.get(9), competitors.get(6), competitors.get(4), competitors.get(7) }), rankedCompetitorsWithOneRaceMissingInQ2); @@ -313,7 +313,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki List rankedCompetitorsWithOneRaceMissingInQ2 = leaderboard.getCompetitorsFromBestToWorst(later); // scores: C1=1, C2=2, C3=3, C4=5, C5=7, C6=4, C7=6, C8=8, C9=4, C10=5 // ordered by scores: C1, C2, C3, C6/C9, C4/C10, C7, C5, C8 - // incomplete fleets are ordered now also by scores + // incomplete fleets are ordered now also by scores assertEquals(Arrays.asList(new Competitor[] { competitors.get(0), competitors.get(1), competitors.get(2), competitors.get(5), competitors.get(8), competitors.get(3), competitors.get(9), competitors.get(6), competitors.get(4), competitors.get(7) }), rankedCompetitorsWithOneRaceMissingInQ2); @@ -342,7 +342,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki * comparison. When the two competitors matched each other, the result(s) of these matches are to * be considered in isolation to break a tie. If this score sum is still equal, the last of these * matches shall take precedence, if any.

- * + * * If more than two competitors have equal score sum the comparator needs to ensure that all those * competitors can be put in a consistent order. This may not always be possible. Consider three * competitors A, B, and C such that A won against B, B won against C and C won against A, but all @@ -370,7 +370,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(0), competitors.get(2))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(3), competitors.get(1))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(5), competitors.get(4))); @@ -378,7 +378,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q2Column.setTrackedRace(q2Column.getFleetByName("M1"), q2M1); q2Column.setTrackedRace(q2Column.getFleetByName("M2"), q2M2); q2Column.setTrackedRace(q2Column.getFleetByName("M3"), q2M3); - + // point sums for competitors 0..5: 2, 0, 1, 1, 1, 1 // So it's clear-cut for (0) and (1); all others (2..5) need to be tie-broken based // on their direct comparison. @@ -423,7 +423,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(1), competitors.get(0))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(2), competitors.get(3))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(4), competitors.get(5))); @@ -431,7 +431,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q2Column.setTrackedRace(q2Column.getFleetByName("M1"), q2M1); q2Column.setTrackedRace(q2Column.getFleetByName("M2"), q2M2); q2Column.setTrackedRace(q2Column.getFleetByName("M3"), q2M3); - + TrackedRace q3M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(0, 2)); TrackedRace q3M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(2, 4)); TrackedRace q3M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(4, 6)); @@ -456,7 +456,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki assertEquals(Arrays.asList(competitors.get(4), competitors.get(2), competitors.get(0), competitors.get(1), competitors.get(3), competitors.get(5)), rankedCompetitors); } - + @Test public void testMatchRaceTieBreakWithMultipleDirectComparisonLastRace() { List competitors = createCompetitors(6); @@ -478,7 +478,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(1), competitors.get(0))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(2), competitors.get(3))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(4), competitors.get(5))); @@ -486,7 +486,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q2Column.setTrackedRace(q2Column.getFleetByName("M1"), q2M1); q2Column.setTrackedRace(q2Column.getFleetByName("M2"), q2M2); q2Column.setTrackedRace(q2Column.getFleetByName("M3"), q2M3); - + TrackedRace q3M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(0, 2)); TrackedRace q3M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(2, 4)); TrackedRace q3M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, competitors.subList(4, 6)); @@ -516,7 +516,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki * comparison. When the two competitors matched each other, the result(s) of these matches are to * be considered in isolation to break a tie. If this score sum is still equal, the last of these * matches shall take precedence, if any.

- * + * * If more than two competitors have equal score sum the comparator needs to ensure that all those * competitors can be put in a consistent order. This may not always be possible. Consider three * competitors A, B, and C such that A won against B, B won against C and C won against A, but all @@ -544,7 +544,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(1), competitors.get(2))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(3), competitors.get(4))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(5), competitors.get(0))); @@ -552,7 +552,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q2Column.setTrackedRace(q2Column.getFleetByName("M1"), q2M1); q2Column.setTrackedRace(q2Column.getFleetByName("M2"), q2M2); q2Column.setTrackedRace(q2Column.getFleetByName("M3"), q2M3); - + // point sums for competitors 0..5: 1, 1, 1, 1, 1, 1 // cyclic direct comparison; expect competitors to be ordered by their names List rankedCompetitors = leaderboard.getCompetitorsFromBestToWorst(later); @@ -564,7 +564,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki * comparison. When the two competitors matched each other, the result(s) of these matches are to * be considered in isolation to break a tie. If this score sum is still equal, the last of these * matches shall take precedence, if any.

- * + * * If more than two competitors have equal score sum the comparator needs to ensure that all those * competitors can be put in a consistent order. This may not always be possible. Consider three * competitors A, B, and C such that A won against B, B won against C and C won against A, but all @@ -592,7 +592,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(1), competitors.get(2))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(3), competitors.get(0))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(5), competitors.get(4))); @@ -610,7 +610,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q3Column.setTrackedRace(q1Column.getFleetByName("M3"), q3M3); // point sums for competitors 0..5: 1, 1, 1, 2, 2, 2 - // + // // For 0..2 we have a cycle: (0)<(1)<(2)<(0), so they shall be treated equal, sorted by name // Further, we have: (5)<(4)<(3)<(5), so this is another cycle over the remaining three competitors // and (3) < (0) @@ -630,7 +630,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki * comparison. When the two competitors matched each other, the result(s) of these matches are to * be considered in isolation to break a tie. If this score sum is still equal, the last of these * matches shall take precedence, if any.

- * + * * If more than two competitors have equal score sum the comparator needs to ensure that all those * competitors can be put in a consistent order. This may not always be possible. Consider three * competitors A, B, and C such that A won against B, B won against C and C won against A, but all @@ -658,7 +658,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q1Column.setTrackedRace(q1Column.getFleetByName("M1"), q1M1); q1Column.setTrackedRace(q1Column.getFleetByName("M2"), q1M2); q1Column.setTrackedRace(q1Column.getFleetByName("M3"), q1M3); - + TrackedRace q2M1 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(1), competitors.get(2))); TrackedRace q2M2 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(3), competitors.get(0))); TrackedRace q2M3 = new MockedTrackedRaceWithStartTimeAndRanks(now, Arrays.asList(competitors.get(4), competitors.get(5))); @@ -676,7 +676,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki q3Column.setTrackedRace(q1Column.getFleetByName("M3"), q3M3); // point sums for competitors 0..5: 1, 1, 1, 2, 3, 1 - // + // // For 0..2 we have a cycle: (0)<(1)<(2)<(0), so they shall be treated equal, sorted by name // (5) has equal points with (0), (1), and (2) but we have (5)<(1) (based on q3M2), so the // "single-element chain" (5) is connected to the cycle and is "less" than the cycle. @@ -730,7 +730,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki competitors.get(8), competitors.get(9) })); q2Column.setTrackedRace(q2Column.getFleetByName("Blue"), q2Blue); for (Competitor competitor : competitors) { - assertTrue("Competitor "+competitor+" has no discard but should", + assertTrue("Competitor "+competitor+" has no discard but should", leaderboard.isDiscarded(competitor, q1Column, later) || leaderboard.isDiscarded(competitor, q2Column, later)); } } @@ -915,7 +915,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki assertSame(c1, rankedCompetitors.get(0)); assertSame(c2, rankedCompetitors.get(1)); } - + @Test public void testDistributionAcrossFinalFleetsWithDifferentScores() throws NoWindException { List competitors = createCompetitors(10); @@ -1221,7 +1221,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki public void testTieBreakBasedOnLastNonMedalSeriesNoMedalDiscardsInDifferentSeries() throws NoWindException { Competitor[] c = createCompetitors(4).toArray(new Competitor[0]); Competitor[] q1 = new Competitor[] { c[0], c[1], c[3], c[2] }; // c[2] discards this race with 4.0 points - Competitor[] q2 = new Competitor[] { c[2], c[0], c[1], c[3] }; // + Competitor[] q2 = new Competitor[] { c[2], c[0], c[1], c[3] }; // Competitor[] q3 = new Competitor[] { c[2], c[0], c[1], c[3] }; // but c[2] has two wins, c[0] only one Competitor[] f1 = new Competitor[] { c[2], c[1], c[0], c[3] }; // c[0] discards this race with 3.0 points Competitor[] f2 = new Competitor[] { c[0], c[1], c[2], c[3] }; // c[0] and c[2] both have [1.0, 3.0] as scores in the final series @@ -1346,7 +1346,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki /** * Reported by Clemens Fackeldey:

- * + * *

      *   GER2105: 8/6/(18,DNF)/10/9 => 33
      *   GER2254: 6/10/9/8/(11) => 33
@@ -1529,7 +1529,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             leaderboard.setCrossLeaderboardResultDiscardingRule(new ThresholdBasedResultDiscardingRuleImpl(new int[] { numberOfEliminationsExpectedToScore }));
         }
     }
-    
+
     @Test
     public void testElminationScoringSchemeWithDifferentlySizedHeatsInFirstRound() throws NoWindException {
         Regatta regatta = createRegattaWithEliminations(1, new int[] { 8, 4, 2, 2 }, "testBasicElminationScoringScheme",
@@ -1586,7 +1586,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             }
         }
     }
-    
+
     @Test
     public void testElminationScoringSchemeWithFinalNotSailed() throws NoWindException {
         Regatta regatta = createRegattaWithEliminations(1, new int[] { 8, 4, 2, 2 }, "testBasicElminationScoringScheme",
@@ -1841,16 +1841,16 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
     @Test
     public void testTieBreakByMedalRacesScoreOnlyIfEqualTotalScore() throws NoWindException {
         Competitor[] c = createCompetitors(4).toArray(new Competitor[0]);
-        Competitor[] f1 = new Competitor[] { c[0], c[1], c[2], c[3]}; 
+        Competitor[] f1 = new Competitor[] { c[0], c[1], c[2], c[3]};
         Competitor[] f2 = new Competitor[] { c[1], c[3], c[0], c[2]};
         Competitor[] f3 = new Competitor[] { c[2], c[0], c[1], c[3]};
-        // points in series: c0 = 6, c1 = 6, c2 = 8, c3 = 12  
-        
+        // points in series: c0 = 6, c1 = 6, c2 = 8, c3 = 12
+
         Competitor[] m1 = new Competitor[] { c[1], c[0], c[2]};
         Competitor[] m2 = new Competitor[] { c[0], c[2], c[1] };
         Competitor[] m3 = new Competitor[] { c[1], c[0], c[3] };
         // points in series: c0 = 10, c1 = 10, c2 = 16
-        
+
         Regatta regatta = createRegatta(/* qualifying */0, new String[] { "Default" }, /* final */3, new String[] { "Default" },
                 /* medal */ true, /* medal */ 3, "testTieBreakByMedalRacesScoreOnlyIfEqualTotalScore",
                 DomainFactory.INSTANCE.getOrCreateBoatClass("J/70", /* typicallyStartsUpwind */true), DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT));
@@ -1883,7 +1883,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(leaderboard.getNetPoints(c[0], later), leaderboard.getNetPoints(c[1], later), 0.000000001);
         assertEquals(rankedCompetitors.indexOf(c[0]), rankedCompetitors.indexOf(c[1])-1);
     }
-    
+
     @Test
     public void testTieBreakWithEqualWinsAndTwoVersusOneSecondsWithHighPointScoringScheme() throws NoWindException {
         Competitor[] c = createCompetitors(4).toArray(new Competitor[0]);
@@ -1908,7 +1908,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
     public void testAdditionalScoreInformationLeadsToChangedScoreForOneColumn() throws NoWindException {
         TrackedRegattaRegistry trackedRegattaRegistry = mock(TrackedRegattaRegistry.class);
         Regatta dummyRegatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, "Dummy",
-                new BoatClassImpl("Extreme40", false), 
+                new BoatClassImpl("Extreme40", false),
                 /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED,
                 /*startDate*/ null, /*endDate*/ null, trackedRegattaRegistry,
                 new HighPointFirstGets10Or8AndLastBreaksTie(), "578876345345",
@@ -1966,7 +1966,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertFalse(raceStateForRace2.isAdditionalScoringInformationEnabled(AdditionalScoringInformationType.MAX_POINTS_DECREASE_MAX_SCORE));
         assertEquals(new Double(30), leaderboardHighPoint10Or8AndLastBreaksTie.getNetPoints(competitors[0], later));
         assertEquals(new Double(3), leaderboardHighPoint10Or8AndLastBreaksTie.getNetPoints(competitors[9], later));
-        LeaderboardDTO leaderboardDTO  = null;
+        LeaderboardDTO leaderboardDTO = null;
         try {
             leaderboardDTO = leaderboardHighPoint10Or8AndLastBreaksTie.getLeaderboardDTO(later.plus(Duration.ONE_HOUR), Collections.emptyList(), false, trackedRegattaRegistry, DomainFactory.INSTANCE, false);
         } catch (InterruptedException e) {
@@ -2029,13 +2029,13 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(new Double(1), leaderboardHighPointESSOverall.getNetPoints(competitors[14], later));
         assertEquals(new Double(1), leaderboardHighPointESSOverall.getNetPoints(competitors[15], later));
     }
-    
+
     @Test
     public void testESS2017WithCompetitorsBeingDSQScoringTwoLessThanLastCompetingCompetitor() throws NoWindException {
         Competitor[] competitors = createCompetitors(8).toArray(new Competitor[0]);
         TimePoint now = MillisecondsTimePoint.now();
         TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
-        FlexibleLeaderboard leaderboardHighPoint12LastBreaksTie2017 = new FlexibleLeaderboardImpl("Test ESS Highpoint", 
+        FlexibleLeaderboard leaderboardHighPoint12LastBreaksTie2017 = new FlexibleLeaderboardImpl("Test ESS Highpoint",
         		new ThresholdBasedResultDiscardingRuleImpl(/* discarding thresholds */ new int[0]),
                 new HighPointFirstGets12Or8AndLastBreaksTie2017(), null);
         RaceColumn raceColumn = leaderboardHighPoint12LastBreaksTie2017
@@ -2043,7 +2043,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
                         false);
         // test basic scores with best getting 12 and worst getting 5 in a 12 point scheme
         assertTrue(leaderboardHighPoint12LastBreaksTie2017.getScoringScheme().getScoreComparator(/* nullScoresAreBetter */ false).compare(
-                leaderboardHighPoint12LastBreaksTie2017.getNetPoints(competitors[0], later), 
+                leaderboardHighPoint12LastBreaksTie2017.getNetPoints(competitors[0], later),
                 leaderboardHighPoint12LastBreaksTie2017.getNetPoints(competitors[3], later)) < 0); // c0 better than c3
         assertEquals(8, leaderboardHighPoint12LastBreaksTie2017.getCompetitorsFromBestToWorst(later).size());
         assertEquals(new Double(12), leaderboardHighPoint12LastBreaksTie2017.getNetPoints(competitors[0], later));
@@ -2152,7 +2152,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(c[2], rankedCompetitors.get(1));
     }
 
-    @Test 
+    @Test
     public void testHighPointScoringEightWithInterpolationWhenFleetNotComplete() throws NoWindException {
         int competitorsCount = 21;
         List competitors = createCompetitors(competitorsCount);
@@ -2176,11 +2176,11 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         r1Column.setTrackedRace(r1Column.getFleetByName("Fleet1"), r1Fleet1);
         r1Column.setTrackedRace(r1Column.getFleetByName("Fleet2"), r1Fleet2);
         r1Column.setTrackedRace(r1Column.getFleetByName("Fleet3"), r1Fleet3);
-        
-        // first fleet is complete 
+
+        // first fleet is complete
         double[] expectedResultsFleet1 = { 8, 7, 6, 5, 4, 3, 2, 1 };
         // second fleet has 1 missing boat
-        double diffX1 = 7.0 / 6.0; 
+        double diffX1 = 7.0 / 6.0;
         double[] expectedResultsFleet2 = { 8, 8 - diffX1 * 1, 8 - diffX1 * 2, 8 - diffX1 * 3, 8 - diffX1 * 4, 8 - diffX1 * 5, 1 };
         // third fleet has 2 missing boats
         double diffX2 = 7.0 / 5.0;
@@ -2196,10 +2196,10 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             i++;
         }
         assertEquals(8, i);
-        
+
         // check second race
         Iterator rankedCompetitorsFleet2 = r1Fleet2.getCompetitorsFromBestToWorst(later).iterator();
-        i = 0; 
+        i = 0;
         while (rankedCompetitorsFleet2.hasNext()) {
             Competitor currentCompetitor = rankedCompetitorsFleet2.next();
             assertSame(currentCompetitor, competitors.get(8+i));
@@ -2207,10 +2207,10 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             i++;
         }
         assertEquals(7, i);
-        
+
         // checked third race
         Iterator rankedCompetitorsFleet3 = r1Fleet3.getCompetitorsFromBestToWorst(later).iterator();
-        i = 0; 
+        i = 0;
         while (rankedCompetitorsFleet3.hasNext()) {
             Competitor currentCompetitor = rankedCompetitorsFleet3.next();
             assertSame(currentCompetitor, competitors.get(15+i));
@@ -2218,30 +2218,30 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             i++;
         }
         assertEquals(6, i);
-        
+
         List allCompetitorsFromBestToWorst = leaderboard.getCompetitorsFromBestToWorst(later);
         assertEquals(competitorsCount, allCompetitorsFromBestToWorst.size());
-        
+
         // check that the fleet winners have all 8 points
         assertEquals(8.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(0), later), 0.000000001);
         assertEquals(8.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(1), later), 0.000000001);
         assertEquals(8.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(2), later), 0.000000001);
-        
+
         // check that the fleet looser have all 1 point
         assertEquals(1.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(competitorsCount-1), later), 0.000000001);
         assertEquals(1.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(competitorsCount-2), later), 0.000000001);
         assertEquals(1.0, leaderboard.getNetPoints(allCompetitorsFromBestToWorst.get(competitorsCount-3), later), 0.000000001);
     }
-    
+
     @Test
     public void testOverallLeaderboardWithESSHighPointScoringAndTieBreakInLastRegattaOfLeaderboardGroup() throws NoWindException {
         Competitor[] c = createCompetitors(12).toArray(new Competitor[0]);
         //                                              10      9     8    7    6    5     4      3     2     1     1      1
-        Competitor[] regattaRace1_1 = new Competitor[] { c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11]  };
-        Competitor[] regattaRace2_1 = new Competitor[] { c[1], c[10], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[0]  };
-        Competitor[] regattaRace1_2 = new Competitor[] { c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11]  };
-        Competitor[] regattaRace2_2 = new Competitor[] { c[1], c[10], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[0]  };
-        Competitor[] regattaRace3_2 = new Competitor[] { c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[10], c[0]  };
+        Competitor[] regattaRace1_1 = new Competitor[] { c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11] };
+        Competitor[] regattaRace2_1 = new Competitor[] { c[1], c[10], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[0] };
+        Competitor[] regattaRace1_2 = new Competitor[] { c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11] };
+        Competitor[] regattaRace2_2 = new Competitor[] { c[1], c[10], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[0] };
+        Competitor[] regattaRace3_2 = new Competitor[] { c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[11], c[10], c[0] };
         TimePoint now = MillisecondsTimePoint.now();
         TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
         FlexibleLeaderboard leaderboard1 = new FlexibleLeaderboardImpl("Leaderboard 1", new ThresholdBasedResultDiscardingRuleImpl(/* discarding thresholds */ new int[0]),
@@ -2271,7 +2271,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(7, leaderboard2.getNetPoints(c[8], later), 0.000000001);
         assertEquals(4, leaderboard2.getNetPoints(c[9], later), 0.000000001);
         assertEquals(3, leaderboard2.getNetPoints(c[11], later), 0.000000001);
-        
+
         LeaderboardGroup leaderboardGroup = new LeaderboardGroupImpl("Leaderboard Group ESS Overall", "Leaderboard Group", /* displayName */ null,
                 false, Arrays.asList(leaderboard1, leaderboard2));
         leaderboardGroup.setOverallLeaderboard(new LeaderboardGroupMetaLeaderboard(leaderboardGroup, new HighPointExtremeSailingSeriesOverall(),
@@ -2315,7 +2315,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(2. + 0., leaderboard1.getNetPoints(c[0], withinR1), 0.00000001); // correction expected NOT to apply before end of last tracked race before the corrected column
         assertEquals(0., leaderboard1.getNetPoints(c[0], beforeStartOfR1), 0.00000001); // not even the R1 scores apply before the start time of R1
     }
-    
+
     /**
      * When a DNS score correction is made then both, the MaxPointsReason and the score shall apply at the start of the race.
      */
@@ -2344,7 +2344,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(123., leaderboard1.getTotalPoints(c[0], leaderboard1.getRaceColumnByName("R1"), withinR1), 0.00000001);
         assertEquals(123., leaderboard1.getTotalPoints(c[0], leaderboard1.getRaceColumnByName("R1"), afterEndOfR1), 0.00000001);
     }
-    
+
     /**
      * When a DNS score correction is made then both, the MaxPointsReason and the score shall apply at the start of the race.
      */
@@ -2373,7 +2373,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         assertEquals(1.0, leaderboard1.getTotalPoints(c[0], leaderboard1.getRaceColumnByName("R1"), withinR1), 0.00000001); // tracked rank is 1
         assertEquals(123., leaderboard1.getTotalPoints(c[0], leaderboard1.getRaceColumnByName("R1"), afterEndOfR1), 0.00000001);
     }
-    
+
 
     /**
      * A test case for bug 1802. Competitors that didn't have a fleet (null fleet) were sorted to the end of the column even
@@ -2537,7 +2537,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             series.add(finalSeries);
         }
         final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("Extreme40", /* typicallyStartsUpwind */ false);
-        Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass, 
+        Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
                 /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, /*startDate*/ null, /*endDate*/ null,
                 series, /* persistent */false,
                 DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.HIGH_POINT_FIRST_GETS_TEN), "123",
@@ -2556,7 +2556,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         silver.removeAll(gold);
         Collections.shuffle(gold);
         Collections.shuffle(silver);
-        
+
         Leaderboard leaderboard = createLeaderboard(regatta, /* discarding thresholds */ new int[0]);
         TimePoint now = MillisecondsTimePoint.now();
         TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
@@ -2659,7 +2659,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
             series.add(medalSeries);
         }
         final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true);
-        Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass, 
+        Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
                 /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, /*startDate*/ null, /*endDate*/ null,
                 series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT),
                 "123", /* course area */null, OneDesignRankingMetric::new,
@@ -2683,7 +2683,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         List medal = new ArrayList<>(gold.subList(0, 2)); // take two gold race participants as medal race participants
         List lastRaceGold = new ArrayList<>(gold);
         lastRaceGold.removeAll(medal); // no medal race participant participates in the last race's gold fleet
-        
+
         Leaderboard leaderboard = createLeaderboard(regatta, /* discarding thresholds */ new int[0]);
         TimePoint now = MillisecondsTimePoint.now();
         TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
@@ -2798,7 +2798,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         List medal = new ArrayList<>(gold.subList(0, 2)); // take two gold race participants as medal race participants
         List lastRaceGold = new ArrayList<>(gold);
         lastRaceGold.removeAll(medal); // no medal race participant participates in the last race's gold fleet
-        
+
         Leaderboard leaderboard = createLeaderboard(regatta, /* discarding thresholds */ new int[0]);
         TimePoint now = MillisecondsTimePoint.now();
         TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000);
@@ -2827,7 +2827,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
         // with the bug still present, she would have ranked between Gold and Silver
         assertEquals(missing, rankedCompetitors.get(rankedCompetitors.size()-1));
     }
-    
+
     /**
      * Tests the default behavior of contiguously scored fleets when the ranks of the fleets are zero.
      * 

@@ -2840,11 +2840,11 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki public void testTotalRankComparatorForOrderedSplitFleetsWithZeroAsRank() throws NoWindException { testTotalRankComparatorForOrderedSplitFleets(/* fleetOrdering */ 0); } - + /** - * Tests the default behavior of contiguously scored fleets when the ranks of the fleets are not zero. - * This test was added because the internal behavior for fleets with a non-zero rank is different from - * the behavior of fleets with a rank equal to zero.

+ * Tests the default behavior of contiguously scored fleets when the ranks of the fleets are not zero. + * This test was added because the internal behavior for fleets with a non-zero rank is different from + * the behavior of fleets with a rank equal to zero.

* Expected behavior:
* Fleets are treated as if there was no contiguous scoring. Accordingly, ranks are present twice, with fleets always * alternating. Within a fleet rank, the order is determined by the {@link Competitor#getName() name} of the @@ -2895,10 +2895,10 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki for (Competitor rankedCompetitor : rankedCompetitors) { netPoints.put(rankedCompetitor, leaderboard.getNetPoints(rankedCompetitor, later)); } - + /* - * Checks all ranks that have been awarded twice (in both fleets). - * This is done by iterating over each "rank pair". + * Checks all ranks that have been awarded twice (in both fleets). + * This is done by iterating over each "rank pair". */ for (int i = 0; i < Math.min(yellow.size(), blue.size()) * 2; i = i + 2) { final Competitor comp1 = rankedCompetitors.get(i); @@ -2906,7 +2906,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki assertEquals(netPoints.get(comp1), netPoints.get(comp2)); assertNotSame(r1Column.getFleetOfCompetitor(comp1), r1Column.getFleetOfCompetitor(comp2)); } - // Checks all ranks that have been awarded once. + // Checks all ranks that have been awarded once. for (int i = Math.min(yellow.size(), blue.size()) * 2; i < (yellow.size() + blue.size()) - 1; i++) { final Competitor comp1 = rankedCompetitors.get(i); final Competitor comp2 = rankedCompetitors.get(i + 1); @@ -2914,7 +2914,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki assertSame(r1Column.getFleetOfCompetitor(comp1), r1Column.getFleetOfCompetitor(comp2)); } } - + /** @@ -2954,7 +2954,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki series.add(finalSeries); } final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true); - Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass, + Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass, /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, /*startDate*/ null, /*endDate*/ null, series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* course area */null, OneDesignRankingMetric::new, @@ -2973,7 +2973,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki silver.removeAll(gold); Collections.shuffle(gold); Collections.shuffle(silver); - + Leaderboard leaderboard = createLeaderboard(regatta, /* discarding thresholds */ new int[] { 5, 10 }); TimePoint now = MillisecondsTimePoint.now(); TimePoint later = new MillisecondsTimePoint(now.asMillis()+1000); diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/RaceColumnCacheTest.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/RaceColumnCacheTest.java index 18cbd90d57d..0164cc6b8ec 100644 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/RaceColumnCacheTest.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/RaceColumnCacheTest.java @@ -73,7 +73,7 @@ public class RaceColumnCacheTest extends AbstractLeaderboardTest { String raceColumnName = "TestRace"; RaceColumn raceColumn = series.addRaceColumn(raceColumnName, trackedRegattaRegistry); ScoringScheme scoringScheme = new LowPoint(); - Regatta regatta = new RegattaImpl("TestRegatta", new BoatClassImpl(BoatClassMasterdata.PIRATE), + Regatta regatta = new RegattaImpl("TestRegatta", new BoatClassImpl(BoatClassMasterdata.PIRATE), /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, /* startDate */ null, /* endDate */ null, seriesSet, false, scoringScheme, UUID.randomUUID(), mock(CourseArea.class), null, diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRace.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRace.java index d75fbb4677b..93bc624e9ef 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRace.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRace.java @@ -195,7 +195,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public int getRank(Competitor competitor, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return 0; } - + @Override public Pair> getRankAndRankComparable(Competitor competitor) throws NoWindException { return null; @@ -742,7 +742,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public Iterable getManeuvers(Competitor competitor, TimePoint from, TimePoint to, boolean waitForLatest) { return null; } - + @Override public Iterable getManeuvers(Competitor competitor, boolean waitForLatest) { return null; @@ -908,7 +908,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint) { return null; } - + @Override public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint) { return null; @@ -1233,7 +1233,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return null; } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable( TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { @@ -1265,7 +1265,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { @Override public void setFinishedTime(TimePoint newFinishedTime) { } - + @Override public > TrackT getSensorTrack( Competitor competitor, String trackName) { @@ -1298,7 +1298,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public void recordSensorFix(Competitor competitor, String trackName, SensorFix fix, boolean onlyWhenInTrackingTimeInterval) { } - + @Override public void addSensorTrack(Competitor trackedItem, String trackName, DynamicSensorFixTrack track) { } @@ -1312,7 +1312,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public NavigableSet getMarkPassings(Competitor competitor, boolean waitForLatestUpdates) { return null; } - + @Override public Distance getAverageRideHeight(Competitor competitor, TimePoint timePoint) { return null; @@ -1322,7 +1322,7 @@ public class MockedTrackedRace implements DynamicTrackedRace { public Boat getBoatOfCompetitor(Competitor competitor) { return null; } - + @Override public Competitor getCompetitorOfBoat(Boat boat) { return null; diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithFixedRank.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithFixedRank.java index bcf2bf56c31..f395fb8e0b2 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithFixedRank.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithFixedRank.java @@ -29,7 +29,7 @@ public class MockedTrackedRaceWithFixedRank extends MockedTrackedRace { protected final Map competitorsAndBoats; private final BoatClass boatClass; protected RaceDefinition raceDefinition; - + public MockedTrackedRaceWithFixedRank(CompetitorWithBoat competitorWithBoat, int rank, boolean started, BoatClass boatClass) { this.rank = rank; this.started = started; @@ -46,11 +46,11 @@ public class MockedTrackedRaceWithFixedRank extends MockedTrackedRace { private class MockedRaceDefinition implements RaceDefinition { private static final long serialVersionUID = 6812543850545870357L; private final Course course; - + public MockedRaceDefinition() { course = new CourseImpl("Test Course", Arrays.asList(new Waypoint[0])); } - + @Override public String getName() { return null; @@ -106,15 +106,15 @@ public class MockedTrackedRaceWithFixedRank extends MockedTrackedRace { return null; } } - + @Override public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint) { return Collections.singletonList(competitorsAndBoats.keySet().iterator().next()); } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint) { - LinkedHashMap>> competitorsFromBestToWorst = new LinkedHashMap>>(); + LinkedHashMap>> competitorsFromBestToWorst = new LinkedHashMap>>(); competitorsFromBestToWorst.put(competitorsAndBoats.keySet().iterator().next(), new Pair<>(1,new RankComparableRank(1))); return competitorsFromBestToWorst; } @@ -138,7 +138,7 @@ public class MockedTrackedRaceWithFixedRank extends MockedTrackedRace { public RaceDefinition getRace() { return raceDefinition; } - + @Override public Boat getBoatOfCompetitor(Competitor competitor) { return competitorsAndBoats.get(competitor); diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithStartTimeAndRanks.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithStartTimeAndRanks.java index d729e1deaa8..5eef072ebcd 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithStartTimeAndRanks.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/mock/MockedTrackedRaceWithStartTimeAndRanks.java @@ -86,7 +86,7 @@ import com.sap.sse.common.Util.Pair; * Simple mock for {@link TrackedRace} for leaderboard testing; the leaderboard only requests {@link #hasStarted(TimePoint)} and * {@link #getRank(Competitor)} and {@link #getRank(Competitor, TimePoint)}. Additionally, a mocked {@link RaceDefinition} is produced * from the competitor list. - * + * * @author Axel Uhl (D043530) * */ @@ -106,7 +106,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public MockedTrackedRaceWithStartTimeAndRanks(TimePoint startTime, List competitorsFromBestToWorst) { this(startTime, competitorsFromBestToWorst, null); } - + public MockedTrackedRaceWithStartTimeAndRanks(TimePoint startTime, List competitorsFromBestToWorst, Regatta regatta) { this.regatta = regatta; this.startTime = startTime; @@ -352,7 +352,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Tack getTack(Competitor competitor, TimePoint timePoint) { return null; } - + @Override public Tack getTack(SpeedWithBearing speedWithBearing, Wind wind, TimePoint timePoint) { return null; @@ -377,7 +377,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Iterable getManeuvers(Competitor competitor, TimePoint from, TimePoint to, boolean waitForLatest) { return null; } - + @Override public Iterable getManeuvers(Competitor competitor, boolean waitForLatest) { return null; @@ -471,7 +471,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint) { return competitorsFromBestToWorst; } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint) { // TODO: wie soll das umgesetzt werden? @@ -584,7 +584,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Speed getSpeed(Competitor competitor, long millisecondsBeforeRaceStart) { return null; } - + public void addStartTimeChangedListener(StartTimeChangedListener listener) { } @@ -749,7 +749,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return null; } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return null; @@ -784,9 +784,9 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { } @Override - public void updateStartAndEndOfTracking(boolean waitForGPSFixesToLoad) { + public void updateStartAndEndOfTracking(boolean waitForGPSFixesToLoad) { } - + @Override public > TrackT getSensorTrack( Competitor competitor, String trackName) { @@ -807,7 +807,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public NavigableSet getMarkPassings(Competitor competitor, boolean waitForLatestUpdates) { return null; } - + @Override public Distance getAverageRideHeight(Competitor competitor, TimePoint timePoint) { return null; @@ -817,7 +817,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { public Boat getBoatOfCompetitor(Competitor competitor) { return competitorsAndBoats.get(competitor); } - + @Override public Competitor getCompetitorOfBoat(Boat boat) { if (boat == null) { @@ -869,7 +869,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace { @Override public void removeWind(Wind wind, WindSource windSource) { - + } @Override diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumnListener.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumnListener.java index 32e3a934007..8c93db7610e 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumnListener.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumnListener.java @@ -10,33 +10,33 @@ import com.sap.sailing.domain.tracking.TrackedRace; public interface RaceColumnListener extends Serializable { void trackedRaceLinked(RaceColumn raceColumn, Fleet fleet, TrackedRace trackedRace); - + void trackedRaceUnlinked(RaceColumn raceColumn, Fleet fleet, TrackedRace trackedRace); - + void isMedalRaceChanged(RaceColumn raceColumn, boolean newIsMedalRace); void isFleetsCanRunInParallelChanged(RaceColumn raceColumn, boolean newIsFleetsCanRunInParallel); void isStartsWithZeroScoreChanged(RaceColumn raceColumn, boolean newIsStartsWithZeroScore); - + void isFirstColumnIsNonDiscardableCarryForwardChanged(RaceColumn raceColumn, boolean firstColumnIsNonDiscardableCarryForward); void hasSplitFleetContiguousScoringChanged(RaceColumn raceColumn, boolean hasSplitFleetContiguousScoring); - + void hasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking); default boolean canAddRaceColumnToContainer(RaceColumn raceColumn) { return true; } - + void raceColumnAddedToContainer(RaceColumn raceColumn); - + void raceColumnRemovedFromContainer(RaceColumn raceColumn); - + void raceColumnMoved(RaceColumn raceColumn, int newIndex); - + void raceColumnNameChanged(RaceColumn raceColumn, String oldName, String newName); - + void factorChanged(RaceColumn raceColumn, Double oldFactor, Double newFactor); void competitorDisplayNameChanged(Competitor competitor, String oldDisplayName, String displayName); @@ -46,7 +46,7 @@ public interface RaceColumnListener extends Serializable { void maximumNumberOfDiscardsChanged(Integer oldMaximumNumberOfDiscards, Integer newMaximumNumberOfDiscards); void raceLogEventAdded(RaceColumn raceColumn, RaceLogIdentifier raceLogIdentifier, RaceLogEvent event); - + default void regattaLogEventAdded(RegattaLogEvent event) {}; /** @@ -55,7 +55,7 @@ public interface RaceColumnListener extends Serializable { * the set of listeners to be serialized. However, for some listeners, serialization does not make sense. * Instead of making the entire listener collection transient, with this method it is possible that * individual listeners remove themselves from the serialization output.

- * + * * Note that it is the responsibility of the class holding a collection of objects of this type to * exclude listeners from the serialization that return true from this method. */ diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/Series.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/Series.java index e98f4d79f0f..cdff73ba048 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/Series.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/Series.java @@ -13,17 +13,17 @@ import com.sap.sailing.domain.tracking.TrackedRegattaRegistry; * all start in one race, the qualification series can be split into two {@link Fleet}s, "Yellow" and "Blue," each * getting their separate races. Fleet assignment may or may not vary. This usually depends on the series' * characteristics of having ordered or unordered fleets.

- * + * * A series may define its result discarding scheme. If it does, a regatta leaderboard for the containing regatta * has to adhere to this and may not define its own cross-cutting result discarding scheme. If one or more series * in the regatta choose to define their own result discarding scheme, discards are determined per series and not * per leaderboard.

- * + * * To receive notifications when {@link TrackedRace tracked races} are linked to or unlinked from any of this series' * columns, {@link RaceColumnListener}s can be added / removed. - * + * * @author Axel Uhl (D043530) - * + * */ public interface Series extends SeriesBase { /** @@ -33,9 +33,9 @@ public interface Series extends SeriesBase { * describe all "races" named, e.g., "R3" in a series. */ Iterable getRaceColumns(); - + RaceColumnInSeries getRaceColumnByName(String columnName); - + void setIsMedal(boolean isMedal); void setIsFleetsCanRunInParallel(boolean isFleetsCanRunInParallel); @@ -51,19 +51,19 @@ public interface Series extends SeriesBase { * carried out. */ RaceColumnInSeries addRaceColumn(String raceColumnName, TrackedRegattaRegistry trackedRegattaRegistry); - + RaceColumnInSeries addRaceColumn(int insertIndex, String raceColumnName, TrackedRegattaRegistry trackedRegattaRegistry); void removeRaceColumn(String raceColumnName); - + /** * If not null, a containing regatta's leaderboard must obey this rule and in particular cannot define * a "cross-cutting" result discarding rule where discards may be arbitrarily distributed across series. */ ThresholdBasedResultDiscardingRule getResultDiscardingRule(); - + void setResultDiscardingRule(ThresholdBasedResultDiscardingRule resultDiscardingRule); - + /** * If not {@code null}, defines an upper inclusive limit for the number of races that may be discarded from * this series. For example, when setting this to {@code 1} for a final series in a regatta that has a @@ -73,18 +73,18 @@ public interface Series extends SeriesBase { * qualification races. */ Integer getMaximumNumberOfDiscards(); - + void setMaximumNumberOfDiscards(Integer maximumNumberOfDiscards); Regatta getRegatta(); - + /** * Sets this series' regatta. */ void setRegatta(Regatta regatta); - + void addRaceColumnListener(RaceColumnListener listener); - + void removeRaceColumnListener(RaceColumnListener listener); /** @@ -93,7 +93,7 @@ public interface Series extends SeriesBase { * discards local to each series rather than spreading them across the entire leaderboard. */ boolean definesSeriesDiscardThresholds(); - + /** * By default, a competitor's total score is computed by summing up the non-discarded total points of each race * across the leaderboard, considering the {@link RaceColumn#getFactor() column factors}. Some series, however, are @@ -102,12 +102,12 @@ public interface Series extends SeriesBase { * logically, therefore also being discardable. If this method returns true, this series advises the * leaderboard and scoring scheme to start counting the total points at this series with zero. *

- * + * * This condition propagates to the first race column of the series which is then used by the leaderboard and * scoring scheme. */ boolean isStartsWithZeroScore(); - + void setStartsWithZeroScore(boolean startsWithZeroScore); boolean isFirstColumnIsNonDiscardableCarryForward(); @@ -123,7 +123,7 @@ public interface Series extends SeriesBase { boolean hasSplitFleetContiguousScoring(); void setSplitFleetContiguousScoring(boolean hasSplitFleetScore); - + /** * When a series has more than one fleet there are two different options for scoring it when the fleets are of the * same rank. Either the scoring scheme is applied to both fleets at the same time and competitors compete across diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RaceColumnListenerWithDefaultAction.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RaceColumnListenerWithDefaultAction.java index a31ff0cef80..8668e87c187 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RaceColumnListenerWithDefaultAction.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RaceColumnListenerWithDefaultAction.java @@ -15,7 +15,7 @@ import com.sap.sailing.domain.tracking.TrackedRace; * can easily provide a default action to be executed for all callback methods except for maybe a few which then need to * be explicitly overridden. If not most methods need to perform the same action then instead of implementing a default * action subclasses should rather override the {@link RaceColumnListener} operations individually. - * + * * @author Alexander Ries (D062114) * */ @@ -27,61 +27,61 @@ public interface RaceColumnListenerWithDefaultAction extends RaceColumnListener * override {@link RaceColumnListener} methods. */ void defaultAction(); - + @Override default void trackedRaceLinked(RaceColumn raceColumn, Fleet fleet, TrackedRace trackedRace) { - defaultAction(); + defaultAction(); } @Override default void trackedRaceUnlinked(RaceColumn raceColumn, Fleet fleet, TrackedRace trackedRace) { - defaultAction(); + defaultAction(); } @Override default void isMedalRaceChanged(RaceColumn raceColumn, boolean newIsMedalRace) { - defaultAction(); + defaultAction(); } @Override default void isFleetsCanRunInParallelChanged(RaceColumn raceColumn, boolean newIsFleetsCanRunInParallel) { - defaultAction(); + defaultAction(); } @Override default void isStartsWithZeroScoreChanged(RaceColumn raceColumn, boolean newIsStartsWithZeroScore) { - defaultAction(); + defaultAction(); } @Override default void isFirstColumnIsNonDiscardableCarryForwardChanged(RaceColumn raceColumn, boolean firstColumnIsNonDiscardableCarryForward) { - defaultAction(); + defaultAction(); } @Override default void hasSplitFleetContiguousScoringChanged(RaceColumn raceColumn, boolean hasSplitFleetContiguousScoring) { - defaultAction(); + defaultAction(); } - + @Override default void hasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking) { - defaultAction(); + defaultAction(); } @Override default void raceColumnAddedToContainer(RaceColumn raceColumn) { - defaultAction(); + defaultAction(); } @Override default void raceColumnRemovedFromContainer(RaceColumn raceColumn) { - defaultAction(); + defaultAction(); } @Override default void raceColumnMoved(RaceColumn raceColumn, int newIndex) { - defaultAction(); + defaultAction(); } @Override @@ -91,34 +91,34 @@ public interface RaceColumnListenerWithDefaultAction extends RaceColumnListener @Override default void factorChanged(RaceColumn raceColumn, Double oldFactor, Double newFactor) { - defaultAction(); + defaultAction(); } @Override default void competitorDisplayNameChanged(Competitor competitor, String oldDisplayName, String displayName) { - defaultAction(); + defaultAction(); } @Override default void resultDiscardingRuleChanged(ResultDiscardingRule oldDiscardingRule, ResultDiscardingRule newDiscardingRule) { - defaultAction(); + defaultAction(); } @Override default void maximumNumberOfDiscardsChanged(Integer oldMaximumNumberOfDiscards, Integer newMaximumNumberOfDiscards) { - defaultAction(); + defaultAction(); } @Override default void raceLogEventAdded(RaceColumn raceColumn, RaceLogIdentifier raceLogIdentifier, RaceLogEvent event) { - defaultAction(); + defaultAction(); } @Override default void regattaLogEventAdded(RegattaLogEvent event) { - defaultAction(); + defaultAction(); } @Override diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RegattaImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RegattaImpl.java index acbb5383e43..04262f046ce 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RegattaImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/RegattaImpl.java @@ -87,7 +87,7 @@ import com.sap.sse.common.impl.NamedImpl; * for scoring. A regatta has a single boat class. It implements the {@link IsRegattaLike} interface and for this uses a * delegate pattern with the {@link BaseRegattaLikeImpl} which it shares with {@link FlexibleLeaderboardImpl}. That * delegate provides the {@link RegattaLog} for this regatta. - * + * * @author Axel Uhl (D043530) * */ @@ -127,10 +127,10 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene * A synchronized list; synchronize on the object monitor before iterating or modifying */ private List courseAreas; - + private RegattaConfiguration configuration; private RaceExecutionOrderCache raceExecutionOrderCache; - + private String registrationLinkSecret; /** @@ -138,11 +138,11 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene * don't contain valuable information worth being preserved; or they are constructed explicitly with series and race * columns in which case this data needs to be protected. This flag indicates whether the data of this regatta needs * to be maintained persistently. - * + * * @see #isPersistent */ private final boolean persistent; - + /** * When a regatta has well-managed {@link TrackedRace#getStartOfRace() start} and * {@link TrackedRace#getFinishedTime() finish times} it can make sense to drive the tracking infrastructure based @@ -151,13 +151,13 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene * activated using this flag. Tracking connectors can optionally evaluate it and take measures to drive their * {@link RaceTracker} and adjust start and end of tracking times accordingly. *

- * + * * See also * https://bugzilla.sapsailing.com/bugzilla/ * show_bug.cgi?id=3588. */ private boolean controlTrackingFromStartAndFinishTimes; - + private boolean autoRestartTrackingUponCompetitorSetChange; private boolean canBoatsOfCompetitorsChangePerRace; @@ -173,7 +173,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene private AbstractLogEventAuthor regattaLogEventAuthorForRegatta = new LogEventAuthorImpl( AbstractLeaderboardImpl.class.getName(), 0); - + /** * Constructs a regatta with an empty {@link RaceLogStore} and with * {@link Regatta#isControlTrackingFromStartAndFinishTimes()} and @@ -194,7 +194,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene * is not {@link #isPersistent() marked for persistence}. The regatta is created with * {@link Regatta#isControlTrackingFromStartAndFinishTimes()} and * {@link #isAutoRestartTrackingUponCompetitorSetChange()} set to {@code false}. - * + * * @param trackedRegattaRegistry * used to find the {@link TrackedRegatta} for this column's series' {@link Series#getRegatta() regatta} * in order to re-associate a {@link TrackedRace} passed to {@link #setTrackedRace(Fleet, TrackedRace)} @@ -203,7 +203,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene * carried out. */ public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass, - boolean canBoatsOfCompetitorsChangePerRace, CompetitorRegistrationType competitorRegistrationType, + boolean canBoatsOfCompetitorsChangePerRace, CompetitorRegistrationType competitorRegistrationType, TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry, ScoringScheme scoringScheme, Serializable id, CourseArea courseArea, String registrationLinkSecret) { this(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, competitorRegistrationType, @@ -236,7 +236,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene scoringScheme, id, courseArea, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */true, controlTrackingFromStartAndFinishTimes, autoRestartTrackingUponCompetitorSetChange, rankingMetricConstructor, registrationLinkSecret); } - + public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, CompetitorRegistrationType competitorRegistrationType, TimePoint startDate, TimePoint endDate, Iterable series, boolean persistent, @@ -575,7 +575,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene raceColumnListeners.notifyListenersAboutHasSplitFleetContiguousScoringChanged(raceColumn, hasSplitFleetContiguousScoring); } - + @Override public void hasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking) { raceColumnListeners.notifyListenersAboutHasCrossFleetMergedRankingChanged(raceColumn, @@ -705,12 +705,12 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene Util.addAll(newCourseAreas, this.courseAreas); } } - + @Override public boolean isControlTrackingFromStartAndFinishTimes() { return controlTrackingFromStartAndFinishTimes; } - + @Override public boolean isAutoRestartTrackingUponCompetitorSetChange() { return autoRestartTrackingUponCompetitorSetChange; @@ -727,7 +727,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene } } } - + @Override public void setAutoRestartTrackingUponCompetitorSetChange(boolean autoRestartTrackingUponCompetitorSetChange) { if (autoRestartTrackingUponCompetitorSetChange != this.autoRestartTrackingUponCompetitorSetChange) { @@ -975,28 +975,28 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene regattaLog); return analyzer.analyze(); } - + @Override public void registerCompetitor(Competitor competitor) { registerCompetitors(Collections.singletonList(competitor)); } - + @Override public void registerCompetitors(Iterable competitors) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); TimePoint now = MillisecondsTimePoint.now(); - + for (Competitor competitor: competitors) { regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(now, now, regattaLogEventAuthorForRegatta, UUID.randomUUID(), competitor)); } } - + @Override public void deregisterCompetitor(Competitor competitor) { deregisterCompetitors(Collections.singleton(competitor)); } - + @Override public void deregisterCompetitors(Iterable competitors) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); @@ -1010,7 +1010,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene series.setIsFleetsCanRunInParallel(true); } } - + // boat functions @Override public Iterable getBoatsRegisteredInRegattaLog() { @@ -1019,28 +1019,28 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene regattaLog); return analyzer.analyze(); } - + @Override public void registerBoat(Boat boat) { registerBoats(Collections.singleton(boat)); } - + @Override public void registerBoats(Iterable boats) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); TimePoint now = MillisecondsTimePoint.now(); - + for (Boat boat : boats) { regattaLog.add(new RegattaLogRegisterBoatEventImpl(now, now, regattaLogEventAuthorForRegatta, UUID.randomUUID(), boat)); } } - + @Override public void deregisterBoat(Boat boat) { deregisterBoats(Collections.singleton(boat)); } - + @Override public void deregisterBoats(Iterable boats) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); @@ -1057,5 +1057,5 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene public void setRegistrationLinkSecret(String registrationLinkSecret) { this.registrationLinkSecret = registrationLinkSecret; } - + } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/Leaderboard.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/Leaderboard.java index 671386cedeb..79bb92e3ec0 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/Leaderboard.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/Leaderboard.java @@ -52,21 +52,21 @@ import com.sap.sse.security.shared.TypeRelativeObjectIdentifier; * scores and can aggregate them, e.g., to show the overall regatta standings. In addition to the races, a "carry" * column may be used to carry results of races not displayed in the leaderboard into the calculations. *

- * + * * While a single {@link TrackedRace} can tell about the ranks in which according to the tracking information the * competitors crossed the finish line, the leaderboard may overlay this information with disqualifications, changes in * results because the finish-line tracking was inaccurate, jury penalties and discarded results (depending on the * regatta rules, the worst zero, one or more races of each competitor are discarded from the aggregated points). *

- * + * * @author Axel Uhl (d043530) - * + * */ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { /** * If the leaderboard is a "matrix" with the cells being defined by a competitor / race "coordinate," * then this interface defines the structure of the "cells." - * + * * @author Axel Uhl (d043530) * */ @@ -81,19 +81,18 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * Tells if the total points have been corrected by a {@link ScoreCorrection} */ boolean isTotalPointsCorrected(); - + /** * @return null, if the competitor's fleet in the race column cannot be determined, the * {@link Fleet} otherwise */ Fleet getFleet(); } - - + /** * This class is a default RankComparable that uses the ranks as Comparable. - * This class is only used as a placeholder while the new RankingSystem is under development. - * + * This class is only used as a placeholder while the new RankingSystem is under development. + * * @author I518097 * */ @@ -122,7 +121,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { } } } - + LeaderboardDTO computeDTO(final TimePoint timePoint, final Collection namesOfRaceColumnsForWhichToLoadLegDetails, boolean addOverallDetails, final boolean waitForLatestAnalyses, TrackedRegattaRegistry trackedRegattaRegistry, @@ -134,14 +133,14 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * the suppressed competitors. */ Iterable getCompetitors(); - + /** * A leaderboard may suppress particular competitors which are then not assigned a score and shall not be displayed * in a regular view of the leaderboard. Editors for leaderboards shall, though, also display the suppressed competitors * together with a visual indication showing which competitors are currently suppressed. The "suppressed-state" of a * competitor can change over the life cycle of a leaderboard. A typical use case for suppressing a competitor is * removing one-time entries from a series (meta-)leaderboard or suppressing a camera boat in scoring.

- * + * * @return all competitors in this leaderboard, including the suppressed ones. */ Iterable getAllCompetitors(); @@ -170,14 +169,14 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * removed */ Iterable getCompetitors(RaceColumn raceColumn, Fleet fleet); - + /** * Convenience method which returns the difference between {@link #getAllCompetitors()} and {@link #getCompetitors()}. * The collection is a copy that can safely be held and modified, but it is not "live" in the sense that it does not * reflect changes that occur to the set of suppressed competitors after calling this method, nor vice-versa. */ Iterable getSuppressedCompetitors(); - + /** * Tells whether {@code competitor} is among those {@link #getSuppressedCompetitors() suppressed} */ @@ -203,13 +202,13 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * a default fleet if it has one, or null otherwise. */ Fleet getFleet(String fleetName); - + Entry getEntry(Competitor competitor, RaceColumn race, TimePoint timePoint) throws NoWindException; /** * Same as {@link #getEntry}, but the discards for the competitor across the leaderboard can be provided for better performance * in case the entries for several columns shall be computed by multiple calls to this method. - * + * * @param discardedRaceColumns * expected to be the result of what we would get if we called {@link #getResultDiscardingRule()}. * {@link ResultDiscardingRule#getDiscardedRaceColumns(Competitor, Leaderboard, Iterable, TimePoint, ScoringScheme) @@ -220,17 +219,17 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { /** * Computes the competitor's ranks as they were or would have been after each race column (from left to right) * was completed.

- * + * * A leaderboard fills up over time, usually "from left to right" with one race after another finishing. * For split fleets things can vary slightly. There, one fleet may complete a few races before the another fleet * starts with those races. In this case there isn't even any point in time at which all fleets have finished * exactly n races. Still, this method pretends such a time point would have existed, actually ignoring * the times at which a race took place but only looking at the resulting scores and discards.

- * + * * When computing the ranks after all columns up to and including the race column that is the key of the resulting * map, the method applies the discarding and tie breaking rules as they would have had to be applied had the races * in the respective column just completed. - * + * * @return The resulting map is guaranteed to have the same iteration order regarding the race columns * as {@link #getRaceColumns()}. */ @@ -239,46 +238,46 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { return getRankedCompetitorsFromBestToWorstAfterEachRaceColumn(timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + /** * Computes the competitor's ranks as they were or would have been after each race column (from left to right) * was completed.

- * + * * A leaderboard fills up over time, usually "from left to right" with one race after another finishing. * For split fleets things can vary slightly. There, one fleet may complete a few races before the another fleet * starts with those races. In this case there isn't even any point in time at which all fleets have finished * exactly n races. Still, this method pretends such a time point would have existed, actually ignoring * the times at which a race took place but only looking at the resulting scores and discards.

- * + * * When computing the ranks after all columns up to and including the race column that is the key of the resulting * map, the method applies the discarding and tie breaking rules as they would have had to be applied had the races * in the respective column just completed. - * + * * @return The resulting map is guaranteed to have the same iteration order regarding the race columns * as {@link #getRaceColumns()}. */ Map> getRankedCompetitorsFromBestToWorstAfterEachRaceColumn(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) throws NoWindException; - + /** * Computes the competitor's net points sum as they were or would have been after each race column (from left to right) * was completed.

- * + * * A leaderboard fills up over time, usually "from left to right" with one race after another finishing. * For split fleets things can vary slightly. There, one fleet may complete a few races before the another fleet * starts with those races. In this case there isn't even any point in time at which all fleets have finished * exactly n races. Still, this method pretends such a time point would have existed, actually ignoring * the times at which a race took place but only looking at the resulting scores and discards.

- * + * * When computing the net points sum after all columns up to and including the race column that is the key of the resulting * map, the method applies the discarding and tie breaking rules as they would have had to be applied had the races * in the respective column just completed. - * + * * @return The resulting map is guaranteed to have the same iteration order regarding the race columns * as {@link #getRaceColumns()}. */ Map> getNetPointsSumAfterRaceColumn(TimePoint timePoint) throws NoWindException; - + /** * Tells the number of points carried over from previous races not tracked by this leaderboard for * the competitor. Returns 0 if there is no carried points definition for @@ -287,7 +286,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { double getCarriedPoints(Competitor competitor); /** - * + * * @return an unmodifiable map of competitors and their carried points. The key set can be a true super set of what * {@link #getAllCompetitors()} returns. */ @@ -299,11 +298,11 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * {@link TrackedRace} exists for race, 0 will be returned for all those competitors. The tracked race * for the correct {@link Fleet} is determined using {@link RaceColumn#getTrackedRace(Competitor)}. *

- * + * * For each competitor tracking-wise ranking better than competitor but with a * {@link #getMaxPointsReason(Competitor, RaceColumn, TimePoint) disqualification reason} given, * competitor's rank is improved by one. - * + * * @param competitor * a competitor contained in the {@link #getCompetitors()} result * @param race @@ -320,11 +319,11 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * {@link TrackedRace} exists for race, 0 will be returned for all those competitors. The tracked race * for the correct {@link Fleet} is determined using {@link RaceColumn#getTrackedRace(Competitor)}. *

- * + * * For each competitor tracking-wise ranking better than competitor but with a * {@link #getMaxPointsReason(Competitor, RaceColumn, TimePoint) disqualification reason} given, * competitor's rank is improved by one. - * + * * @param competitor * a competitor contained in the {@link #getCompetitors()} result * @param race @@ -337,7 +336,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * A possibly corrected number of points for the race specified. Defaults to the result of calling * {@link #getTrackedRank(Competitor, TrackedRace, TimePoint)} but may be corrected by disqualifications or calls by * the jury for the particular race that differ from the tracking results. - * + * * @param competitor * a competitor contained in the {@link #getCompetitors()} result * @param raceColumn @@ -353,7 +352,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * A possibly corrected number of points for the race specified. Defaults to the result of calling * {@link #getTrackedRank(Competitor, TrackedRace, TimePoint)} but may be corrected by disqualifications or calls by * the jury for the particular race that differ from the tracking results. - * + * * @param competitor * a competitor contained in the {@link #getCompetitors()} result * @param raceColumn @@ -376,7 +375,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * race scores. Defaults to the result of calling {@link #getTotalPoints(Competitor, TrackedRace, TimePoint)} but * may be corrected by the regatta rules for discarding results. If * {@link #isDiscarded(Competitor, RaceColumn, TimePoint) discarded}, the points returned will be 0. - * + * * @param competitor * a competitor contained in the {@link #getCompetitors()} result * @param race @@ -402,7 +401,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * across all races tracked by this leaderboard, respecting the {@link RaceColumn#isStartsWithZeroScore()} property. */ Double getNetPoints(Competitor competitor, TimePoint timePoint); - + /** * Sums up the {@link #getNetPoints(Competitor, RaceColumn, TimePoint) net points} of competitor * across all race columns listed in raceColumnsToconsider, respecting the @@ -416,7 +415,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * are added to the result list. This excludes competitors whose fleet hasn't raced for the raceColumn * yet, and those where no tracked rank is known and no manual score correction was performed. *

- * + * * The sorting order considers this leaderboard's scoring scheme including the semantics of * {@link Fleet#compareTo(Fleet) ordered fleets} and {@link RaceColumn#isMedalRace() medal races}. The ordering * does not consider result discarding because when sorting for a race column it is of interest how the competitor @@ -427,13 +426,13 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { default Iterable getCompetitorsFromBestToWorst(RaceColumn raceColumn, TimePoint timePoint) throws NoWindException { return getCompetitorsFromBestToWorst(raceColumn, timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + /** * Sorts the competitors according to their ranking in the race column specified. Only competitors who have a score * are added to the result list. This excludes competitors whose fleet hasn't raced for the raceColumn * yet, and those where no tracked rank is known and no manual score correction was performed. *

- * + * * The sorting order considers this leaderboard's scoring scheme including the semantics of * {@link Fleet#compareTo(Fleet) ordered fleets} and {@link RaceColumn#isMedalRace() medal races}. The ordering * does not consider result discarding because when sorting for a race column it is of interest how the competitor @@ -443,25 +442,25 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { */ Iterable getCompetitorsFromBestToWorst(RaceColumn raceColumn, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) throws NoWindException; - + /** * Sorts the competitors according to the overall regatta standings, considering the sorting rules for * {@link Series}, {@link Fleet}s, medal races, discarding rules and score corrections. A new list is * created per call, so the caller may freely manipulate the result. - * @throws NoWindException + * @throws NoWindException */ default List getCompetitorsFromBestToWorst(TimePoint timePoint) { return getCompetitorsFromBestToWorst(timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + /** * Sorts the competitors according to the overall regatta standings, considering the sorting rules for * {@link Series}, {@link Fleet}s, medal races, discarding rules and score corrections. A new list is * created per call, so the caller may freely manipulate the result. - * @throws NoWindException + * @throws NoWindException */ List getCompetitorsFromBestToWorst(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); - + /** * Returns the total rank of the given competitor or {@code 0} if no rank can be determined for * the {@code competitor} in this leaderboard. @@ -483,13 +482,13 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * {@link #addRaceColumn(String, boolean)}. */ Iterable getRaceColumns(); - + /** * Retrieves a {@link RaceColumn race column} by the name used in calls to either {@link #addRaceColumn} or * {@link #addRace}. If no race column by the requested name exists, null is returned. */ RaceColumn getRaceColumnByName(String name); - + /** * A leaderboard can carry over points from races that are not tracked by this leaderboard in detail, * so for which no {@link RaceColumn} column is present in this leaderboard. These scores are @@ -497,31 +496,31 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * method. */ void setCarriedPoints(Competitor competitor, double carriedPoints); - + /** * Reverses the effect of {@link #setCarriedPoints(Competitor, int)}, i.e., afterwards, asking {@link #getCarriedPoints(Competitor)} * will return 0. Furthermore, other than invoking {@link #setCarriedPoints(Competitor, int) setCarriedPoints(c, 0)}, * this will, when executed for all competitors of this leaderboard, have {@link #hasCarriedPoints} return false. */ void unsetCarriedPoints(Competitor competitor); - + /** * Tells if a carry-column shall be displayed. If the result is false, then no * {@link #setCarriedPoints(Competitor, int) scores are carried} into this leaderboard, and * only the race columns will be accumulated by the board. */ boolean hasCarriedPoints(); - + boolean hasCarriedPoints(Competitor competitor); SettableScoreCorrection getScoreCorrection(); - + void addScoreCorrectionListener(ScoreCorrectionListener listener); void removeScoreCorrectionListener(ScoreCorrectionListener listener); Competitor getCompetitorByName(String competitorName); - + void setDisplayName(Competitor competitor, String displayName); void setDisplayName(String displayName); @@ -544,7 +543,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * {@link ScoringScheme#isValidInNetScore(Leaderboard, RaceColumn, Competitor, TimePoint)}). */ boolean countRaceForComparisonWithDiscardingThresholds(Competitor competitor, RaceColumn raceColumn, TimePoint timePoint); - + /** * Returns the result discarding rule for this leaderboard. This may be an explicit rule set for the entire leaderboard, * or it may be an implicit rule that relies on other data such as a regatta's series-specific result discarding rules. @@ -560,17 +559,17 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { public void setCrossLeaderboardResultDiscardingRule(ThresholdBasedResultDiscardingRule discardingRule); Competitor getCompetitorByIdAsString(String idAsString); - + void addRaceColumnListener(RaceColumnListener listener); - + void removeRaceColumnListener(RaceColumnListener listener); - + /** * For this leaderboard computes the delay to live of the {@link TrackedRace} linked to any of the leaderboard's * columns that has the latest start date. If no tracked race is linked to the leaderboard, null is returned. */ Long getDelayToLiveInMillis(); - + /** * Obtains all {@link TrackedRace}s currently attached to any of the columns of this leaderboard */ @@ -592,7 +591,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * races attached to this leaderboard; the fix where the maximum speed was achieved, and the speed value */ Util.Pair getMaximumSpeedOverGround(Competitor competitor, TimePoint timePoint); - + /** * @return the {@link #getTotalDistanceTraveled(Competitor, TimePoint) total distance} the competitor has traveled * up to {@code timePoint}, divided by the {@link #getTotalTimeSailed(Competitor, TimePoint) total time @@ -611,18 +610,18 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { /** * Starts counting when the gun goes off, not when the competitor passed the line. - * + * * @return null if no tracked race is available for competitor in this leaderboard * or the competitor hasn't started sailing a single race at timePoint for any of the tracked * races attached to this leaderboard */ Duration getTotalTimeSailed(Competitor competitor, TimePoint timePoint); - + /** * Computes the distance the competitor has sailed in the tracked races in this leaderboard, starting * to count in each race when the competitor passes the start line, aggregating up to timePoint or the * end of the last race, whichever is first. - * + * * @return null if the competitor hasn't sailed any distance in any tracked race in this * leaderboard */ @@ -632,22 +631,22 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * Computes the distance the competitor has been foiling in the tracked races in this leaderboard, starting * to count in each race when the competitor passes the start line, aggregating up to timePoint or the * end of the last race, whichever is first. - * + * * @return null if the competitor hasn't foiled any distance in any tracked race in this * leaderboard */ Distance getTotalDistanceFoiled(Competitor competitor, TimePoint timePoint); - + /** * Computes the duration the competitor has foiled in the tracked races in this leaderboard, starting * to count in each race when the competitor passes the start line, aggregating up to timePoint or the * end of the last race, whichever is first. - * + * * @return null if the competitor hasn't foiled at any time in any tracked race in this * leaderboard */ Duration getTotalDurationFoiled(Competitor competitor, TimePoint timePoint); - + /** * Same as {@link #getNetPoints(Competitor, RaceColumn, TimePoint)}, only that for determining the discarded * results only raceColumnsToConsider are considered. @@ -660,7 +659,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * be specified which is useful when total points are to be computed for more than one column for the same * competitor because then the calculation of discards (which requires looking at all columns) only needs to be done * once and not again for each column (which would lead to quadratic effort). - * + * * @param discardedRaceColumns * expected to be the result of what we would get if we called {@link #getResultDiscardingRule()}. * {@link ResultDiscardingRule#getDiscardedRaceColumns(Competitor, Leaderboard, Iterable, TimePoint, ScoringScheme) @@ -679,11 +678,11 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { Set discardedRaceColumns, Supplier totalPointsProvider); TimePoint getNowMinusDelay(); - + /** * Gets the course areas that the races of this leaderboard are expected to be run on. This can, e.g., be used to * implement a filter when retrieving leaderboards from an event. - * + * * @return the {@link CourseArea} objects on which races of this leaderboard may run; always valid, never * {@code null}, but may be empty */ @@ -707,12 +706,12 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * namesOfRaceColumnsForWhichToLoadLegDetails. The leaderboard is evaluated at timePoint, * or, if timePoint is null, for the "live" time point (now - delay). *

- * + * * The implementation uses different approaches for caching the results. For "live" requests, a * {@link LiveLeaderboardUpdater} is used to keep refreshing the cached results. Other queries are managed by a * {@link LeaderboardDTOCache} which remembers a number of results before it starts evicting the least frequently * used ones. - * + * * @param timePoint * null for "live" results for the time point "now" - delay; otherwise, the explicit time * point at which to evaluate the leaderboard status @@ -741,7 +740,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * the boat class will be determined based on the most frequently occurring boat class when iterating across the competitors. */ BoatClass getBoatClass(); - + LeaderboardType getLeaderboardType(); /** @@ -752,7 +751,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { /** * Returns true if a racecolumn evaluates to be a win for the given competitor at the given timepoint. - * If the competitor is not scored for this race, {@code false} is returned + * If the competitor is not scored for this race, {@code false} is returned */ default boolean isWin(Competitor competitor, RaceColumn raceColumn, TimePoint timePoint) { final Double points = getTotalPoints(competitor, raceColumn, timePoint); @@ -791,7 +790,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { default HasPermissions getPermissionType() { return SecuredDomainType.LEADERBOARD; } - + default boolean isPartOfEvent(EventBase event) { return Util.containsAny(event.getVenue().getCourseAreas(), getCourseAreas()); } @@ -802,7 +801,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * given as the key, and as the second pair component the number of computations in that time period. */ Map> getComputationTimeStatistics(); - + /** * Matches the results in {@code regattaScoreCorrections} to the {@link RaceColumn}s and {@link Competitor}s in this * leaderboard. The race columns are identified in {@code regattaScoreCorrections} by the @@ -815,7 +814,7 @@ public interface Leaderboard extends LeaderboardBase, HasRaceColumns { * {@link Competitor#getShortName() short name} if the boats can change in this leaderboard, or to the * {@link Boat#getSailID()} result of the competitor's boat, overruled by the explicit mappings in * {@code sailIdToCompetitorMap}. - * + * * @param allowRaceDefaultsByOrder * if {@code true}, an attempt will be made to map the race names/numbers from the * {@link RegattaScoreCorrections} to the leaderboard's {@link RaceColumn}s by their ordering, one by diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractLeaderboardImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractLeaderboardImpl.java index 0d250776571..e697c79f3c0 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractLeaderboardImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractLeaderboardImpl.java @@ -42,7 +42,7 @@ import com.sap.sse.common.impl.MillisecondsTimePoint; * one. All events received this way are forwarded to all {@link RaceColumnListener}s subscribed. This can be used to * subscribe a concrete leaderboard implementation to the data structure providing the actual race columns in order to * be notified whenever the set of {@link TrackedRace}s attached to the leaderboard changes. - * + * * @author Axel Uhl (D043530) * */ @@ -149,7 +149,7 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI * Per competitor disqualified ({@link ScoreCorrection} has a {@link MaxPointsReason} for the competitor that has * {@link MaxPointsReason#isAdvanceCompetitorsTrackedWorse()}==true) and those suppressed, all * competitors ranked worse by the tracking system need to have their rank corrected by one. - * + * * @param trackedRace * the race to which the rank refers; look for disqualifications / max points reasons in this column * @param timePoint @@ -157,7 +157,7 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI * when a competitor was disqualified) * @param rank * a competitors rank according to the tracking system - * + * * @return the unmodified rank if no disqualifications for better-ranked competitors exist for * race, or otherwise a rank improved (lowered) by the number of disqualifications of * competitors whose tracked rank is better (lower) than rank. @@ -167,13 +167,13 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI return improveByDisqualificationsOfBetterRankedCompetitors(raceColumn, trackedRace, timePoint, new Pair<>(rank, new RankComparableRank(rank))).getA(); } - + /** * Per competitor disqualified ({@link ScoreCorrection} has a {@link MaxPointsReason} for the competitor that has * {@link MaxPointsReason#isAdvanceCompetitorsTrackedWorse()}==true) and those suppressed, all - * competitors ranked worse by the tracking system need to have their rank corrected by one. The {@link RankComparable} must also - * consider the {@link MaxPointsReason} so that the behavior remains consistent. - * + * competitors ranked worse by the tracking system need to have their rank corrected by one. The {@link RankComparable} must also + * consider the {@link MaxPointsReason} so that the behavior remains consistent. + * * @param trackedRace * the race to which the rank refers; look for disqualifications / max points reasons in this column * @param timePoint @@ -181,7 +181,7 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI * when a competitor was disqualified) * @param rank * a competitors rank and rankComparable according to the tracking system - * + * * @return the unmodified Pair(Rank, {@link RankComparable} if no disqualifications for better-ranked competitors exist for * race, or otherwise a Pair(Rank, {@link RankComparable} where the Rank is improved (lowered) by the number of disqualifications of * competitors whose tracked rank is better (lower) than rank while the {@link RankComparable} is consistent with the new Rank. @@ -200,7 +200,7 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI (maxPointsReasonForBetterCompetitor != null && maxPointsReasonForBetterCompetitor != MaxPointsReason.NONE && maxPointsReasonForBetterCompetitor.isAdvanceCompetitorsTrackedWorse())) { - correctedRank = new Pair<>(correctedRank.getA() - 1, correctedRank.getB()); + correctedRank = new Pair<>(correctedRank.getA() - 1, correctedRank.getB()); } betterCompetitorRank++; } @@ -242,17 +242,17 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI regattaLog); return analyzer.analyze(); } - + @Override public void registerCompetitor(Competitor competitor) { registerCompetitors(Collections.singletonList(competitor)); } - + @Override public void registerCompetitors(Iterable competitors) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); TimePoint now = MillisecondsTimePoint.now(); - + for (Competitor competitor: competitors) { regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(now, now, regattaLogEventAuthorForAbstractLeaderboard, UUID.randomUUID(), competitor)); @@ -263,14 +263,14 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI public void deregisterCompetitor(Competitor competitor) { deregisterCompetitors(Collections.singleton(competitor)); } - + @Override public void deregisterCompetitors(Iterable competitors) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); CompetitorDeregistrator deregisterer = new CompetitorDeregistrator<>(regattaLog, competitors, regattaLogEventAuthorForAbstractLeaderboard); deregisterer.deregister(deregisterer.analyze()); } - + // boat functions @Override public Iterable getBoatsRegisteredInRegattaLog() { @@ -284,23 +284,23 @@ public abstract class AbstractLeaderboardImpl extends AbstractSimpleLeaderboardI public void registerBoat(Boat boat) { registerBoats(Collections.singleton(boat)); } - + @Override public void registerBoats(Iterable boats) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); TimePoint now = MillisecondsTimePoint.now(); - + for (Boat boat : boats) { regattaLog.add(new RegattaLogRegisterBoatEventImpl(now, now, regattaLogEventAuthorForAbstractLeaderboard, UUID.randomUUID(), boat)); } } - + @Override public void deregisterBoat(Boat boat) { deregisterBoats(Collections.singleton(boat)); } - + @Override public void deregisterBoats(Iterable boats) { RegattaLog regattaLog = getRegattaLike().getRegattaLog(); diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractSimpleLeaderboardImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractSimpleLeaderboardImpl.java index 01463a0cb7d..2549398e1b5 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractSimpleLeaderboardImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/AbstractSimpleLeaderboardImpl.java @@ -57,7 +57,7 @@ import com.sap.sse.concurrent.NamedReentrantReadWriteLock; * received to all {@link RaceColumnListener} subscribed with this leaderboard. To which objects this leaderboard * subscribes as {@link RaceColumnListener} is left to the concrete subclasses to implement, but the race columns seem * like useful candidates. - * + * * @author Axel Uhl (d043530) * */ @@ -95,7 +95,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW /** * A leaderboard entry representing a snapshot of a cell at a given time point for a single race/competitor. - * + * * @author Axel Uhl (d043530) * */ @@ -179,7 +179,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * would be cached, but that is again difficult because we would have to monitor all changes in all dependent * leaderboards and columns and tracked races properly. *

- * + * * As it turns out, one of the most frequent uses of the {@link AbstractSimpleLeaderboardImpl#getCompetitors} * competitors list is to determine their number which in turn is only required for high-point scoring systems and * for computing the default score for penalties. Again, the most frequently used low-point family of scoring @@ -187,9 +187,9 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * that need it. Instead of computing it for each call, this interface lets us defer the actual calculation until * the point when it's really needed. Once asked, this object will cache the result. Therefore, a new one should be * constructed each time the number shall be computed. - * + * * @author Axel Uhl (D043530) - * + * */ public class NumberOfCompetitorsFetcherImpl implements NumberOfCompetitorsInLeaderboardFetcher { private int numberOfCompetitors = -1; @@ -270,7 +270,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW getRaceColumnListeners().notifyListenersAboutHasSplitFleetContiguousScoringChanged(raceColumn, hasSplitFleetContiguousScoring); } - + @Override public void hasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking) { getRaceColumnListeners().notifyListenersAboutHasCrossFleetMergedRankingChanged(raceColumn, hasCrossFleetMergedRanking); @@ -441,7 +441,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * be specified which is useful when net points are to be computed for more than one column for the same competitor * because then the calculation of discards (which requires looking at all columns) only needs to be done once and * not again for each column (which would lead to quadratic effort). - * + * * @param discardedRaceColumns * expected to be the result of what we would get if we called {@link #getResultDiscardingRule()}. * {@link ResultDiscardingRule#getDiscardedRaceColumns(Competitor, Leaderboard, Iterable, TimePoint, ScoringScheme) @@ -471,7 +471,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * columns can be specified which is useful when net points are to be computed for more than one column for the same * competitor because then the calculation of discards (which requires looking at all columns) only needs to be done * once and not again for each column (which would lead to quadratic effort). - * + * * @param discardedRaceColumns * expected to be the result of what we would get if we called {@link #getResultDiscardingRule()}. * {@link ResultDiscardingRule#getDiscardedRaceColumns(Competitor, Leaderboard, Iterable, TimePoint, ScoringScheme) @@ -482,7 +482,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW Set discardedRaceColumns) { return getNetPoints(competitor, raceColumn, timePoint, discardedRaceColumns, ()->getTotalPoints(competitor, raceColumn, timePoint)); } - + @Override public Double getNetPoints(Competitor competitor, RaceColumn raceColumn, TimePoint timePoint, Set discardedRaceColumns, Supplier totalPointsProvider) { @@ -791,7 +791,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * leaderboard, null is returned. The time point computed this way is a good choice for normalizing * queries for later time points in an attempt to achieve more cache hits. *

- * + * * Note, however, that the result does not tell about structural changes to the leaderboard and therefore cannot be * used to determine the need for cache invalidation. For example, if a column is added to a leaderboard after the * time point returned by this method but that column's attached tracked race has finished before the time point @@ -799,7 +799,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW * change by a change in column structure. A different means to determine the possibility of changes that happened * to this leaderboard must be used for cache management. Such a facility has to listen for score correction * changes, tracked races being attached or detached and the column structure changing. - * + * * @see TrackedRace#getTimePointOfNewestEvent() * @see SettableScoreCorrection#getTimePointOfLastCorrectionsValidity() */ @@ -970,7 +970,4 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW return Util.getDominantObject(StreamSupport.stream(allBoats.spliterator(), /* parallel */ false) .map(b -> b.getBoatClass()).collect(Collectors.toList())); } - - - } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/DelegatingRegattaLeaderboardWithCompetitorElimination.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/DelegatingRegattaLeaderboardWithCompetitorElimination.java index 3b6e8abef68..aac0b0e0f4d 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/DelegatingRegattaLeaderboardWithCompetitorElimination.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/impl/DelegatingRegattaLeaderboardWithCompetitorElimination.java @@ -53,23 +53,23 @@ import com.sap.sse.common.Util.Pair; * regatta ("total") rank, and all competitors advance by as many ranks compared to the original leaderboard as there * are eliminated competitors ranking better in the original leaderboard. *

- * + * * This behavior is achieved by overriding any method returning a collection of {@link Competitor}s, such as * {@link #getCompetitors()}, such that the eliminated competitors are removed from the result which should let any * leaderboard panel displaying the contents of this leaderboard list only the non-eliminated competitors. This includes * {@link #getCompetitorsFromBestToWorst(TimePoint)} which also leads the implementation of * {@link #getTotalRankOfCompetitor(Competitor, TimePoint)} to calculate the ranks based on the competitor list without * those eliminated. - * + * * @author Axel Uhl (d043530) */ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends AbstractLeaderboardWithCache implements RegattaLeaderboardWithEliminations { private static final long serialVersionUID = 8331154893189722924L; private final String name; private RegattaLeaderboard fullLeaderboard; - + private transient final Supplier fullLeaderboardSupplier; - + /** * The particular use case for which this field is introduced is registering score correction * listeners at a point in time when the full leaderboard hasn't been resolved yet. Instead of @@ -78,7 +78,7 @@ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends Abstr * leaderboard, all consumers in this set will be triggered. */ private final ConcurrentHashMap, Boolean> triggerWhenFullLeaderboardIsResolved; - + /** * Competitors eliminated from this leaderboard for regatta ranking; those competitors are not part of * {@link #getCompetitors()} but appear in {@link #getAllCompetitors()}. They may have an overlap with @@ -110,7 +110,7 @@ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends Abstr public Iterable getCompetitors() { return new ObscuringIterable<>(getFullLeaderboard().getCompetitors(), eliminatedCompetitors.keySet()); } - + @Override public void setEliminated(Competitor competitor, boolean eliminated) { if (eliminated) { @@ -119,7 +119,7 @@ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends Abstr eliminatedCompetitors.remove(competitor); } } - + @Override public boolean isEliminated(Competitor competitor) { return eliminatedCompetitors.containsKey(competitor); @@ -150,7 +150,7 @@ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends Abstr } return result; } - + @Override public Iterable getCompetitorsFromBestToWorst(RaceColumn raceColumn, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) throws NoWindException { @@ -515,11 +515,11 @@ public class DelegatingRegattaLeaderboardWithCompetitorElimination extends Abstr } return fullLeaderboard; } - + /** * Before being serialized, ensure that the leaderboard supplier has been used to tru * to resolve the leaderboard. - * @throws IOException + * @throws IOException */ private void writeObject(ObjectOutputStream oos) throws IOException { getFullLeaderboard(); diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java index 3b1854bc0ec..7b5d77e6d2a 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java @@ -30,7 +30,7 @@ import com.sap.sse.common.Util.Pair; /** * All {@link RaceColumnListener} events received from the underlying leaderboard's race columns * are forwarded to this object's {@link RaceColumnListener}s. - * + * * @author Axel Uhl * */ @@ -38,7 +38,7 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R private static final long serialVersionUID = 3092096133388262955L; private final Leaderboard leaderboard; private final Fleet metaFleet; - + public MetaLeaderboardColumn(Leaderboard leaderboard, Fleet metaFleet) { super(); this.leaderboard = leaderboard; @@ -55,7 +55,7 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R public Leaderboard getLeaderboard() { return leaderboard; } - + @Override public String getName() { return leaderboard.getDisplayName() != null ? leaderboard.getDisplayName() : leaderboard.getName(); @@ -147,7 +147,7 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R public void hasSplitFleetContiguousScoringChanged(RaceColumn raceColumn, boolean hasSplitFleetContiguousScoring) { getRaceColumnListeners().notifyListenersAboutHasSplitFleetContiguousScoringChanged(raceColumn, hasSplitFleetContiguousScoring); } - + @Override public void hasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking) { getRaceColumnListeners().notifyListenersAboutHasCrossFleetMergedRankingChanged(raceColumn, hasCrossFleetMergedRanking); @@ -243,7 +243,7 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R public Pair, Iterable> getAllCompetitorsWithRaceDefinitionsConsidered() { return leaderboard.getAllCompetitorsWithRaceDefinitionsConsidered(); } - + @Override public Iterable getAllCompetitors(Fleet fleet) { final Iterable result; @@ -263,7 +263,7 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R @Override public Map getAllCompetitorsAndTheirBoats(Fleet fleet) { - // TODO bug2822: What should we do here? Returning a boat makes only sense when the competitors keep their boats through all regattas + // TODO bug2822: What should we do here? Returning a boat makes only sense when the competitors keep their boats through all regattas return Collections.emptyMap(); } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/DummyTrackedRace.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/DummyTrackedRace.java index 8b57d1180a4..c9816c3cecf 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/DummyTrackedRace.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/DummyTrackedRace.java @@ -61,7 +61,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { this(competitorsAndBoats, regatta, trackedRegatta, new RaceDefinitionImpl("DummyRace", new CourseImpl("Dummy Course", Collections.emptyList()), regatta.getBoatClass(), competitorsAndBoats, raceId), windStore); } - + public DummyTrackedRace(final Map competitors, final Regatta regatta, final TrackedRegatta trackedRegatta, RaceDefinition race, WindStore windStore) { super(race, trackedRegatta, windStore, -1); @@ -187,7 +187,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public int getRank(Competitor competitor, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return 0; } - + @Override public Pair> getRankAndRankComparable(Competitor competitor) throws NoWindException { return null; @@ -326,7 +326,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public Iterable getManeuvers(Competitor competitor, TimePoint from, TimePoint to, boolean waitForLatest) { return null; } - + @Override public Iterable getManeuvers(Competitor competitor, boolean waitForLatest) { return null; @@ -452,7 +452,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint) { return null; } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint) { return null; @@ -702,7 +702,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return null; } - + @Override public LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return null; @@ -712,7 +712,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public Boat getBoatOfCompetitor(Competitor competitor) { return null; } - + @Override public Competitor getCompetitorOfBoat(Boat boat) { return null; @@ -797,7 +797,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { public WindSummary getWindSummary() { return null; } - + @Override public boolean recordWind(Wind wind, WindSource windSource, boolean applyFilter) { return false; @@ -805,7 +805,7 @@ public class DummyTrackedRace extends TrackedRaceWithWindEssentials { @Override public void removeWind(Wind wind, WindSource windSource) { - + } @Override diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/TrackedRace.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/TrackedRace.java index ef068400537..3e04b4971cc 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/TrackedRace.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/TrackedRace.java @@ -81,12 +81,12 @@ import com.sap.sse.security.shared.WithQualifiedObjectIdentifier; * {@link #getTrackedLegs()} and {@link #getTrackedLeg(Leg)}) or for a single competitor (see * {@link #getTrackedLeg(Competitor, Leg)}). *

- * + * * The overall race standings can be requested in terms of a competitor's ranking. More detailed information about what * happens / happened within a leg is available from {@link TrackedLeg} and {@link TrackedLegOfCompetitor}. - * + * * @author Axel Uhl (d043530) - * + * */ public interface TrackedRace extends Serializable, IsManagedByCache, WithQualifiedObjectIdentifier { @@ -100,7 +100,7 @@ public interface TrackedRace RaceDefinition getRace(); RegattaAndRaceIdentifier getRaceIdentifier(); - + /** * Tells how ranks are to be assigned to the competitors at any time during the race. For one-design boat classes * this will usually happen by projecting the competitors to the wind direction for upwind and downwind legs or to @@ -121,11 +121,11 @@ public interface TrackedRace * passing for the first mark. Otherwise, the first mark passing for the first mark minus * {@link #MAX_TIME_BETWEEN_START_AND_FIRST_MARK_PASSING_IN_MILLISECONDS} is returned as the race start time. *

- * + * * If no start time can be determined this way, null is returned. */ TimePoint getStartOfRace(); - + /** * Like {@link #getStartOfRace()}, but ignoring any inference from start mark passings in case {@code inferred} is * {@code false}. In this case, if no official start time was set, e.g., in the {@link RaceLog} or explicitly using @@ -144,7 +144,7 @@ public interface TrackedRace * @return the time point taken from a valid, non-revoked {@link RaceLogRaceStatusEvent} that transfers the race * into status {@link RaceLogRaceStatus#FINISHED} from any of the {@link RaceLog}s attached to this race, * or {@code null} if no such event is found. - * + * * @see {@link RaceChangeListener#finishedTimeChanged(TimePoint, TimePoint)} */ TimePoint getFinishedTime(); @@ -171,26 +171,26 @@ public interface TrackedRace * Shorthand for {@link #getStart()}.{@link TimePoint#compareTo(TimePoint) compareTo(at)} <= 0 */ boolean hasStarted(TimePoint at); - + /** * A race is considered "live" if it * {@link TrackedRaceDTO#hasGPSData has GPS data} and {@link TrackedRaceDTO#hasWindData wind data} and if the * at time point is between the start and the end of the race. *

- * + * * The pre-start phase of a race is interesting also in live mode. Therefore, if a {@link TrackedRace#getStartOfRace start * time} is available for the race, the {@link TimingConstants#PRE_START_PHASE_DURATION_IN_MILLIS} is subtracted * from the actual start time so that the pre-start phase also counts as live. If no start time is known for the * race, but a {@link TrackedRace#getStartOfTracking start of tracking time} is known, it is used as the start of * the "live" interval. *

- * + * * If an {@link TrackedRace#getEndOfRace end time} is already known for the race, * {@link TimingConstants#IS_LIVE_GRACE_PERIOD_IN_MILLIS} is added to that and the result is taken to be the end of * the "live" period. If no end time is known but a {@link TrackedRace#getTimePointOfNewestEvent} is set, again the * {@link TimingConstants#IS_LIVE_GRACE_PERIOD_IN_MILLIS} is added to that to mark the end of the "live" interval. *

- * + * * @param at * the time point at which to determine whether the race for fleet * is/was live. A null value will use the start time of the race. @@ -223,10 +223,10 @@ public interface TrackedRace /** * Tells the number of the last started leg at timePoint * The leg number is 0 before the start, the number of the current leg during the race - * and the number of the last leg at the end of the race even if the race has finished. + * and the number of the last leg at the end of the race even if the race has finished. */ int getLastLegStarted(TimePoint timePoint); - + /** * Precondition: waypoint must still be part of {@link #getRace()}.{@link RaceDefinition#getCourse() getCourse()}. * Returns {@code null} for the first waypoint of the course. If the waypoint is not part of the course, an @@ -249,13 +249,13 @@ public interface TrackedRace * In contrast to {@link GPSFixTrack}s there is a 1:n relation of competitors to tracks by introducing track names. * So every type of track has an associated name. With this construct you can have track implementations that * provide specific functionality based on the contained fix type. - * + * * @param competitor the competitor to get the track for * @param trackName the name of the track to get * @return the track associated to the given Competitor and name or null if there is none. */ > TrackT getSensorTrack(Competitor competitor, String trackName); - + /** * Returns all contained {@link SensorFixTrack SensorFixTracks} for the given trackName and associated to any competitor. */ @@ -288,11 +288,11 @@ public interface TrackedRace int getRank(Competitor competitor) throws NoWindException; /** - * Computes the competitor's rank in this race for the provided {@link TimePoint} as A and a metric for the rank as B. - * The metric is represented by a {@link RankComparable} and enables a later comparison of the participants regardless of their fleet. + * Computes the competitor's rank in this race for the provided {@link TimePoint} as A and a metric for the rank as B. + * The metric is represented by a {@link RankComparable} and enables a later comparison of the participants regardless of their fleet. * If the race hasn't {@link #hasStarted(TimePoint) started} yet, the result is undefined. - * - * @return (0,0) in case the {@link Competitor} has not started / participated yet. + * + * @return (0,0) in case the {@link Competitor} has not started / participated yet. * A Pair (A,B) where A is the actual rank and B is a {@link RankComparable} defined by the {@link RankingMetric} . The rank starts with 1 for the winner. */ default int getRank(Competitor competitor, TimePoint timePoint) { @@ -307,7 +307,7 @@ public interface TrackedRace * comparison of the participants regardless of their fleet. If the race hasn't {@link #hasStarted(TimePoint) * started} yet, the result is undefined. Ordering competitors across fleets based on these {@link RankComparable}s * must be consistent with the ordering by rank within each of those fleets. - * + * * @return (0,0) in case the {@link Competitor} has not started / participated yet. A Pair * (A,B) where A is the actual rank and B is a {@link RankComparable} defined by the * {@link RankingMetric} . The rank starts with 1 for the winner. @@ -315,11 +315,11 @@ public interface TrackedRace Pair> getRankAndRankComparable(Competitor competitor) throws NoWindException; /** - * Computes the competitor's rank in this race for the provided {@link TimePoint} as A and a metric for the rank as B. - * The metric is represented by a {@link RankComparable} and enables a later comparison of the participants regardless of their rank. + * Computes the competitor's rank in this race for the provided {@link TimePoint} as A and a metric for the rank as B. + * The metric is represented by a {@link RankComparable} and enables a later comparison of the participants regardless of their rank. * If the race hasn't {@link #hasStarted(TimePoint) started} yet, the result is undefined. - * - * @return (0,0) in case the {@link Competitor} has not started / participated yet. + * + * @return (0,0) in case the {@link Competitor} has not started / participated yet. * A Pair (A,B) where A is the actual rank and B is a {@link RankComparable} defined by the {@link RankingMetric} . The rank starts with 1 for the winner. */ default Pair> getRankAndRankComparable(Competitor competitor, TimePoint timePoint) { @@ -333,7 +333,7 @@ public interface TrackedRace * which point in time. This can, e.g., be used to sort those competitors who already finished a leg within the leg * that ends with waypoint. The remaining competitors need to be ordered by the advantage line-related * distance to the waypoint. - * + * * @return the iterable sequence of {@link MarkPassing}s as described above. If the caller wants to iterate on the * resulting collection, the caller needs to invoke {@link #lockForRead(Iterable)} with the collection * returned as parameter because insertions into the competitor's mark passing collection will obtain the @@ -350,15 +350,15 @@ public interface TrackedRace /** * Yields the track describing mark's movement over time; never null because a new track * will be created in case no track was present for mark so far. - * + * * @see #getTrack(Mark) */ GPSFixTrack getOrCreateTrack(Mark mark); - + /** * Yields the track describing mark's movement over time; null if no track exists for * mark so far. - * + * * @see #getOrCreateTrack(Mark) */ GPSFixTrack getTrack(Mark mark); @@ -376,18 +376,18 @@ public interface TrackedRace /** * If the waypoint only has one {@link #getMarks() mark}, its position at time timePoint * is returned. Otherwise, the center of gravity between the mark positions is computed and returned. - * + * * @return {@code null} in case no position is found for any of the waypoint's marks */ default Position getApproximatePosition(Waypoint waypoint, TimePoint timePoint) { return getApproximatePosition(waypoint, timePoint, new NonCachingMarkPositionAtTimePointCache(this, timePoint)); } - + /** * Same as {@link #getApproximatePosition(Waypoint, TimePoint)}, but giving the caller the possibility to pass a * cache of mark positions and related information that can help speed up compound operations requiring frequent * access to the same marks in the same race for the same time point. - * + * * @param markPositionCache * a cache for this {@link MarkPositionAtTimePointCache#getTrackedRace() race} and the * {@link MarkPositionAtTimePointCache#getTimePoint() timePoint} passed @@ -403,12 +403,12 @@ public interface TrackedRace * {@link TrackedRaceImpl#EXTRA_LONG_TIME_BEFORE_START_TO_TRACK_WIND_MILLIS}) is used to record wind even a long * time before the race start. *

- * + * * A race does not record wind when both, {@link #getStartOfTracking()} and {@link #getStartOfRace()} are * null. Wind is not recorded when it is after the later of {@link #getEndOfRace()} and * {@link #getEndOfTracking()} and one of the two is not null. *

- * + * * This default implementation returns true which may be useful for tests and mocked implementations; however, real * implementations shall override this and provide a meaningful implementation according to the specification given * above. @@ -437,7 +437,7 @@ public interface TrackedRace * Retrieves the wind sources used so far by this race that have the specified type as their * {@link WindSource#getType() type}. Always returns a non-null iterable which may be empty in case the * race does not use any wind source of the specified type (yet).

- * + * * It is possible to ask for the {@link WindSourceType#COMBINED} and {@link WindSourceType#LEG_MIDDLE} types and * get a non-empty result although those sources are never returned by {@link #getWindSources()}. */ @@ -500,10 +500,10 @@ public interface TrackedRace * lock. */ NavigableSet getMarkPassings(Competitor competitor); - + /** * Returns competitor's mark passings. - * + * * @param waitForLatestUpdates * if any mark passing updates are pending because some calculations are currently going on and updates * haven't all been processed yet then the call will block until these updates have been processed in @@ -520,11 +520,11 @@ public interface TrackedRace * for all competitors and therefore will need to ask the write lock for those. If the thread calling this method * first obtains the mark passings read lock and later, while holding on to that lock, asks for the course's read * lock, a deadlock may result.

- * + * * Furthermore, when trying to acquire both, a lock for the {@link #getMarkPassings(Competitor) mark passings for a competitor} * and a lock for the {@link #getMarkPassingsInOrder(Waypoint) mark passings for a waypoint, this needs to happen in exactly * this order, or a deadlock may result.

- * + * * The {@link #unlockAfterRead(Iterable)} method will symmetrically unlock the course's read lock after releasing the * read lock for the mark passings. */ @@ -532,7 +532,7 @@ public interface TrackedRace /** * Releases the read lock for the mark passings and then the read lock for the course. - * + * * @see #lockForRead(Iterable) */ void unlockAfterRead(Iterable markPassings); @@ -560,15 +560,15 @@ public interface TrackedRace * angles about 90 degrees apart; similarly, for the downwind leg there should be two clusters, only that the * general jibing angle may vary more, based on the wind speed and the boat class. *

- * + * * Boats {@link GPSFixTrack#hasDirectionChange(TimePoint, double) currently maneuvering} are not considered for this * analysis. *

- * + * * This wind direction should not be used directly to compute the leg's wind direction and hence the {@link LegType * leg type} because an endless recursion may result: an implementation of this method signature will need to know * whether a leg is an upwind or downwind leg for which it has to know where the wind is coming from. - * + * * @return null if no sufficient boat track information is available or leg type identification (upwind * vs. downwind) is not possible; a valid {@link Wind} fix otherwise whose bearing is inferred from the boat * courses and whose speed in knots is currently a rough indication of how many boats' courses contributed @@ -584,11 +584,11 @@ public interface TrackedRace * {@link WindSource#TRACK_BASED_ESTIMATION} source is used, also the monitors of the competitors' GPS tracks. */ Tack getTack(Competitor competitor, TimePoint timePoint) throws NoWindException; - + /** * Based on the wind direction at timePoint and at position where, compares the * boatBearing to the wind's bearing at that time and place and determined the tack. - * + * * @throws NoWindException * in case the wind cannot be determined because without a wind direction, the tack cannot be determined * either @@ -612,7 +612,7 @@ public interface TrackedRace * Computes a default wind direction based on the direction of the first leg at time at, with a default * speed of zero knots. Note that this wind direction can only be used if {@link #raceIsKnownToStartUpwind()} returns * true. - * + * * @param at * usually the {@link #getStart() start time} should be used; if no valid start time is provided, the * current time point may serve as a default @@ -630,7 +630,7 @@ public interface TrackedRace * change grows, then from the extended window the fix with the highest COG change to its successor is returned. The * next window analysis will start after the end of the current window, avoiding duplicates in the result. *

- * + * * If the precondition that the {@code competitor} must be {@link RaceDefinition#getCompetitors() part of} the * {@link #getRace() race} isn't met, a {@code NullPointerException} will result. */ @@ -643,7 +643,7 @@ public interface TrackedRace * for the key is still ongoing, the result of that ongoing re-calculation is returned. */ Iterable getManeuvers(Competitor competitor, TimePoint from, TimePoint to, boolean waitForLatest); - + /** * @return a non-null but perhaps empty list of the maneuvers that competitor performed in * this race. Depending on waitForLatest the result is taken from the cache straight away @@ -662,13 +662,13 @@ public interface TrackedRace /** * Many calculations require valid wind data. In order to prevent NoWindException's to be handled by those * calculation this method can be used to check whether the tracked race has sufficient wind information available. - * + * * @return true if {@link #getWind(Position, TimePoint)} delivers a (not null) wind fix. */ boolean hasWindData(); /** - * + * * @return true if at least one GPS fix for one of the competitors is available for this race. */ boolean hasGPSData(); @@ -685,14 +685,14 @@ public interface TrackedRace * constructor of the {@link TrackedRace} implementation classes. This procedure guarantees that eventually the * listener will have received a notification for all wind fixes, regardless of whether they were already loaded at * the time the listener is registered or they are loaded after the registration has completed.

- * + * * The same is true for the GPS fixes for marks and competitors. */ void addListener(RaceChangeListener listener, boolean notifyAboutWindFixesAlreadyLoaded, boolean notifyAboutGPSFixesAlreadyLoaded); void removeListener(RaceChangeListener listener); - + /** * @return null if there are no mark passings for the competitor in this race * or if the competitor has not finished one of the legs in the race. @@ -725,7 +725,7 @@ public interface TrackedRace * Same as {@link #getWindwardDistanceToCompetitorFarthestAhead(Competitor, TimePoint, WindPositionMode)}, only with an * additional cache to speed up wind and leg type and leg bearing calculations in case of multiple similar look-ups * for the same time point. - * + * * @param rankingInfo * materialized ranking information that is expensive to calculate, avoiding redundant calculations */ @@ -768,7 +768,7 @@ public interface TrackedRace /** * Computes the average cross-track error for the legs with type {@link LegType#UPWIND}. - * + * * @param waitForLatestAnalysis * if true and any cache update is currently going on, wait for the update to complete and * then fetch the updated value; otherwise, serve this requests from whatever is currently in the cache @@ -781,7 +781,7 @@ public interface TrackedRace */ Distance getAverageAbsoluteCrossTrackError(Competitor competitor, TimePoint timePoint, boolean waitForLatestAnalyses, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); - + Distance getAverageAbsoluteCrossTrackError(Competitor competitor, TimePoint from, TimePoint to, boolean upwindOnly, boolean waitForLatestAnalyses); Distance getAverageSignedCrossTrackError(Competitor competitor, TimePoint timePoint, boolean waitForLatestAnalysis); @@ -801,42 +801,42 @@ public interface TrackedRace WindStore getWindStore(); Competitor getOverallLeader(TimePoint timePoint); - + Competitor getOverallLeader(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); Boat getBoatOfCompetitor(Competitor competitor); - + Competitor getCompetitorOfBoat(Boat boat); - + /** * Returns the competitors of this tracked race, according to their ranking (iteration order). Competitors whose - * {@link #getRank} is 0 will be sorted "worst". - * - * @return If no ranking can be computed for the given {@link TimePoint} an empty LinkeHashMap is returned not null. + * {@link #getRank} is 0 will be sorted "worst". + * + * @return If no ranking can be computed for the given {@link TimePoint} an empty LinkeHashMap is returned not null. */ LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint); /** * Same as {@link #getCompetitorsFromBestToWorstAndRankComparable(TimePoint)}, using a cache for wind, leg type and leg * bearing values. - * - * @return If no ranking can be computed for the given {@link TimePoint} an empty {@link LinkedHashMap} is returned not null. + * + * @return If no ranking can be computed for the given {@link TimePoint} an empty {@link LinkedHashMap} is returned not null. */ LinkedHashMap>> getCompetitorsFromBestToWorstAndRankComparable(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); - + /** * Returns the competitors of this tracked race, according to their ranking. Competitors whose * {@link #getRank(Competitor)} is 0 will be sorted "worst". - * - * @return If no ranking can be computed for the given {@link TimePoint} an {@link Iterable} with no Objects in it is returned not null. + * + * @return If no ranking can be computed for the given {@link TimePoint} an {@link Iterable} with no Objects in it is returned not null. */ Iterable getCompetitorsFromBestToWorst(TimePoint timePoint); /** * Same as {@link #getCompetitorsFromBestToWorst(TimePoint)}, using a cache for wind, leg type and leg * bearing values. - * - * @return If no ranking can be computed for the given {@link TimePoint} an {@link Iterable} with no Objects in it is returned not null. + * + * @return If no ranking can be computed for the given {@link TimePoint} an {@link Iterable} with no Objects in it is returned not null. */ Iterable getCompetitorsFromBestToWorst(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); @@ -856,7 +856,7 @@ public interface TrackedRace * fixes, until that thread is finished. */ void waitForLoadingToFinish() throws InterruptedException; - + /** * Returns the current status of the {@link TrackedRace}. This consists of one of the {@link TrackedRaceStatusEnum} * values plus a progress for LOADING state.
@@ -864,7 +864,7 @@ public interface TrackedRace * is a composite of those loader statuses. When a loader is finished, its status isn't tracked anymore. This causes * the overall progress to not be guaranteed to be monotonic (progress may jump to a lower percentage when one loader * that had a progress of 100% is finished and thus removed). - * + * * @see TrackedRaceStatus * @see DynamicTrackedRace#onStatusChanged(TrackingDataLoader, TrackedRaceStatus) */ @@ -878,16 +878,16 @@ public interface TrackedRace /** * Detaches the race log associated with this {@link TrackedRace}. - * + * * @return the race log detached or {@code null} if no race log can be found by the {@code identifier} */ RaceLog detachRaceLog(Serializable identifier); - + /** * Detaches the link {@link RaceExecutionOrderProvider} */ void detachRaceExecutionOrderProvider(RaceExecutionOrderProvider raceExecutionOrderProvider); - + /** * Attaches the passed race log with this {@link TrackedRace}. * This causes fixes from the {@link SensorFixStore} to be loaded for such {@link RegattaLogDeviceMappingEvent RegattaLogDeviceMappingEvents} @@ -899,41 +899,41 @@ public interface TrackedRace * @param raceLog to be attached. */ void attachRaceLog(RaceLog raceLog); - + /** * Attaches the passed {@link RegattaLog} with this {@link TrackedRace}. * This also causes fixes from the {@link SensorFixStore} to be loaded (see {@link #attachRaceLog(RaceLog)} for details). */ void attachRegattaLog(RegattaLog regattaLog); - + /** * @return all currently attached {@link RegattaLog}s or an empty Iterable if there aren't any */ Iterable getAttachedRegattaLogs(); - + /** * Attaches a {@link RaceExecutionOrderProvider} to make a {@link TrackedRace} aware * which races are scheduled around it in the execution order of a {@link Regatta}. * */ void attachRaceExecutionProvider(RaceExecutionOrderProvider raceExecutionOrderProvider); - + /** * Returns the attached race log event track for this race if any. * Otherwise null. */ RaceLog getRaceLog(Serializable identifier); - + /** * A setter for the listener on course design changes suggested by one of the {@link RaceLog RaceLog} attached to this * race. The listener is mostly part of the tracking provider adapter. - * + * * @param listener * the listener to operate with. */ void addCourseDesignChangedListener(CourseDesignChangedListener listener); - + void addStartTimeChangedListener(StartTimeChangedListener listener); - + void removeStartTimeChangedListener(StartTimeChangedListener listener); void addRaceAbortedListener(RaceAbortedListener listener); @@ -941,11 +941,11 @@ public interface TrackedRace /** * Tells how far the given competitor was from the start line at the time point of the given seconds before the start. *

- * + * * The distance to the line is calculated by projecting the competitor's position onto the line orthogonally and * computing the distance of the projected position and the competitor's position. *

- * + * * Should the course be empty, null is returned. If the course's first waypoint is not a line or gate, * the geometric distance between the first waypoint and the competitor's position at timePoint is * returned. If the competitor's position cannot be determined, null is returned. @@ -957,11 +957,11 @@ public interface TrackedRace * Using the {@link #getStartOfRace() race start time} for timePoint, this tells the competitor's * distance to the line when the race was started. *

- * + * * The distance to the line is calculated by projecting the competitor's position onto the line orthogonally and * computing the distance of the projected position and the competitor's position. *

- * + * * Should the course be empty, null is returned. If the course's first waypoint is not a line or gate, * the geometric distance between the first waypoint and the competitor's position at timePoint is * returned. If the competitor's position cannot be determined, null is returned. @@ -973,7 +973,7 @@ public interface TrackedRace * starts, the given competitor was from the favored end of the start line at the time point of the * given seconds before the start. *

- * + * * Should the course be empty, null is returned. If the course's first waypoint is not a line or gate, * the geometric distance between the first waypoint and the competitor's position at timePoint is * returned. If the competitor's position cannot be determined, null is returned. @@ -985,14 +985,14 @@ public interface TrackedRace * repetitive requests for wind and leg types. */ Distance getWindwardDistanceToFavoredSideOfStartLine(Competitor competitor, long millisecondsBeforeRaceStart, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache); - + /** * Tells how far, projected onto the wind for upwind/downwind and projected onto the course middle line for reaching * starts, the given competitor was from the favored end of the start line at the given * timePoint. Using the {@link #getStartOfRace() race start time} for timePoint, this * tells the competitor's distance to the line when the race was started. *

- * + * * Should the course be empty, null is returned. If the course's first waypoint is not a line or gate, * the geometric distance between the first waypoint and the competitor's position at timePoint is * returned. If the competitor's position cannot be determined, null is returned. @@ -1014,14 +1014,14 @@ public interface TrackedRace * If the competitor hasn't started yet, null is returned. */ Distance getDistanceFromStarboardSideOfStartLineWhenPassingStart(Competitor competitor); - + /** * At the given timepoint and for the competitor, this method returns the distance to the starboard end of the start line * or---if the start waypoint was a single mark---the distance to the single start mark at the timepoint. * If the competitor hasn't started yet, null is returned. */ Distance getDistanceFromStarboardSideOfStartLine(Competitor competitor, TimePoint timePoint); - + /** * At the given timepoint and for the competitor, this method returns the distance between the starboard end of the * start line and the competitor position projected perpendicularly onto the line. If the start waypoint was a @@ -1030,55 +1030,55 @@ public interface TrackedRace * hasn't started yet, null is returned. */ Distance getDistanceFromStarboardSideOfStartLineProjectedOntoLine(Competitor competitor, TimePoint timePoint); - + /** * For all competitors in this race computes their * {@link #getDistanceFromStarboardSideOfStartLineProjectedOntoLine(Competitor, TimePoint)} and puts the results in * a {@link SortedMap}, sorted by ascending values, that can be used for quick competitor look-up and for quickly * finding adjacent records, using {@link SortedMap#headMap(Object)} and {@link SortedMap#tailMap(Object)}. *

- * + * * Competitors who are part of this race but for which no such {@link Distance} can be calculated, a record is * put to the resulting map with a {@code null} value associated. Those entries are sorted to the end of the map, * meaning that "{@code null} is greater" than other values.

- * + * * Results are cached in a fixed-size LRU cache which is invalidated by competitor or mark positions within the * averaging time range of {@code timePoint}. With this, repeated requests for equal {@code timePoint}s have a good * chance of being fulfilled from a previous computation result.

- * + * * Boats are not considered in this if they are {@link MaxPointsReason#DNC DNC} or {@link MaxPointsReason#DNC DNS} * which both suggest the boat may not have made a serious attempt to start. */ SortedMap getDistancesFromStarboardSideOfStartLineProjectedOntoLine(TimePoint timePoint, BiFunction maxPointsReasonSupplier); - + /** * Based on the result of {@link #getDistancesFromStarboardSideOfStartLineProjectedOntoLine(TimePoint, Function, MaxPointsReason>)}, finds the * next competitor to port regarding their start line projection at {@code timePoint}. Returns {@code null} if * the start line cannot be determined or if there is no competitor further to port.

- * + * * Boats are not considered in this if they are {@link MaxPointsReason#DNC DNC} or {@link MaxPointsReason#DNC DNS} * which both suggest the boat may not have made a serious attempt to start. * @param maxPointsReasonSupplier TODO */ Competitor getNextCompetitorToPortOnStartLine(Competitor relativeTo, TimePoint timePoint, BiFunction maxPointsReasonSupplier); - + /** * Based on the result of {@link #getDistancesFromStarboardSideOfStartLineProjectedOntoLine(TimePoint, Function, MaxPointsReason>)}, finds the * next competitor to starboard regarding their start line projection at {@code timePoint}. Returns {@code null} if * the start line cannot be determined or if there is no competitor further to starboard.

- * + * * Boats are not considered in this if they are {@link MaxPointsReason#DNC DNC} or {@link MaxPointsReason#DNC DNS} * which both suggest the boat may not have made a serious attempt to start. * @param maxPointsReasonSupplier TODO */ Competitor getNextCompetitorToStarboardOnStartLine(Competitor relativeTo, TimePoint timePoint, BiFunction maxPointsReasonSupplier); - + /** - * The estimated speed of the competitor at the time point of the given seconds before the start of race. + * The estimated speed of the competitor at the time point of the given seconds before the start of race. */ Speed getSpeed(Competitor competitor, long millisecondsBeforeRaceStart); - + /** * The speed of the competitor when crossing the start line. It will return null if there are no recorded * mark passings for this competitor (competitor did not yet or never pass the start line). @@ -1089,37 +1089,37 @@ public interface TrackedRace * Start time received by the tracking infrastructure. To determine real start time use {@link #getStartOfRace()}. */ TimePoint getStartTimeReceived(); - + /** * @return null if the start waypoint does not have two marks or the course * is empty or the start waypoint is the only waypoint */ LineDetails getStartLine(TimePoint at); - + /** * @return null if the finish waypoint does not have two marks or the course * is empty or the finish waypoint is the only waypoint */ LineDetails getFinishLine(TimePoint at); - + /** * Length of course if there are mark passings for competitors. */ Distance getCourseLength(); - + /** * The average wind speed with confidence for this race. It uses the timepoint of the {@link #getEndOfRace race end} as * a reference point, or, if that is {@code null}, the {@link #getTimePointOfNewestEvent()}. */ SpeedWithConfidence getAverageWindSpeedWithConfidence(long resolutionInMillis); - + SpeedWithConfidence getAverageWindSpeedWithConfidenceWithNumberOfSamples(int numberOfSamples); - + /** * The average wind speed with confidence for this race. */ SpeedWithConfidence getAverageWindSpeedWithConfidence(TimePoint fromTimePoint, TimePoint toTimePoint, int numberOfSamples); - + /** * Computes the center point of the course's marks at the given time point. */ @@ -1132,13 +1132,13 @@ public interface TrackedRace * null is returned, meaning that the type is not known. */ Boolean isGateStart(); - + /** * Returns the time in milliseconds when the line was closed with lowering flag {@link Flags#GOLF} if {@link #isGateStart()} is true. - * If flag was not raised or {@link #isGateStart()} is false it returns null. + * If flag was not raised or {@link #isGateStart()} is false it returns null. */ long getGateStartGolfDownTime(); - + /** * If the race was started with a gate start (see {@link #isGateStart()}, this method returns the distance between * the competitor's starting position and the port side of the start line (pin end); otherwise, returns a zero @@ -1147,16 +1147,16 @@ public interface TrackedRace Distance getAdditionalGateStartDistance(Competitor competitor, TimePoint timePoint); boolean isUsingMarkPassingCalculator(); - + /** * Calculates the estimated time it takes a competitor to sail the race, from start to finish. - * + * * @param timepoint * Used for positions of marks and wind information; note that sometimes the marks are not in place yet * when the race starts and that a windward mark may be collected already before the race finishes. - * + * * @return estimated time it takes to complete the race, plus more useful information about how this result came about - * + * * @throws NotEnoughDataHasBeenAddedException * thrown if not enough polar data has been added or polar data service is not available * @throws NoWindException @@ -1177,14 +1177,14 @@ public interface TrackedRace /** * Calculates the estimated distance it takes a competitor to sail the race, from start to finish. - * + * * @param timepoint * Used for positions of marks and wind information; note that sometimes the marks are not in place yet * when the race starts and that a windward mark may be collected already before the race finishes. - * + * * @return estimated time it takes to complete the race, plus more useful information about how this result came * about - * + * * @throws NotEnoughDataHasBeenAddedException * thrown if not enough polar data has been added or polar data service is not available * @throws NoWindException @@ -1200,7 +1200,7 @@ public interface TrackedRace default Pair getTrackingTimesFromRaceLogs() { return null; } - + default Pair getStartAndFinishedTimeFromRaceLogs() { return null; } @@ -1214,10 +1214,10 @@ public interface TrackedRace default Iterable getMarksFromRegattaLogs() { return getMarks(); } - + /** * Updates the start and end of tracking in the following precedence order: - * + * *

    *
  1. start/end of tracking in Racelog
  2. *
  3. manually set start/end of tracking via {@link #setStartOfTrackingReceived(TimePoint, boolean)} and {@link #setEndOfTrackingReceived(TimePoint, boolean)}
  4. @@ -1225,13 +1225,13 @@ public interface TrackedRace *
*/ public void updateStartAndEndOfTracking(boolean waitForGPSFixesToLoad); - + default void lockForSerializationRead() { } - + default void unlockAfterSerializationRead() { } - + /** * @return all currently attached {@link RaceLog}s or an empty Iterable if there aren't any */ @@ -1241,13 +1241,13 @@ public interface TrackedRace * Computes the average speed over ground for a {@link Competitor} based on times and distances for all * {@link TrackedLegOfCompetitor legs} the competitor {@link TrackedLegOfCompetitor#hasStartedLeg(TimePoint) has * started} already at {@code timePoint}. - * + * * @param timePoint * time point up and until to compute the speed */ Speed getAverageSpeedOverGround(Competitor competitor, TimePoint timePoint); - + /** * Computes the competitor's speed projected onto the wind (if wind data is available and the competitor is not * between start and finish (not racing) or not on a {@link LegType#REACHING reaching} leg; if outside a race and no @@ -1267,8 +1267,8 @@ public interface TrackedRace default SpeedWithBearing getVelocityMadeGood(Competitor competitor, TimePoint timePoint, WindPositionMode windPositionMode) { return getVelocityMadeGood(competitor, timePoint, windPositionMode, new LeaderboardDTOCalculationReuseCache(timePoint)); } - - + + /** * Computes the angle between the competitors direction and the wind's "from" direction. The angle's direction is chosen such that * it can be added to the boat's course over ground to arrive at the wind's {@link Wind#getFrom() "from"} direction. Example: wind @@ -1287,7 +1287,7 @@ public interface TrackedRace } return twa; } - + /** * Same as {@link #getTWA}, only that additionally a cache is provided that can allow the method to use * cached wind and leg type values. @@ -1295,7 +1295,7 @@ public interface TrackedRace default Bearing getTWA(Competitor competitor, TimePoint at){ return getTWA(competitor, at, new LeaderboardDTOCalculationReuseCache(at)); } - + /** * Like {@link #getVelocityMadeGood(Competitor, TimePoint)}, but allowing callers to specify a cache that can * accelerate requests for wind directions, the leg type and the competitor's current leg's bearing. @@ -1341,12 +1341,12 @@ public interface TrackedRace * as a single average wind direction. */ WindSummary getWindSummary(); - + @Override default QualifiedObjectIdentifier getIdentifier() { return getIdentifier(getRaceIdentifier()); } - + public static QualifiedObjectIdentifier getIdentifier(RegattaAndRaceIdentifier regattaAndRaceId) { return getSecuredDomainType().getQualifiedObjectIdentifier(regattaAndRaceId.getTypeRelativeObjectIdentifier()); } @@ -1364,7 +1364,7 @@ public interface TrackedRace default HasPermissions getPermissionType() { return getSecuredDomainType(); } - + public static HasPermissions getSecuredDomainType() { return SecuredDomainType.TRACKED_RACE; } @@ -1375,12 +1375,12 @@ public interface TrackedRace * competitor gets for that wind speed. This way, a virtual wind speed can be calculated based on the time the * competitor actually took to complete that course. *

- * + * * For OCS PCS starting in the year 2015, an overall implied wind needs to be determined for a race, and it defaults * to the maximum implied wind across all competitors. However, this default can be overridden, and one approach is * to use the implied wind of another race. *

- * + * * This method delegates to the {@link #getRankingMetric()} to determine this implied wind. Any non-ORC ranking * metric would be an unusual choice for such a set-up, but it should respond with the average wind speed during the * race (the combined wind). The ORC ranking metrics are expected to deliver their implied wind, either by taking @@ -1390,9 +1390,9 @@ public interface TrackedRace default Speed getReferenceImpliedWind(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return getRankingMetric().getReferenceImpliedWind(timePoint, cache); } - + /** - * gets a {@link TrackingConnectorInfo}, which contains a String representation of the Tracking-Service used to Track the Race and a web-URL for the Event Event; + * gets a {@link TrackingConnectorInfo}, which contains a String representation of the Tracking-Service used to Track the Race and a web-URL for the Event Event; * may be {@code null}, particularly in test set-ups */ TrackingConnectorInfo getTrackingConnectorInfo(); @@ -1403,11 +1403,11 @@ public interface TrackedRace * {@link #addListener(RaceChangeListener) added} to this race, observing the race status and calling * {@code runnable} when the race has finished loading. *

- * + * * A race is considered to have finished loading when it is not in either of the states * {@link TrackedRaceStatusEnum#PREPARED}, {@link TrackedRaceStatusEnum#LOADING}, or * {@link TrackedRaceStatusEnum#ERROR}. - * + * * @param runnable * must not be {@code null} */ diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java index 75a9cfc0260..515d236758b 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java @@ -196,11 +196,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl private static final long DELAY_FOR_CACHE_CLEARING_IN_MILLISECONDS = 7500; public static final Duration TIME_BEFORE_START_TO_TRACK_WIND_MILLIS = Duration.ONE_MINUTE.times(4); // let wind start four minutes before race - + public static final Duration EXTRA_LONG_TIME_BEFORE_START_TO_TRACK_WIND_MILLIS = Duration.ONE_HOUR; private TrackedRaceStatus status; - + private final TrackingConnectorInfo trackingConnectorInfo; private final Object statusNotifier; @@ -238,19 +238,19 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * Race start time as announced by the tracking infrastructure */ private TimePoint startTimeReceived; - + /** * The calculated race start time */ private TimePoint startTime; - + /** * Maintained in lock-step with {@link #startTime}, only that {@code null} will be contained if {@link #startTime} * was only inferred from start mark passings and no other, more official, information such as * {@link #getStartTimeReceived()} or a start time coming from an attached {@link RaceLog}. */ private TimePoint startTimeWithoutInferenceFromStartMarkPassings; - + /** * The calculated race end time */ @@ -290,7 +290,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * Limit for the cache size in {@link #competitorRankings} and respectively in {@link #competitorRankingsLocks}. */ private static final int MAX_COMPETITOR_RANKINGS_CACHE_SIZE = 10; - + private transient LinkedHashMap> competitorRankings; /** @@ -321,18 +321,18 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * them. */ private transient SmartFutureCache, EmptyUpdateInterval> maneuverCache; - + /** * The values of this map are used by the {@link #approximate(Competitor, Distance, TimePoint, TimePoint)} method and * maintain state to accelerate the {@link #approximate(Competitor, Distance, TimePoint, TimePoint)} method, also in * live scenarios when the contents of the competitors' {@link #tracks} changes dynamically. */ private final Map maneuverApproximators; - + private transient ConcurrentMap> directionFromStartToNextMarkCache; protected transient MarkPassingCalculator markPassingCalculator; - + private final ConcurrentMap> markTracks; /** @@ -341,7 +341,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * used. This identifier is usually defined within the track interface (e.g. see {@link BravoFixTrack#TRACK_NAME}). */ private final Map, DynamicSensorFixTrack> sensorTracks; - + private final Map courseSidelines; protected long millisecondsOverWhichToAverageSpeed; @@ -350,12 +350,12 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl private transient Timer cacheInvalidationTimer; private transient Object cacheInvalidationTimerLock; - + /** * handled by {@link #suspendAllCachesNotUpdatingWhileLoading()} and {@link #resumeAllCachesNotUpdatingWhileLoading()}. */ private boolean cachesSuspended; - + /** * Whether during {@link #cachesSuspended suspended caches mode} the maneuver re-calculation was triggered; will lead * to triggering the maneuver re-calculation when caches are {@link #resumeAllCachesNotUpdatingWhileLoading() resumed}. @@ -366,7 +366,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * Keys are the {@link RaceLog#getId() IDs} of the race logs that are stored as values. */ protected transient ConcurrentMap attachedRaceLogs; - + /** * Holds optional race states for the race logs in {@link #attachedRaceLogs}. By using a {@link WeakHashMap}, * these race states can be garbage-collected when the race log is no longer attached. The race states are created @@ -378,7 +378,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * Keys are the {@link RegattaLog#getId() IDs} of the regatta logs that are stored as values. */ protected transient ConcurrentMap attachedRegattaLogs; - + private transient ConcurrentMap attachedRaceExecutionOrderProviders; /** @@ -387,7 +387,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl private long delayToLiveInMillis; private enum LoadingFromStoresState { NOT_STARTED, RUNNING, FINISHED }; - + /** * The constructor loads wind fixes from the {@link #windStore} asynchronously. * When completed all threads currently waiting on this object are notified. @@ -395,21 +395,21 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl private LoadingFromStoresState loadingFromWindStoreState = LoadingFromStoresState.NOT_STARTED; private transient CrossTrackErrorCache crossTrackErrorCache; - + /** * Wind and loading is started in a background thread during object construction. If a client needs to * ensure that wind loading either has terminated or has not yet begun, it can obtain the read lock of * this lock. The wind loading procedure will obtain the write lock before it starts loading wind fixes. */ private final NamedReentrantReadWriteLock loadingFromWindStoreLock; - + /** * @see #loadingFromWindStoreLock but for GPSFixStore */ private final NamedReentrantReadWriteLock loadingFromGPSFixStoreLock; private final ConcurrentMap>, NamedReentrantReadWriteLock> locksForMarkPassings; - + /** * Caches wind requests for a few seconds to accelerate access in live mode */ @@ -430,7 +430,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * certificate. */ private final RankingMetric rankingMetric; - + /** * Required in particular to resolve {@link SimpleRaceLogIdentifier}s that appear in * {@link RaceLogDependentStartTimeEvent}s. The usual implementation on the server side is @@ -438,19 +438,19 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * must be established again after de-serialization by invoking {@link #setRaceLogResolver}. */ private transient RaceLogAndTrackedRaceResolver raceLogResolver; - + private final NamedReentrantReadWriteLock sensorTracksLock; - + private static final int MAX_DISTANCES_FROM_STARBOARD_SIDE_OF_START_LINE_PROJECTED_ONTO_LINE_CACHE_SIZE = 10; private transient ConcurrentMap> distancesFromStarboardSideOfStartLineProjectedOntoLineCache; private transient ConcurrentMap distancesFromStarboardSideOfStartLineProjectedOntoLineCacheLastAccessTimes; - + /** * When a regatta's {@link Regatta#useStartTimeInference()} or {@link Regatta#isControlTrackingFromStartAndFinishTimes()} * changes, the tracking start/end times need to be recalculated. This regatta listener handles this. It has to be * added to the tracked race's underlying regatta at construction time and after de-serialization (regatta listeners * are transient and are not serialized together with the regatta). - * + * * @author Axel Uhl (D043530) * */ @@ -466,7 +466,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl updateStartAndEndOfTracking(/* waitForGPSFixesToLoad */ false); } } - + /** * Constructs the tracked race with one-design ranking. */ @@ -478,7 +478,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl millisecondsOverWhichToAverageSpeed, delayForWindEstimationCacheInvalidation, useInternalMarkPassingAlgorithm, OneDesignRankingMetric::new, raceLogResolver, trackingConnectorInfo); } - + /** * Constructs the tracked race with a configurable ranking metric. * @param rankingMetricConstructor @@ -635,7 +635,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } rankingMetric = rankingMetricConstructor.apply(this); } - + protected void invalidateDistancesFromStarboardSideOfStartLineProjectedOntoLineCache(TimeRange timeRangeToInvalidate) { if (!distancesFromStarboardSideOfStartLineProjectedOntoLineCache.isEmpty()) { for (final Iterator>> i=distancesFromStarboardSideOfStartLineProjectedOntoLineCache.entrySet().iterator(); i.hasNext(); ) { @@ -675,7 +675,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public RankingMetric getRankingMetric() { return rankingMetric; } - + private LinkedHashMap createCompetitorRankingsLockMap() { return new LinkedHashMap() { private static final long serialVersionUID = 6298801656693955386L; @@ -774,7 +774,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * atomically serialized, inconsistencies may occur during de-serialization. In particular, the tracked race's leg-oriented * structures may not consistently reflect the course's leg sequence because a course update could have happened between * course serialization and tracked race serialization.

- * + * * To fix this, the list of waypoints as found in this tracked race's leg-oriented structures, compared to the course's * waypoint list, produces a patch that can be applied to this tracked race, resulting in the necessary * {@link #waypointAdded(int, Waypoint)} and {@link #waypointRemoved(int, Waypoint)} calls. @@ -799,13 +799,13 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl @Override public synchronized void waitForLoadingToFinish() throws InterruptedException { } - + public void waitForManeuverDetectionToFinish() { for (Competitor competitor : getRace().getCompetitors()) { getManeuvers(competitor, true); } } - + private ShortTimeAfterLastHitCache createManeuverDetectorCache() { return new ShortTimeAfterLastHitCache( /* preserve how many milliseconds */ 600000, @@ -835,7 +835,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } }, /* nameForLocks */ "Maneuver cache for race " + getRace().getName()); } - + /** * Precondition: race has already been set, e.g., in constructor before this method is called */ @@ -849,7 +849,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public NavigableSet getMarkPassings(Competitor competitor) { return getMarkPassings(competitor, /* waitForLatestUpdates */ false); } - + @Override public NavigableSet getMarkPassings(Competitor competitor, boolean waitForLatestUpdates) { if (waitForLatestUpdates && markPassingCalculator != null) { @@ -902,15 +902,15 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public TimePoint getStartOfTracking() { return startOfTracking; } - + /** * Monitor object to synchronize access to the {@link #updateStartAndEndOfTracking(boolean)} method. See bug 3922. */ private final Serializable updateStartAndEndOfTrackingMonitor = ""+new Random().nextDouble(); - + /** * Updates the start and end of tracking in the following precedence order: - * + * *

    *
  1. start/end of tracking in Racelog
  2. *
  3. manually set start/end of tracking via {@link #setStartOfTrackingReceived(TimePoint, boolean)} and {@link #setEndOfTrackingReceived(TimePoint, boolean)}
  4. @@ -991,7 +991,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } updateStartAndEndOfTracking(/* waitForGPSFixesToLoad */ false); } - + /** * The race log supports the event types {@link RaceLogStartOfTrackingEvent} and * {@link RaceLogEndOfTrackingEvent}. These are to take precedence over any other start/end of @@ -1012,10 +1012,10 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return null; } - + @Override public Pair getStartAndFinishedTimeFromRaceLogs() { - //Only one of the RaceLogs should have valid data, so one doesn't have to compare all the + //Only one of the RaceLogs should have valid data, so one doesn't have to compare all the //start/finished time values in order to find the earliest startTime/latestFinishedTime for (final RaceLog raceLog : attachedRaceLogs.values()) { TimePoint startTime = new StartTimeFinder(raceLogResolver, raceLog).analyze().getStartTime(); @@ -1024,7 +1024,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl return new Util.Pair(startTime, finishedTime); } } - return null; + return null; } /** @@ -1142,11 +1142,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public TimePoint getFinishedTime() { return finishedTime; } - + protected void setFinishedTime(final TimePoint newFinishedTime) { finishedTime = newFinishedTime; } - + private TimePoint getLastPassingOfFinishLine() { TimePoint passingTime = null; final Waypoint lastWaypoint = getRace().getCourse().getLastWaypoint(); @@ -1356,9 +1356,9 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public Distance getDistanceTraveled(Competitor competitor, TimePoint timePoint) { return getDistanceTraveled(competitor, timePoint, /* consider gate start */ false); } - + private Distance getDistanceTraveled(Competitor competitor, TimePoint timePoint, boolean considerGateStart) { - return getValueFromStartToTimePointOrEnd(competitor, timePoint, + return getValueFromStartToTimePointOrEnd(competitor, timePoint, (from, to)->{ final Distance result; final Distance preResult = getTrack(competitor).getDistanceTraveled(from, to); @@ -1370,7 +1370,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl return result; }); } - + @Override public Distance getDistanceFoiled(Competitor competitor, TimePoint timePoint) { return getBravoValue(competitor, timePoint, BravoFixTrack::getDistanceSpentFoiling); @@ -1380,14 +1380,14 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public Duration getDurationFoiled(Competitor competitor, TimePoint timePoint) { return getBravoValue(competitor, timePoint, BravoFixTrack::getTimeSpentFoiling); } - + @FunctionalInterface private static interface BravoFromToValueCalculator { T getValue(BravoFixTrack bravoFixTrack, TimePoint from, TimePoint to); } private T getBravoValue(Competitor competitor, TimePoint timePoint, BravoFromToValueCalculator bravoValueCalculator) { - return getValueFromStartToTimePointOrEnd(competitor, timePoint, + return getValueFromStartToTimePointOrEnd(competitor, timePoint, (from, to)->{ final T result; final BravoFixTrack bravoFixTrack = getSensorTrack(competitor, BravoFixTrack.TRACK_NAME); @@ -1565,7 +1565,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public Competitor getOverallLeader(TimePoint timePoint) { return getOverallLeader(timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + @Override public Competitor getOverallLeader(TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { Competitor result = null; @@ -1580,12 +1580,12 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public int getRank(Competitor competitor, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return getRankAndRankComparable(competitor, timePoint, cache).getA(); } - + @Override public Pair> getRankAndRankComparable(Competitor competitor){ return getRankAndRankComparable(competitor, MillisecondsTimePoint.now()); } - + @Override public Pair> getRankAndRankComparable(Competitor competitor, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache){ final Pair> result; @@ -1603,20 +1603,20 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl if (hasNoMarkPassingAtOrBeforeTimePoint) { // no mark passing at or before timePoint; competitor has not started / participated yet result = new Pair<>(0, new RankComparableRank(0)); - } else { - // A new Pair must be created because pairs can not be changed. - Pair> rankingInfo = getCompetitorsFromBestToWorstAndRankComparable(timePoint, cache).get(competitor); + } else { + // A new Pair must be created because pairs can not be changed. + Pair> rankingInfo = getCompetitorsFromBestToWorstAndRankComparable(timePoint, cache).get(competitor); result = new Pair>(rankingInfo.getA() + 1, rankingInfo.getB()); } } - return result; + return result; } @Override public Boat getBoatOfCompetitor(Competitor competitor) { return getRace().getBoatOfCompetitor(competitor); } - + @Override public Competitor getCompetitorOfBoat(Boat boat) { if (boat == null) { @@ -1629,7 +1629,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return null; } - + @Override public Iterable getCompetitorsFromBestToWorst(TimePoint timePoint) { return getCompetitorsFromBestToWorst(timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); @@ -1697,10 +1697,10 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl LockUtil.unlockAfterWrite(readWriteLock); } } - final Iterator it = rankedCompetitors.iterator(); - final LinkedHashMap>> temp = new LinkedHashMap>>(); + final Iterator it = rankedCompetitors.iterator(); + final LinkedHashMap>> temp = new LinkedHashMap>>(); for (int i = 0; it.hasNext(); i++) { - temp.put(it.next(), new Pair<>(i, new RankComparableRank(i))); + temp.put(it.next(), new Pair<>(i, new RankComparableRank(i))); } return temp; } @@ -1709,7 +1709,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public Distance getAverageAbsoluteCrossTrackError(Competitor competitor, TimePoint timePoint, boolean waitForLatestAnalysis) { return getAverageAbsoluteCrossTrackError(competitor, timePoint, waitForLatestAnalysis, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + @Override public Distance getAverageAbsoluteCrossTrackError(Competitor competitor, TimePoint timePoint, boolean waitForLatestAnalysis, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { @@ -1767,7 +1767,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } @Override - public Distance getAverageSignedCrossTrackError(Competitor competitor, TimePoint from, TimePoint to, boolean upwindOnly, boolean waitForLatestAnalysis) { + public Distance getAverageSignedCrossTrackError(Competitor competitor, TimePoint from, TimePoint to, boolean upwindOnly, boolean waitForLatestAnalysis) { Distance result; result = crossTrackErrorCache.getAverageSignedCrossTrackError(competitor, from, to, upwindOnly, waitForLatestAnalysis); return result; @@ -1792,7 +1792,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl @Override public TrackedLegOfCompetitor getCurrentLeg(Competitor competitor, TimePoint timePoint) { // If the mark passing that starts a leg happened exactly at timePoint, the MarkPassingByTimeComparator won't consider - // them equal because + // them equal because NavigableSet competitorMarkPassings = markPassingsForCompetitor.get(competitor); DummyMarkPassingWithTimePointAndCompetitor markPassingTimePoint = new DummyMarkPassingWithTimePointAndCompetitor(timePoint, competitor); TrackedLegOfCompetitor result = null; @@ -1857,11 +1857,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } } if(indexOfLastWaypointPassed >= 0) { - result = indexOfLastWaypointPassed+1 < legCount ? indexOfLastWaypointPassed+1 : legCount; + result = indexOfLastWaypointPassed+1 < legCount ? indexOfLastWaypointPassed+1 : legCount; } return result; } - + @Override public MarkPassing getMarkPassing(Competitor competitor, Waypoint waypoint) { final Iterable markPassings = getMarkPassingsInOrder(waypoint); @@ -1892,12 +1892,12 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public GPSFixTrack getOrCreateTrack(Mark mark) { return getOrCreateTrack(mark, true); } - + @Override public GPSFixTrack getTrack(Mark mark) { return getOrCreateTrack(mark, false); } - + private GPSFixTrack getOrCreateTrack(Mark mark, boolean createIfNotExistent) { GPSFixTrack result = markTracks.get(mark); if (result == null) { @@ -1969,7 +1969,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * for wind recording. If, based on a {@link RaceExecutionOrderProvider}, there is no previous race that takes the * wind fix, an extended time range lead (see {@link TrackedRaceImpl#EXTRA_LONG_TIME_BEFORE_START_TO_TRACK_WIND_MILLIS}) * is used to record wind even a long time before the race start.

    - * + * * A race does not record wind when both, {@link #getStartOfTracking()} and {@link #getStartOfRace()} are null. * Wind is not recorded when it is after the later of {@link #getEndOfRace()} and {@link #getEndOfTracking()} and one of the * two is not null. @@ -1980,7 +1980,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl visited.add(this); return takesWindFixWithTimePointRecursively(timePoint, visited); } - + /** * @param visited * used to avoid endless recursion if cyclic predecessor relations are delivered by a @@ -2020,7 +2020,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + private boolean noPreviousRaceTakesWindFixWithTimePoint(TimePoint timePoint, Set visited) { final boolean result; Set previousRacesInExecutionOrder = getPreviousRacesFromAttachedRaceExecutionOrderProviders(); @@ -2080,13 +2080,13 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl .getWindWithConfidence(position, roundToDuration(at, Duration.ONE_SECOND), windSourcesToExclude); return windWithConfidence; } - + private TimePoint roundToDuration(TimePoint t, Duration roundTo) { final long roundToMillis = roundTo.asMillis(); final long half = roundToMillis/2; return new MillisecondsTimePoint((t.asMillis()+half) / roundToMillis * roundToMillis); } - + public WindWithConfidence> getWindWithConfidenceUncached(Position p, TimePoint at, Iterable windSourcesToExclude) { boolean canUseSpeedOfAtLeastOneWindSource = false; @@ -2212,7 +2212,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl this.startOfTrackingReceived = startOfTracking; updateStartAndEndOfTracking(waitForGPSFixesToLoad); } - + protected void startOfTrackingChanged(final TimePoint oldStartOfTracking, boolean waitForGPSFixesToLoad) { } @@ -2220,7 +2220,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl this.endOfTrackingReceived = endOfTracking; updateStartAndEndOfTracking(waitForGPSFixesToLoad); } - + protected void endOfTrackingChanged(final TimePoint oldEndOfTracking, boolean waitForGPSFixesToLoad) { } @@ -2481,11 +2481,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * to be more precise). The derivative at {@code numberOfBoatsInSmallestCluster==1} is 0.1 (so as if it was doubling * on its way from one to two boats). Modeling this as the function {@code f(n) := 1 + b/(n+c)} we get a solution * for b and c such that {@code c=8} and {@code b = -0.9-0.9*c = -0.9-7.2 = -8.1} and hence - * + * *

          *     f(n) := 1 - 8.1/(n+8)
          * 
    - * + * * @param numberOfBoatsInSmallestCluster * must not be less than 1 */ @@ -2729,28 +2729,28 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl /** * This is probably best explained by example. If the wind bearing is from port to starboard, the situation looks * like this: - * + * *
          *                                 ^
          *                 Wind            | Boat
          *               ----------->      |
          *                                 |
    -     * 
    +     *
          * 
    - * + * * In this case, the boat gets the wind from port, so the result has to be {@link Tack#PORT}. The angle between the * boat's heading (which we can only approximate by the boat's course over ground) and the wind bearing in this case * is 90 degrees. wind.{@link Bearing#getDifferenceTo(Bearing) getDifferenceTo}(boat) in this case will * return a bearing representing -90 degrees. *

    - * + * * If the wind is blowing the other way, the angle returned by {@link Bearing#getDifferenceTo(Bearing)} will * correspond to +90 degrees. In other words, a negative angle means starboard tack, a positive angle represents * port tack. *

    - * + * * For the unlikely case of 0 degrees difference, {@link Tack#STARBOARD} will result. - * + * * @return null in case the boat's bearing cannot be determined for timePoint * @throws NoWindException */ @@ -2768,28 +2768,28 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl /** * This is probably best explained by example. If the wind bearing is from port to starboard, the situation looks * like this: - * + * *

          *                                 ^
          *                 Wind            | Boat
          *               ----------->      |
          *                                 |
    -     * 
    +     *
          * 
    - * + * * In this case, the boat gets the wind from port, so the result has to be {@link Tack#PORT}. The angle between the * boat's heading (which we can only approximate by the boat's course over ground) and the wind bearing in this case * is 90 degrees. wind.{@link Bearing#getDifferenceTo(Bearing) getDifferenceTo}(boat) in this case will * return a bearing representing -90 degrees. *

    - * + * * If the wind is blowing the other way, the angle returned by {@link Bearing#getDifferenceTo(Bearing)} will * correspond to +90 degrees. In other words, a negative angle means starboard tack, a positive angle represents * port tack. *

    - * + * * For the unlikely case of 0 degrees difference, {@link Tack#STARBOARD} will result. - * + * * @return null in case the boat's bearing cannot be determined for timePoint */ @Override @@ -2865,14 +2865,14 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl + (System.currentTimeMillis() - startedAt) + "ms"); return result; } - + /** * Fetches results from {@link #maneuverCache}. The cache is updated asynchronously after relevant updates have been * received (see {@link #triggerManeuverCacheRecalculation(Competitor)} and * {@link #triggerManeuverCacheRecalculationForAllCompetitors()}). Callers can choose whether to wait for any * ongoing updates by using the waitForLatest parameter. From the cache the interval requested is then * {@link #extractInterval(TimePoint, TimePoint, List) extracted}. - * + * * @param waitForLatest * if true, any currently ongoing maneuver recalculation for competitor is * waited for before returning the result; otherwise, whatever is in the {@link #maneuverCache} for @@ -2889,7 +2889,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public Iterable getManeuvers(Competitor competitor, boolean waitForLatest) { List allManeuvers = maneuverCache.get(competitor, waitForLatest); @@ -2926,7 +2926,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl result = usePolarsIfPossible(wind, defaultAngle, LegType.DOWNWIND, threshold); return result; } - + private Pair getMinimumAngleBetweenDifferentTacksUpwind(Wind wind) { Pair result; double defaultAngle = getRace().getBoatClass().getMinimumAngleBetweenDifferentTacksUpwind(); @@ -3034,7 +3034,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl protected Object getStatusNotifier() { return statusNotifier; } - + @Override public void runSynchronizedOnStatus(Runnable runnable) { synchronized (getStatusNotifier()) { @@ -3108,7 +3108,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } } } - + @Override public boolean hasFinishedLoading() { synchronized (getStatusNotifier()) { @@ -3116,11 +3116,11 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl return hasFinishedLoading(status); } } - + private boolean hasFinishedLoading(TrackedRaceStatusEnum status) { return (status != TrackedRaceStatusEnum.PREPARED && status != TrackedRaceStatusEnum.LOADING && status != TrackedRaceStatusEnum.ERROR); } - + @Override public void runWhenDoneLoading(final Runnable runnable) { synchronized (getStatusNotifier()) { @@ -3141,7 +3141,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } } } - + @Override public void attachRaceLog(RaceLog raceLog) { synchronized (TrackedRaceImpl.this) { @@ -3168,14 +3168,14 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public void detachRaceExecutionOrderProvider(RaceExecutionOrderProvider raceExecutionOrderProvider) { if (raceExecutionOrderProvider != null) { attachedRaceExecutionOrderProviders.remove(raceExecutionOrderProvider); } } - + public boolean hasRaceExecutionOrderProvidersAttached(){ return !attachedRaceExecutionOrderProviders.isEmpty(); } @@ -3191,7 +3191,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public void attachRegattaLog(RegattaLog regattaLog) { LockUtil.lockForRead(getSerializationLock()); @@ -3206,7 +3206,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl LockUtil.unlockAfterRead(getSerializationLock()); updateStartAndEndOfTracking(/* waitForGPSFixesToLoad */ false); } - + @Override public Iterable getAttachedRegattaLogs() { return attachedRegattaLogs == null ? Collections.emptySet() : new HashSet<>(attachedRegattaLogs.values()); @@ -3225,7 +3225,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public RaceLog getRaceLog(Serializable identifier) { return attachedRaceLogs.get(identifier); } - + @Override public Distance getDistanceToStartLine(Competitor competitor, long millisecondsBeforeRaceStart) { return getSomethingMillisecondsBeforeRaceStart(competitor, millisecondsBeforeRaceStart, this::getDistanceToStartLine); @@ -3297,28 +3297,28 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + private T getSomethingMillisecondsBeforeRaceStart(Competitor competitor, long millisecondsBeforeRaceStart, BiFunction dataSupplier) { final TimePoint timePoint = getTimePointMillisecondsBeforeStart(millisecondsBeforeRaceStart); final T result = timePoint == null ? null : dataSupplier.apply(competitor, timePoint); return result; } - + @Override public Distance getWindwardDistanceToFavoredSideOfStartLine(Competitor competitor, long millisecondsBeforeRaceStart) { return getSomethingMillisecondsBeforeRaceStart(competitor, millisecondsBeforeRaceStart, this::getWindwardDistanceToFavoredSideOfStartLine); } - + @Override public Distance getWindwardDistanceToFavoredSideOfStartLine(Competitor competitor, long millisecondsBeforeRaceStart, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { return getSomethingMillisecondsBeforeRaceStart(competitor, millisecondsBeforeRaceStart, (c, t)->getWindwardDistanceToFavoredSideOfStartLine(c, t, cache)); } - + @Override public Distance getWindwardDistanceToFavoredSideOfStartLine(Competitor competitor, TimePoint timePoint) { return getWindwardDistanceToFavoredSideOfStartLine(competitor, timePoint, new LeaderboardDTOCalculationReuseCache(timePoint)); } - + @Override public Distance getWindwardDistanceToFavoredSideOfStartLine(Competitor competitor, TimePoint timePoint, WindLegTypeAndLegBearingAndORCPerformanceCurveCache cache) { final Waypoint startWaypoint = getRace().getCourse().getFirstWaypoint(); @@ -3405,7 +3405,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public Distance getDistanceFromStarboardSideOfStartLineProjectedOntoLine(Competitor competitor, TimePoint timePoint) { final Distance result; @@ -3527,7 +3527,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl * line is on starboard. If the start waypoint has only one mark, that mark is returned. If the start line has two * marks but the course has no other waypoint, * null is returned. If the course has no waypoints at all, null is returned.

    - * + * * The method has protected visibility largely for testing purposes. */ protected Mark getStarboardMarkOfStartlineOrSingleStartMark(TimePoint at) { @@ -3571,7 +3571,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public NamedReentrantReadWriteLock getLoadingFromGPSFixStoreLock() { return loadingFromGPSFixStoreLock; } - + private static class LineMarksWithPositions { private final Position portMarkPositionWhileApproachingLine; private final Position starboardMarkPositionWhileApproachingLine; @@ -3598,7 +3598,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl return portMarkWhileApproachingLine; } } - + /** * If the waypoint is not a line, or no position can be determined for one of its marks at timePoint, * null is returned. If no wind information is available but required to compute the advantage, null values @@ -3760,7 +3760,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public SpeedWithConfidence getAverageWindSpeedWithConfidenceWithNumberOfSamples(int numberOfFixes) { final TimePoint fromTimePoint = getStartOfRace()==null?getStartOfTracking():getStartOfRace(); @@ -3773,7 +3773,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public SpeedWithConfidence getAverageWindSpeedWithConfidence(TimePoint fromTimePoint, TimePoint toTimePoint, int numberOfFixes) { SpeedWithConfidence result = null; @@ -3804,7 +3804,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl double averageWindSpeedConfidence = sumWindSpeedConfidence / speedCounter; result = new SpeedWithConfidenceImpl(averageWindSpeed, averageWindSpeedConfidence, toTimePoint); } - } + } return result; } @@ -3816,7 +3816,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return d; } - + @Override public Speed getSpeedWhenCrossingStartLine(Competitor competitor) { NavigableSet competitorMarkPassings = getMarkPassings(competitor); @@ -3833,9 +3833,9 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return competitorSpeedWhenPassingStart; } - + protected abstract MarkPassingCalculator createMarkPassingCalculator(); - + @Override public boolean isUsingMarkPassingCalculator() { return markPassingCalculator!=null; @@ -3905,7 +3905,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public long getGateStartGolfDownTime() { long result = 0; @@ -3949,7 +3949,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public TargetTimeInfo getEstimatedTimeToComplete(final TimePoint timepoint) throws NotEnoughDataHasBeenAddedException, NoWindException { @@ -3968,7 +3968,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return new TargetTimeInfoImpl(legTargetTimes); } - + @Override public Duration getTimeSailedSinceRaceStart(Competitor competitor, TimePoint timePoint) { return getRankingMetric().getActualTimeSinceStartOfRace(competitor, timePoint); @@ -4003,7 +4003,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl updateManeuversAndWindWithNewWindEstimation(windEstimation, windEstimation); } } - + @Override public void setWindEstimation(IncrementalWindEstimation windEstimation) { IncrementalWindEstimation previousWindEstimation = this.windEstimation; @@ -4049,7 +4049,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl this.raceLogResolver = domainFactory.getRaceLogResolver(); return this; } - + /** * Regatta listeners are transient only; so after de-serialization we have to re-establish the regatta listener * that is responsible for updating tracking times when the rules for how this works have changed on the regatta. @@ -4057,7 +4057,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public void registerRegattaListener() { trackedRegatta.getRegatta().addRegattaListener(new TimingUpdaterCallback()); } - + @Override public Iterable getMarksFromRegattaLogs() { final Set result = new HashSet<>(); @@ -4066,7 +4066,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + public > TrackT getSensorTrack( Competitor competitor, String trackName) { Pair key = new Pair<>(competitor, trackName); @@ -4077,7 +4077,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl LockUtil.unlockAfterRead(sensorTracksLock); } } - + @Override public > Iterable getSensorTracks( String trackName) { @@ -4113,7 +4113,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl executeAfterReleasingLock.ifPresent(r->r.run()); return result; } - + protected void addSensorTrack(Competitor competitor, String trackName, DynamicSensorFixTrack track) { Pair key = new Pair<>(competitor, trackName); Optional executeAfterReleasingLock = Optional.empty(); @@ -4132,7 +4132,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } executeAfterReleasingLock.ifPresent(r->r.run()); } - + /** * To call this method, the caller must have obtained the write lock of {@link #sensorTracksLock}. * Optionally, the method may return a {@link Runnable} to execute after the lock has been released. @@ -4151,7 +4151,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl private > TrackT getTrackInternal(Pair key) { return (TrackT) sensorTracks.get(key); } - + protected abstract Set getListeners(); protected void notifyListeners(Consumer notifyAction) { @@ -4168,15 +4168,15 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } } } - + private void notifyListenersWhenAttachingRegattaLog(RegattaLog regattaLog) { notifyListeners(listener -> listener.regattaLogAttached(regattaLog)); } - + private void notifyListenersWhenAttachingRaceLog(RaceLog raceLog) { notifyListeners(listener -> listener.raceLogAttached(raceLog)); } - + private void notifyListenersWhenDetachingRaceLog(RaceLog raceLog) { notifyListeners(listener -> listener.raceLogDetached(raceLog)); } @@ -4184,16 +4184,16 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl public void lockForSerializationRead() { LockUtil.lockForRead(getSerializationLock()); } - + public void unlockAfterSerializationRead() { LockUtil.unlockAfterRead(getSerializationLock()); } - + @Override public Iterable getAttachedRaceLogs() { return attachedRaceLogs == null ? Collections.emptySet() : new HashSet<>(attachedRaceLogs.values()); } - + @Override public Speed getAverageSpeedOverGround(Competitor competitor, TimePoint timePoint) { Speed result = null; @@ -4211,7 +4211,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public SpeedWithBearing getVelocityMadeGood(Competitor competitor, TimePoint timePoint, @@ -4231,7 +4231,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + SpeedWithBearing projectOnto(SpeedWithBearing speed, Bearing projectToBearing) { final SpeedWithBearing result; if (speed != null && speed.getBearing() != null && projectToBearing != null) { @@ -4245,7 +4245,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + /** * @param trackedLeg * The caller is expected to obtain the {@link #getTrackedLeg(Competitor, TimePoint) tracked leg} the @@ -4259,19 +4259,19 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl if (windPositionMode == WindPositionMode.EXACT) { wind = cache.getWind(this, competitor, at); } else { - wind = getWind(trackedLeg == null ? null : + wind = getWind(trackedLeg == null ? null : trackedLeg.getEffectiveWindPosition( () -> getTrack(competitor) .getEstimatedPosition(at, false), at, windPositionMode), at); } return wind; } - + @Override public PolarDataService getPolarDataService() { return polarDataService; } - + @Override public WindSummary getWindSummary() { Speed minTrueWindSpeed = null; @@ -4298,7 +4298,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl final TimePoint middleOfRace = getStartOfRace().plus(getStartOfRace().until(toTimePoint).divide(2)); List pointsToGetWind = Arrays.asList(getStartOfRace(), middleOfRace, toTimePoint); for (TimePoint timePoint : pointsToGetWind) { - WindWithConfidence> averagedWindWithConfidence = + WindWithConfidence> averagedWindWithConfidence = getWindWithConfidence(getCenterOfCourse(timePoint), timePoint); final WindWithConfidence> windFixToUse; if (averagedWindWithConfidence != null && averagedWindWithConfidence.getObject().getKnots() >= 0.05d) { @@ -4327,7 +4327,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl } return result; } - + @Override public TrackingConnectorInfo getTrackingConnectorInfo() { return trackingConnectorInfo; diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/util/impl/RaceColumnListeners.java b/java/com.sap.sailing.domain/src/com/sap/sailing/util/impl/RaceColumnListeners.java index 7aafc339241..7371f62c466 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/util/impl/RaceColumnListeners.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/util/impl/RaceColumnListeners.java @@ -20,7 +20,7 @@ import com.sap.sailing.domain.tracking.TrackedRace; /** * Manages a set of {@link RaceColumnListener}s with the usual add/remove and notification logic. It is {@link Serializable} * and serializes only those listeners that are not {@link RaceColumnListener#isTransient() transient}. - * + * * @author Axel Uhl (d043530) * */ @@ -31,12 +31,12 @@ public class RaceColumnListeners implements Serializable { public RaceColumnListeners() { raceColumnListeners = new HashSet<>(); } - + @SuppressWarnings("unchecked") // need to cast to a typed generic private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { raceColumnListeners = (Set) ois.readObject(); } - + private void writeObject(ObjectOutputStream oos) throws IOException { final Set setToWrite; synchronized (raceColumnListeners) { @@ -49,7 +49,7 @@ public class RaceColumnListeners implements Serializable { } oos.writeObject(setToWrite); } - + public void addRaceColumnListener(RaceColumnListener listener) { synchronized (raceColumnListeners) { raceColumnListeners.add(listener); @@ -61,7 +61,7 @@ public class RaceColumnListeners implements Serializable { raceColumnListeners.remove(listener); } } - + public void notifyListenersAboutTrackedRaceLinked(RaceColumn raceColumn, Fleet fleet, TrackedRace trackedRace) { for (RaceColumnListener listener : getRaceColumnListeners()) { listener.trackedRaceLinked(raceColumn, fleet, trackedRace); @@ -103,7 +103,7 @@ public class RaceColumnListeners implements Serializable { listener.hasSplitFleetContiguousScoringChanged(raceColumn, hasSplitFleetContiguousScoring); } } - + public void notifyListenersAboutHasCrossFleetMergedRankingChanged(RaceColumn raceColumn, boolean hasCrossFleetMergedRanking) { for (RaceColumnListener listener : getRaceColumnListeners()) { listener.hasCrossFleetMergedRankingChanged(raceColumn, hasCrossFleetMergedRanking); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/event/sixtyinch/GetSixtyInchStatisticAction.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/event/sixtyinch/GetSixtyInchStatisticAction.java index 95a988289cd..c4481c03a98 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/event/sixtyinch/GetSixtyInchStatisticAction.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/event/sixtyinch/GetSixtyInchStatisticAction.java @@ -64,8 +64,7 @@ public class GetSixtyInchStatisticAction implements SailingAction competitorIterator = trace.getCompetitorsFromBestToWorst(trace.getEndOfRace()) - .iterator(); + final Iterator competitorIterator = trace.getCompetitorsFromBestToWorst(trace.getEndOfRace()).iterator(); if (competitorIterator.hasNext()) { distance = trace.getDistanceTraveled(competitorIterator.next(), trace.getEndOfRace()); duration = trace.getStartOfRace().until(trace.getEndOfRace()); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaDetailsComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaDetailsComposite.java index 05af99b1f0a..c9e30f9a525 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaDetailsComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaDetailsComposite.java @@ -322,7 +322,7 @@ public class RegattaDetailsComposite extends Composite { table.addColumn(actionsColumn, stringMessages.actions()); return table; } - + public RegattaDTO getRegatta() { return regatta; } @@ -333,7 +333,7 @@ public class RegattaDetailsComposite extends Composite { } private void editRacesOfRegattaSeries(final RegattaDTO regatta, final SeriesDTO series) { - SeriesEditDialog raceDialog = new SeriesEditDialog(regatta, series, stringMessages, + SeriesEditDialog raceDialog = new SeriesEditDialog(regatta, series, stringMessages, new DialogCallback() { @Override public void cancel() { @@ -425,7 +425,7 @@ public class RegattaDetailsComposite extends Composite { errorReporter.reportError("Error trying to update series " + series.getName() + ": " + caught.getMessage()); } - + @Override public void onSuccess(Void result) { presenter.getRegattasRefresher().reloadAndCallFillAll(); @@ -472,6 +472,6 @@ public class RegattaDetailsComposite extends Composite { rankingMetric.setText(rankingMetricText); seriesListDataProvider.getList().clear(); seriesListDataProvider.getList().addAll(regatta.series); - } + } } } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java index ff3394266ed..2fae324e1a6 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaListComposite.java @@ -62,7 +62,7 @@ import com.sap.sse.security.ui.client.component.SecuredDTOOwnerColumn; import com.sap.sse.security.ui.client.component.editacl.EditACLDialog; /** - * A composite showing the list of all regattas + * A composite showing the list of all regattas * @author Frank */ public class RegattaListComposite extends Composite { @@ -77,7 +77,7 @@ public class RegattaListComposite extends Composite { private final ErrorReporter errorReporter; private final Presenter presenter; protected final LabeledAbstractFilterablePanel filterablePanelRegattas; - private final UserService userService; + private final UserService userService; private List allRegattas; protected static AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class); @@ -88,15 +88,15 @@ public class RegattaListComposite extends Composite { sb.append(safeHtml); } } - + private final Displayer regattasDisplayer = new Displayer() { - + @Override public void fill(Iterable result) { fillRegattas(result); } }; - + public Displayer getRegattasDisplayer() { return regattasDisplayer; } @@ -145,13 +145,13 @@ public class RegattaListComposite extends Composite { panel.add(regattaTable); initWidget(panel); } - + /** * True {@link RegattaDTO}s as managed by this panel usually shall be filterable based on the user's * permission to update. However, this panel may also be subclassed and used for objects that have not * yet been committed to the server or for other reasons are lacking ownership / security information. * Those subclasses should override this method to not set a filter.

    - * + * * This implementation sets a filter that requires the user to have {@link DefaultActions#UPDATE} permission * for the regatta in question. */ @@ -159,7 +159,7 @@ public class RegattaListComposite extends Composite { filterablePanelRegattas .setUpdatePermissionFilterForCheckbox(regatta -> userService.hasPermission(regatta, DefaultActions.UPDATE)); } - + public HandlerRegistration addSelectionChangeHandler(SelectionChangeEvent.Handler handler) { return refreshableRegattaMultiSelectionModel.addSelectionChangeHandler(handler); } @@ -181,7 +181,7 @@ public class RegattaListComposite extends Composite { return t.getRegattaIdentifier().hashCode(); } }, filterablePanelRegattas.getAllListDataProvider(), table); - + ListHandler columnSortHandler = new ListHandler(regattaListDataProvider.getList()); table.addColumnSortHandler(columnSortHandler); columnSortHandler.setComparator(regattaSelectionCheckboxColumn, regattaSelectionCheckboxColumn.getComparator()); @@ -207,7 +207,7 @@ public class RegattaListComposite extends Composite { regattaCanBoatsOfCompetitorsChangePerRaceColumn.setSortable(true); columnSortHandler.setComparator(regattaCanBoatsOfCompetitorsChangePerRaceColumn, (r1, r2)->Boolean.valueOf(r1.canBoatsOfCompetitorsChangePerRace).compareTo(Boolean.valueOf(r2.canBoatsOfCompetitorsChangePerRace))); - + TextColumn competitorRegistrationTypeColumn = new TextColumn() { @Override public String getValue(RegattaDTO regatta) { @@ -387,7 +387,7 @@ public class RegattaListComposite extends Composite { errorReporter.reportError("Error trying to update regatta " + editedRegatta.getName() + ": " + caught.getMessage()); } - + @Override public void onSuccess(Void result) { presenter.getRegattasRefresher().reloadAndCallFillAll(); @@ -416,9 +416,9 @@ public class RegattaListComposite extends Composite { List newAllRegattas = new ArrayList(); Util.addAll(regattas, newAllRegattas); allRegattas = newAllRegattas; - filterablePanelRegattas.updateAll(allRegattas); + filterablePanelRegattas.updateAll(allRegattas); } - + private void handleBoatCertificateAssignment(RegattaDTO regatta) { BoatCertificateAssignmentDialog dialog = new BoatCertificateAssignmentDialog(sailingServiceWrite, userService, stringMessages, errorReporter, new RegattaBoatCertificatesPanel(sailingServiceWrite, userService, regatta, stringMessages, errorReporter)); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsCreateDialog.java index c1f6d9e09c5..ac616cbf10f 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RegattaWithSeriesAndFleetsCreateDialog.java @@ -28,7 +28,7 @@ import com.sap.sse.security.ui.client.UserService; public class RegattaWithSeriesAndFleetsCreateDialog extends RegattaWithSeriesAndFleetsDialog { protected static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class); - + protected static class RegattaParameterValidator extends AbstractRegattaParameterValidator { private ArrayList existingRegattas; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesDescriptor.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesDescriptor.java index f42b689f4cd..4bdc71044bd 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesDescriptor.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesDescriptor.java @@ -8,7 +8,7 @@ import com.sap.sailing.gwt.ui.shared.SeriesDTO; /** * Used by {@link SeriesEditDialog} to capture the result of the user's configuration changes, * including the race columns that the series shall define, the medal status and the discarding rules, if any. - * + * * @author Axel Uhl (d043530) * */ @@ -24,7 +24,7 @@ public class SeriesDescriptor { private final boolean firstColumnIsNonDiscardableCarryForward; private final Integer maximumNumberOfDiscards; private final int[] resultDiscardingThresholds; - + public SeriesDescriptor(SeriesDTO series, String seriesName, List races, boolean isMedal, boolean isFleetsCanRunInParallel, int[] resultDiscardingThresholds, boolean startsWithZeroScore, boolean firstColumnIsNonDiscardableCarryForward, boolean hasSplitFleetContiguousScoring, boolean hasCrossFleetMergedRanking, Integer maximumNumberOfDiscards) { @@ -35,7 +35,7 @@ public class SeriesDescriptor { this.isFleetsCanRunInParallel = isFleetsCanRunInParallel; this.startsWithZeroScore = startsWithZeroScore; this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; - this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; + this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; this.resultDiscardingThresholds = resultDiscardingThresholds; this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; this.maximumNumberOfDiscards = maximumNumberOfDiscards; @@ -44,11 +44,11 @@ public class SeriesDescriptor { public SeriesDTO getSeries() { return series; } - + public String getSeriesName() { return seriesName; } - + public List getRaces() { return races; } @@ -60,7 +60,7 @@ public class SeriesDescriptor { public boolean isFleetsCanRunInParallel() { return isFleetsCanRunInParallel; } - + public int[] getResultDiscardingThresholds() { return resultDiscardingThresholds; } @@ -68,11 +68,11 @@ public class SeriesDescriptor { public boolean isStartsWithZeroScore() { return startsWithZeroScore; } - + public boolean hasSplitFleetContiguousScoring() { return hasSplitFleetContiguousScoring; } - + public boolean hasCrossFleetMergedRanking() { return hasCrossFleetMergedRanking; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java index 1668b92e16a..9ceecf10540 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesEditDialog.java @@ -54,11 +54,11 @@ public class SeriesEditDialog extends DataEntryDialog { private final RegattaDTO regatta; private final DiscardThresholdBoxes discardThresholdBoxes; private StringListEditorComposite raceNamesEditor; - + private static class RaceDialogValidator implements Validator { private StringMessages stringMessages; private RegattaDTO regatta; - + public RaceDialogValidator(RegattaDTO regatta, StringMessages stringMessages) { this.stringMessages = stringMessages; this.regatta = regatta; @@ -98,16 +98,16 @@ public class SeriesEditDialog extends DataEntryDialog { raceColumnUniqueInRegatta = false; wrongRaceColumn = raceColumn; break; - } + } } if (!raceColumnNameNotEmpty) { errorMessage = stringMessages.race() + " " + wrongRaceColumn.getName() + ": " + stringMessages.pleaseEnterAName(); } else if (!raceColumnUniqueInSeries) { - errorMessage = stringMessages.race() + " " + wrongRaceColumn.getName() + ": " + errorMessage = stringMessages.race() + " " + wrongRaceColumn.getName() + ": " + stringMessages.raceWithThisNameAlreadyExists(); - } else if (!raceColumnUniqueInRegatta) { - errorMessage = stringMessages.race() + " " + wrongRaceColumn.getName() + ": " + } else if (!raceColumnUniqueInRegatta) { + errorMessage = stringMessages.race() + " " + wrongRaceColumn.getName() + ": " + stringMessages.raceWithThisNameAlreadyExistsInRegatta(); } else { errorMessage = DiscardThresholdBoxes.getErrorMessage(valueToValidate.getResultDiscardingThresholds(), stringMessages); @@ -124,7 +124,7 @@ public class SeriesEditDialog extends DataEntryDialog { this.stringMessages = stringMessages; discardThresholdBoxes = new DiscardThresholdBoxes(this, selectedSeries.getDiscardThresholds(), stringMessages); } - + @Override protected SeriesDescriptor getResult() { SeriesDTO selectedSeries = getSelectedSeries(); @@ -156,7 +156,7 @@ public class SeriesEditDialog extends DataEntryDialog { } return result; } - + @Override protected Widget getAdditionalWidget() { additionalWidgetPanel = new VerticalPanel(); @@ -169,10 +169,10 @@ public class SeriesEditDialog extends DataEntryDialog { String seriesName = getSelectedSeries().getName(); seriesPanel.add(new Label(stringMessages.series() + ": " + seriesName)); additionalWidgetPanel.add(seriesPanel); - + seriesNameTextBox = createTextBox(seriesName); additionalWidgetPanel.add(seriesNameTextBox); - + isMedalCheckbox = createCheckbox(stringMessages.medalSeries()); isMedalCheckbox.ensureDebugId("MedalSeriesCheckbox"); isMedalCheckbox.setValue(selectedSeries.isMedal()); @@ -187,28 +187,28 @@ public class SeriesEditDialog extends DataEntryDialog { startWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox"); startWithZeroScoreCheckbox.setValue(selectedSeries.isStartsWithZeroScore()); additionalWidgetPanel.add(startWithZeroScoreCheckbox); - + hasSplitFleetContiguousScoringCheckbox = createCheckbox(stringMessages.hasSplitFleetContiguousScoring()); hasSplitFleetContiguousScoringCheckbox.ensureDebugId("HasSplitFleetContiguousScoringCheckbox"); hasSplitFleetContiguousScoringCheckbox.setValue(selectedSeries.hasSplitFleetContiguousScoring()); additionalWidgetPanel.add(hasSplitFleetContiguousScoringCheckbox); - + hasCrossFleetMergedRankingCheckbox = createCheckbox(stringMessages.hasCrossFleetMergedRanking()); hasCrossFleetMergedRankingCheckbox.ensureDebugId("HasCrossFleetMergedRankingCheckbox"); hasCrossFleetMergedRankingCheckbox.setValue(selectedSeries.hasCrossFleetMergedRanking()); additionalWidgetPanel.add(hasCrossFleetMergedRankingCheckbox); - + firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward()); firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox"); firstColumnIsNonDiscardableCarryForwardCheckbox.setValue(selectedSeries.isFirstColumnIsNonDiscardableCarryForward()); additionalWidgetPanel.add(firstColumnIsNonDiscardableCarryForwardCheckbox); - + final HorizontalPanel maximumNumberOfDiscardsPanel = new HorizontalPanel(); maximumNumberOfDiscardsPanel.add(new Label(stringMessages.maximumNumberOfDiscards())); maximumNumberOfDiscardsBox = createIntegerBox(selectedSeries.getMaximumNumberOfDiscards(), /* visibleLength */ 3); maximumNumberOfDiscardsPanel.add(maximumNumberOfDiscardsBox); additionalWidgetPanel.add(maximumNumberOfDiscardsPanel); - + useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule()); useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox"); useSeriesResultDiscardingThresholdsCheckbox.setValue(selectedSeries.getDiscardThresholds() != null); @@ -219,12 +219,12 @@ public class SeriesEditDialog extends DataEntryDialog { } }); additionalWidgetPanel.add(useSeriesResultDiscardingThresholdsCheckbox); - + Widget discardThresholdBoxesWidget = discardThresholdBoxes.getWidget(); discardThresholdBoxesWidget.ensureDebugId(""); discardThresholdBoxesWidget.setVisible(useSeriesResultDiscardingThresholdsCheckbox.getValue()); additionalWidgetPanel.add(discardThresholdBoxesWidget); - + raceNamesEditor = new StringListInlineEditorComposite(getExistingRacesOfSeries(), new RaceNamesEditorUi(regatta, stringMessages, IconResources.INSTANCE.removeIcon(), seriesName)); raceNamesEditor.ensureDebugId("RaceNamesStringListEditorComposite"); raceNamesEditor.addValueChangeHandler(new ValueChangeHandler>() { @@ -233,7 +233,7 @@ public class SeriesEditDialog extends DataEntryDialog { validateAndUpdate(); } }); - + TabPanel tabPanel = new TabPanel(); tabPanel.setWidth("100%"); tabPanel.add(raceNamesEditor, stringMessages.races()); @@ -242,7 +242,7 @@ public class SeriesEditDialog extends DataEntryDialog { return additionalWidgetPanel; } - + private List getExistingRacesOfSeries() { List names = new ArrayList(); SeriesDTO selectedSeries = getSelectedSeries(); @@ -257,39 +257,39 @@ public class SeriesEditDialog extends DataEntryDialog { private SeriesDTO getSelectedSeries() { return selectedSeries; } - + private class RaceNamesEditorUi extends GenericStringListInlineEditorComposite.ExpandedUi { private final RegattaDTO regatta; - + private final ListBox addRacesFromListBox; private final ListBox addRacesToListBox; private final TextBox raceNamePrefixTextBox; private final Button addRacesBtn; - + private final String seriesName; private final Label addRacesHintLabel; - + public RaceNamesEditorUi(RegattaDTO regatta, StringMessages stringMessages, ImageResource removeImage, String seriesName) { super(stringMessages, removeImage, /* suggest values */ Collections.emptySet(), stringMessages.enterRaceName(), 40); this.seriesName = seriesName; this.regatta = regatta; - + this.addRacesFromListBox = createListBox(false); this.addRacesFromListBox.ensureDebugId("AddRacesFromListBox"); - + this.addRacesToListBox = createListBox(false); this.addRacesToListBox.ensureDebugId("AddRacesToListBox"); - + this.raceNamePrefixTextBox = createTextBox(null); this.raceNamePrefixTextBox.ensureDebugId("RaceNamePrefixTextBox"); - + this.addRacesBtn = new Button(stringMessages.add()); this.addRacesBtn.ensureDebugId("AddRacesButton"); - + this.addRacesHintLabel = new Label(""); } - + @Override protected StringMessages getStringMessages() { return (StringMessages) super.getStringMessages(); @@ -298,7 +298,7 @@ public class SeriesEditDialog extends DataEntryDialog { private List resolveRaceNamesToAdd() { List result = new ArrayList(); String racePrefix = raceNamePrefixTextBox.getText(); - int to = addRacesToListBox.getSelectedIndex() + 1; + int to = addRacesToListBox.getSelectedIndex() + 1; int from = addRacesFromListBox.getSelectedIndex() + 1; int racesToCreate = to - from + 1; if(racesToCreate > 0) { @@ -307,10 +307,10 @@ public class SeriesEditDialog extends DataEntryDialog { result.add(raceName); } } - + return result; } - + public void updateHintLabel() { List resolveRaceNamesToAdd = resolveRaceNamesToAdd(); String hintText = "Hint: 'Add' will create the races: "; @@ -335,7 +335,7 @@ public class SeriesEditDialog extends DataEntryDialog { } else { for (RaceColumnDTO raceColumn : seriesDTO.getRaceColumns()) { allRaces.add(raceColumn.getName()); - } + } } } for(String name: allRaces) { @@ -364,11 +364,11 @@ public class SeriesEditDialog extends DataEntryDialog { } return maxNumber+1; } - + @Override protected Widget createAddWidget() { VerticalPanel vPanel = new VerticalPanel(); - + HorizontalPanel addRacesPanel = new HorizontalPanel(); addRacesPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); addRacesPanel.setSpacing(5); @@ -392,7 +392,7 @@ public class SeriesEditDialog extends DataEntryDialog { updateHintLabel(); } }); - + addRacesPanel.add(addRacesFromListBox); addRacesPanel.add(new Label(getStringMessages().to())); addRacesPanel.add(addRacesToListBox); @@ -404,14 +404,14 @@ public class SeriesEditDialog extends DataEntryDialog { } else { raceNamePrefixTextBox.setText(seriesName.substring(0, 1).toUpperCase()); } - + raceNamePrefixTextBox.addValueChangeHandler(new ValueChangeHandler() { @Override public void onValueChange(ValueChangeEvent event) { updateHintLabel(); } }); - + addRacesPanel.add(raceNamePrefixTextBox); addRacesBtn.addStyleName("inlineButton"); addRacesBtn.addClickHandler(new ClickHandler() { @@ -430,14 +430,14 @@ public class SeriesEditDialog extends DataEntryDialog { } }); addRacesPanel.add(addRacesBtn); - + vPanel.add(addRacesPanel); - + addRacesHintLabel.getElement().getStyle().setColor("gray"); vPanel.add(addRacesHintLabel); updateFromToListboxesSelection(); updateHintLabel(); - + return vPanel; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java index 80b2f633c26..c77d763d0e6 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsCreateDialog.java @@ -27,7 +27,7 @@ import com.sap.sse.gwt.client.controls.listedit.ListEditorComposite; import com.sap.sse.gwt.client.dialog.DataEntryDialog; public class SeriesWithFleetsCreateDialog extends DataEntryDialog { - + protected static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class); private StringMessages stringMessages; @@ -38,7 +38,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { protected CheckBox fleetsCanRunInParallelCheckbox; protected CheckBox startsWithZeroScoreCheckbox; protected CheckBox hasSplitFleetContiguousScoringCheckbox; - protected CheckBox hasCrossFleetMergedRankingCheckbox; + protected CheckBox hasCrossFleetMergedRankingCheckbox; protected CheckBox firstColumnIsNonDiscardableCarryForwardCheckbox; protected CheckBox useSeriesResultDiscardingThresholdsCheckbox; protected IntegerBox maximumNumberOfDiscardsBox; @@ -107,14 +107,14 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { DialogCallback callback) { this(existingSeries, stringMessages, /* discard thresholds */ null, callback); } - + /** * @param existingSeries * used for validation for duplicate series names */ protected SeriesWithFleetsCreateDialog(Collection existingSeries, StringMessages stringMessages, int[] discardThresholds, DialogCallback callback) { - super(stringMessages.series(), null, stringMessages.ok(), stringMessages.cancel(), + super(stringMessages.series(), null, stringMessages.ok(), stringMessages.cancel(), new SeriesParameterValidator(stringMessages, existingSeries), callback); this.stringMessages = stringMessages; this.series = new SeriesDTO(); @@ -122,29 +122,29 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { nameEntryField = createTextBox(null); nameEntryField.ensureDebugId("NameTextBox"); nameEntryField.setVisibleLength(40); - + isMedalSeriesCheckbox = createCheckbox(stringMessages.medalSeries()); isMedalSeriesCheckbox.ensureDebugId("MedalSeriesCheckbox"); - + fleetsCanRunInParallelCheckbox = createCheckbox(stringMessages.canFleetsRunInParallel()); fleetsCanRunInParallelCheckbox.setValue(true); fleetsCanRunInParallelCheckbox.ensureDebugId("FleetsCanRaceInParallelSeriesCheckbox"); startsWithZeroScoreCheckbox = createCheckbox(stringMessages.startsWithZeroScore()); startsWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox"); - + hasSplitFleetContiguousScoringCheckbox = createCheckbox(stringMessages.hasSplitFleetContiguousScoring()); hasSplitFleetContiguousScoringCheckbox.ensureDebugId("HasSplitFleetContiguousScoringCheckbox"); - + hasCrossFleetMergedRankingCheckbox = createCheckbox(stringMessages.hasCrossFleetMergedRanking()); hasCrossFleetMergedRankingCheckbox.ensureDebugId("hasCrossFleetMergedRankingCheckbox"); - + maximumNumberOfDiscardsBox = createIntegerBox(null, /* visibleLength */ 3); maximumNumberOfDiscardsBox.ensureDebugId("maximumNumberOfDiscardsBox"); - + firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward()); firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox"); - + useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule()); useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox"); useSeriesResultDiscardingThresholdsCheckbox.addValueChangeHandler(new ValueChangeHandler() { @@ -156,7 +156,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { Widget widget = discardThresholdBoxes.getWidget(); widget.ensureDebugId("DiscardThresholdBoxes"); widget.setVisible(false); - + initializeFleetListComposite(stringMessages); } @@ -186,7 +186,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { series.setDiscardThresholds(useSeriesResultDiscardingThresholdsCheckbox.getValue() ? discardThresholdBoxes.getDiscardThresholds() : null); return series; } - + @Override protected Widget getAdditionalWidget() { final VerticalPanel panel = new VerticalPanel(); @@ -209,7 +209,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { formGrid.setWidget(row++, 1, maximumNumberOfDiscardsBox); formGrid.setWidget(row++, 1, useSeriesResultDiscardingThresholdsCheckbox); formGrid.setWidget(row++, 1, discardThresholdBoxes.getWidget()); - + TabPanel tabPanel = new TabPanel(); tabPanel.setWidth("100%"); tabPanel.add(fleetListComposite, stringMessages.fleets()); @@ -217,7 +217,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog { panel.add(tabPanel); return panel; } - + @Override protected FocusWidget getInitialFocusWidget() { return nameEntryField; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsDefaultListEditor.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsDefaultListEditor.java index 98890b41f1e..34b98e2377a 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsDefaultListEditor.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SeriesWithFleetsDefaultListEditor.java @@ -18,7 +18,7 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback; * As opposed to the regular {@link SeriesWithFleetsListEditor}, this variant offers an "Edit Series" * button for each series in the list, allowing the user not only to add and remove series but also to * edit an existing series in-place. - * + * * @author Axel Uhl (D043530) * */ @@ -97,7 +97,7 @@ public class SeriesWithFleetsDefaultListEditor extends SeriesWithFleetsListEdito return editSeriesButton; } } - + @Override protected Widget createValueWidget(int rowIndex, SeriesDTO seriesDTO) { return new CompactSeriesPanel(seriesDTO); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java index 3a4b7ba5a7a..637f5ae3bf0 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java @@ -139,9 +139,9 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa * {@link ImageResizingTaskDTO} create a resize. Since no {@link MediaTagConstants} have the same defined bounds, * there will be no merge of these {@Link ImageDTO}. Uses the {@link FileStorageService} to store the resized * images. If an error occurs during resize or storing process, it will be tried to restore the previous state. - * + * * @author Robin Fleige (D067799) - * + * * @param imageResizingTask * is an {@link ImageResizingTaskDTO} with the information on how the image saved in the {@Link ImageDTO} * should be resized. The resizingTask attribute should not be null or empty at this point @@ -270,7 +270,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa void updateSeries(RegattaIdentifier regattaIdentifier, String seriesName, String newSeriesName, boolean isMedal, boolean isFleetsCanRunInParallel, int[] resultDiscardingThresholds, boolean startsWithZeroScore, - boolean firstRaceIsNonDiscardableCarryForward, boolean hasSplitFleetScore, boolean hasCrossFleetMergedRanking, + boolean firstRaceIsNonDiscardableCarryForward, boolean hasSplitFleetScore, boolean hasCrossFleetMergedRanking, Integer maximumNumberOfDiscards, List fleets) throws UnauthorizedException; void updateRegatta(RegattaIdentifier regattaIdentifier, Date startDate, Date endDate, List courseAreaUuids, @@ -452,7 +452,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa /** * Removes course templates list - * + * * @param courseTemplateDTOs * list of course templates to remove */ @@ -460,7 +460,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa /** * Removes mark properties list - * + * * @param markPropertiesDTOS * list of mark properties to remove */ @@ -480,7 +480,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa /** * Adds the course definition to the racelog, while trying to reuse existing marks, controlpoints and waypoints from * the previous course definition in the racelog. - * + * * @param priority * TODO * @throws UnauthorizedException, @@ -520,7 +520,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa /** * Adds public tag as {@link RaceLogTagEvent} to {@link RaceLog} and private tag to * {@link com.sap.sse.security.interfaces.UserStore UserStore}. - * + * * @param leaderboardName * required to identify {@link RaceLog}, must NOT be null * @param raceColumnName @@ -563,7 +563,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa * {@link #getORCPerformanceCurveLegInfo(RegattaAndRaceIdentifier)} will return a map equal to the one passed, * except for {@code null} values which then would be missing from the results, where here they mean to explicitly * revoke any previous setting for that leg. - * + * * @throws NotFoundException * in case the race log cannot be found by the leaderboard, race column and fleet names provided */ @@ -579,7 +579,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa /** * Slices a new race from the race specified by the given {@link RegattaAndRaceIdentifier} using the given time * range. A new {@link RaceColumn} with the given name is added to the {@link RegattaLeaderboard}. - * + * * @throws ServiceException */ RegattaAndRaceIdentifier sliceRace(RegattaAndRaceIdentifier raceIdentifier, String newRaceColumnName, @@ -598,7 +598,7 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa * imageURL and visibleForPublic. Tags are not really updated, instead public tags are * revoked/private tags removed first and then the new tags gets saved depending on the new value * visibleForPublic. - * + * * @param leaderboardName * required to identify {@link RaceLog}, must NOT be null * @param raceColumnName @@ -642,35 +642,35 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa void copyCourseToOtherRaceLogs(Triple fromTriple, Set> toTriples, boolean copyMarkDeviceMappings, int priority) throws UnauthorizedException, NotFoundException; - + /** * Adds a fix to the {@link SensorFixStore}, and creates a mapping with a virtual device for exactly the current * timepoint. - * + * * @param timePoint * the time point for the fix; if {@code null}, the current time is used - * + * * @throws DoesNotHaveRegattaLogException * @throws NotFoundException */ void pingMark(String leaderboardName, MarkDTO mark, TimePoint timePoint, Position position) throws UnauthorizedException, DoesNotHaveRegattaLogException, NotFoundException; - + /** * Revoke the {@link RaceLogDenoteForTrackingEvent}. This does not affect an existing {@code RaceLogRaceTracker} or * {@link TrackedRace} for this {@code RaceLog}. - * + * * @throws UnauthorizedException, * NotFoundException - * + * * @see RaceLogTrackingAdapter#removeDenotationForRaceLogTracking */ void removeDenotationForRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName) throws UnauthorizedException, NotFoundException; - + /** * Removes public {@link TagDTO tag} from {@link RaceLog} and private {@link TagDTO tag} from {@link UserStore}. - * + * * @param leaderboardName * required to identify {@link RaceLog}, must NOT be null * @param raceColumnName diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWriteAsync.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWriteAsync.java index 90f23c2beec..a844878ff7f 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWriteAsync.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWriteAsync.java @@ -126,13 +126,13 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void addCompetitors(List competitorsForSaving, String searchTag, AsyncCallback> callback) throws UnauthorizedException; - + void addColumnsToLeaderboard(String leaderboardName, List> columnsToAdd, AsyncCallback callback) throws UnauthorizedException; void addColumnToLeaderboard(String columnName, String leaderboardName, boolean medalRace, AsyncCallback callback) throws UnauthorizedException; - + void addTypedDeviceMappingToRegattaLog(String leaderboardName, TypedDeviceMappingDTO dto, AsyncCallback callback) /*throws NoCorrespondingServiceRegisteredException, TransformationException, DoesNotHaveRegattaLogException, NotFoundException*/; @@ -140,11 +140,11 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void addDeviceMappingToRegattaLog(String leaderboardName, DeviceMappingDTO dto, AsyncCallback callback) /*throws NoCorrespondingServiceRegisteredException, TransformationException, DoesNotHaveRegattaLogException*/; - + void allowBoatResetToDefaults(List boats, AsyncCallback callback) throws UnauthorizedException; - + void setTrackingTimes(RaceLogSetTrackingTimesDTO dto, AsyncCallback callback); - + /** * Copies one race's competitor set to other races. * @param fromTriple @@ -159,7 +159,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void copyCourseToOtherRaceLogs(Triple fromTriple, Set> toTriples, boolean copyMarkDeviceMappings, int priority, AsyncCallback callback); - void revokeMarkDefinitionEventInRegattaLog(String leaderboardName, String raceColumnName, String fleetName, + void revokeMarkDefinitionEventInRegattaLog(String leaderboardName, String raceColumnName, String fleetName, MarkDTO markDTO, AsyncCallback callback); void disableCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName, @@ -167,7 +167,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void enableCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName, AsyncCallback asyncCallback); - + void setBoatRegistrationsInRegattaLog(String leaderboardName, Set boats, AsyncCallback callback); @@ -180,10 +180,10 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void setEliminatedCompetitors(String leaderboardName, Set eliminatedCompetitors, AsyncCallback callback); void removeExpeditionDeviceConfiguration(ExpeditionDeviceConfiguration expeditionDeviceConfiguration, AsyncCallback asyncCallback); - + /** * Registers all competitors of a {@link PairingList} in the respective {@link RaceColumn}s and {@link Fleet}s. - * + * * @param leaderboardName * the name of the leaderboard * @param flightMultiplier @@ -237,7 +237,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic /** * Remove course templates by UUIDs - * + * * @param courseTemplatesUuids * the {@link Collection} of course templates' UUIDs which will be remove * @param asyncCallback @@ -266,7 +266,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic /** * Remove mark properties by UUIDs - * + * * @param markPropertiesUuids * the {@link Collection} of mark properties' UUIDs which will be remove * @param asyncCallback @@ -275,7 +275,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void removeMarkProperties(Collection markPropertiesUuids, AsyncCallback asyncCallback); void createMarkRole(MarkRoleDTO markRole, AsyncCallback asyncCallback); - + /** * @param regattaToAddTo * if null, the regatta into which the race has previously been loaded will be looked up; if @@ -303,7 +303,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic */ void trackWithTracTrac(RegattaIdentifier regattaToAddTo, List rrs, String liveURI, String storedURI, String courseDesignUpdateURI, boolean trackWind, boolean correctWindByDeclination, - Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, + Duration offsetToStartTimeOfSimulatedRace, boolean useInternalMarkPassingAlgorithm, boolean useOfficialEventsToUpdateRaceLog, String tracTracUsername, String tracTracPassword, AsyncCallback callback); @@ -332,7 +332,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic /** * Untracks the race and removes it from the regatta. It will also be removed in all leaderboards - * + * * @param regattaNamesAndRaceNames * The identifier for the regatta name, and the race name to remove */ @@ -538,7 +538,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void startRaceLogTracking(List> leaderboardRaceColumnFleetNames, final boolean trackWind, final boolean correctWindByDeclination, AsyncCallback callback); - + /** * Set the competitor (with contained boats) registrations in the racelog. Unregisters formerly registered competitors that are not listed * in {@code competitors}. @@ -603,7 +603,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic /** * Sets the a new start time. - * + * * @param dto * {@link RaceLogSetStartTimeAndProcedureDTO} identifying the race to set the start time on and the new * start time. @@ -612,13 +612,13 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic /** * Sets the a new finishing and end time. - * + * * @param dto * {@link RaceLogSetFinishingAndFinishTimeDTO} identifying the race and the new finishing and * end time. */ void setFinishingAndEndTime(RaceLogSetFinishingAndFinishTimeDTO editedObject, AsyncCallback> asyncCallback); - + void setImpliedWindSource(String leaderboardName, String raceColumnName, String fleetName, ImpliedWindSource impliedWindSource, AsyncCallback callback); @@ -626,7 +626,7 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic void getTrackFileImportDeviceIds(List uuids, AsyncCallback> callback); - void getMarkTrack(String leaderboardName, String raceColumnName, String fleetName, String markIdAsString, + void getMarkTrack(String leaderboardName, String raceColumnName, String fleetName, String markIdAsString, AsyncCallback callback); void getDeviceMappings(String leaderboardName, AsyncCallback> callback); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java index 6c93d0c2567..ab6fd7e3d51 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java @@ -524,7 +524,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet protected final ServiceTracker expeditionConnectorTracker; protected final SwissTimingAdapterPersistence swissTimingAdapterPersistence; - + private final ServiceTracker swissTimingAdapterTracker; private final ServiceTracker tractracAdapterTracker; @@ -532,15 +532,15 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet private final ServiceTracker igtimiAdapterTracker; private final ServiceTracker raceLogTrackingAdapterTracker; - + private final ServiceTracker yellowBrickTrackingAdapterTracker; - + private final ServiceTracker deviceIdentifierStringSerializationHandlerTracker; - + private final FullyInitializedReplicableTracker securityServiceTracker; private final FullyInitializedReplicableTracker sharedSailingDataTracker; - + protected final com.sap.sailing.domain.tractracadapter.persistence.MongoObjectFactory tractracMongoObjectFactory; private final DomainObjectFactory domainObjectFactory; @@ -550,11 +550,11 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet private final com.sap.sailing.domain.tractracadapter.persistence.DomainObjectFactory tractracDomainObjectFactory; protected final Executor executor; - + protected final com.sap.sailing.domain.base.DomainFactory baseDomainFactory; - + private static final int LEADERBOARD_BY_NAME_RESULTS_CACHE_BY_ID_SIZE = 100; - + private static final int LEADERBOARD_DIFFERENCE_CACHE_SIZE = 50; protected static final String MAILTYPE_PROPERTY = "com.sap.sailing.domain.tracking.MailInvitationType"; @@ -575,7 +575,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet private final SwissTimingReplayService swissTimingReplayService; private final QuickRanksLiveCache quickRanksLiveCache; - + public SailingServiceImpl() { BundleContext context = Activator.getDefault(); Activator activator = Activator.getInstance(); @@ -632,7 +632,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet activator.setSailingService(this); // register so this service is informed when the bundle shuts down } } - + /** * Stops this service and frees its resources. In particular, caching services and threads owned by this service will be * notified to stop their jobs. @@ -649,7 +649,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet protected SwissTimingAdapter getSwissTimingAdapter() { return getSwissTimingAdapterFactory().getOrCreateSwissTimingAdapter(baseDomainFactory); } - + protected TracTracAdapterFactory getTracTracAdapterFactory() { return tractracAdapterTracker.getService(); } @@ -747,7 +747,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new Pair<>(Collections.emptyList(), /* hint */ null); } - + @Override public SerializationDummy serializationDummy(PersonDTO dummy, CountryCode ccDummy, PreciseCompactPosition preciseCompactPosition, @@ -764,7 +764,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet * the missing columns to its profile and start a synchronous computation for the requesting client, the result of * which will be used as live leaderboard cache update. *

    - * + * * Otherwise, the leaderboard is computed synchronously on the fly. * @param previousLeaderboardId * if null or no leaderboard with that {@link LeaderboardDTO#getId() ID} is known, a @@ -910,7 +910,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return getSecurityService().mapAndFilterByReadPermissionForCurrentUser( getService().getAllRegattas(), this::convertToRegattaDTO); } - + @Override public RegattaDTO getRegattaByName(String regattaName) { RegattaDTO result = null; @@ -923,7 +923,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected MarkDTO convertToMarkDTO(Mark mark, Position position) { MarkDTO markDTO; if (position != null) { @@ -937,7 +937,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet markDTO.type = mark.getType(); return markDTO; } - + protected RegattaDTO convertToRegattaDTO(Regatta regatta) { RegattaDTO regattaDTO = new RegattaDTO(regatta.getName(), regatta.getScoringScheme().getType()); regattaDTO.races = convertToRaceDTOs(regatta); @@ -962,7 +962,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet regattaDTO.registrationLinkSecret = regatta.getRegistrationLinkSecret(); return regattaDTO; } - + private BoatClassDTO convertToBoatClassDTO(BoatClass boatClass) { return boatClass==null?null:new BoatClassDTO(boatClass.getName(), boatClass.getHullLength(), boatClass.getHullBeam()); } @@ -994,7 +994,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet raceColumnDTO.setMedalRace(raceColumn.isMedalRace()); raceColumnDTO.setExplicitFactor(raceColumn.getExplicitFactor()); } - + private List convertToRaceColumnDTOs(Iterable raceColumns) { List raceColumnDTOs = new ArrayList(); RaceColumnDTOFactory columnFactory = RaceColumnDTOFactory.INSTANCE; @@ -1008,7 +1008,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return raceColumnDTOs; } - + private RaceInfoDTO createRaceInfoDTO(String seriesName, RaceColumn raceColumn, Fleet fleet, RaceLog raceLog, ReadonlyRaceState state) { RaceInfoDTO raceInfoDTO = new RaceInfoDTO(); @@ -1059,7 +1059,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (abortingFlagEvent != null) { raceInfoDTO.isRaceAbortedInPassBefore = true; raceInfoDTO.abortingTimeInPassBefore = abortingFlagEvent.getLogicalTimePoint().asDate(); - + if (raceInfoDTO.lastStatus == RaceLogRaceStatus.UNSCHEDULED || raceInfoDTO.lastStatus == RaceLogRaceStatus.PRESCHEDULED) { raceInfoDTO.lastUpperFlag = abortingFlagEvent.getUpperFlag(); raceInfoDTO.lastLowerFlag = abortingFlagEvent.getLowerFlag(); @@ -1099,7 +1099,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet raceInfoDTO.raceIdentifier = raceColumn.getRaceIdentifier(fleet); return raceInfoDTO; } - + private void fillStartProcedureSpecifics(RaceInfoDTO raceInfoDTO, ReadonlyRaceState state) { RaceInfoExtensionDTO info = null; raceInfoDTO.startProcedure = state.getRacingProcedure().getType(); @@ -1125,7 +1125,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet for (RaceDefinition r : regatta.getAllRaces()) { RegattaAndRaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta.getName(), r.getName()); TrackedRace trackedRace = getService().getExistingTrackedRace(raceIdentifier); - TrackedRaceDTO trackedRaceDTO = null; + TrackedRaceDTO trackedRaceDTO = null; final RankingMetrics rankingMetricType; if (trackedRace != null) { trackedRaceDTO = getBaseDomainFactory().createTrackedRaceDTO(trackedRace); @@ -1140,7 +1140,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet SecurityDTOUtil.addSecurityInformation(getSecurityService(), raceDTO); getBaseDomainFactory().updateRaceDTOWithTrackedRaceData(trackedRace, raceDTO); } - raceDTO.boatClass = regatta.getBoatClass() == null ? null : regatta.getBoatClass().getName(); + raceDTO.boatClass = regatta.getBoatClass() == null ? null : regatta.getBoatClass().getName(); result.add(raceDTO); } return result; @@ -1158,7 +1158,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected CompetitorDTO convertToCompetitorDTO(Competitor competitor) { CompetitorDTO competitorDTO = baseDomainFactory.convertToCompetitorDTO(competitor); SecurityDTOUtil.addSecurityInformation(getSecurityService(), competitorDTO); @@ -1173,7 +1173,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet competitorDTO.clearNonPublicFields(); } } - + protected CompetitorWithBoatDTO convertToCompetitorWithBoatDTO(CompetitorWithBoat competitor) { CompetitorWithBoatDTO competitorDTO = baseDomainFactory.convertToCompetitorWithBoatDTO(competitor); SecurityDTOUtil.addSecurityInformation(getSecurityService(), competitorDTO); @@ -1228,7 +1228,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected BoatDTO convertToBoatDTO(Boat boat) { BoatDTO boatDTO = baseDomainFactory.convertToBoatDTO(boat); SecurityDTOUtil.addSecurityInformation(getSecurityService(), boatDTO); @@ -1245,7 +1245,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet continue; } result.add(new TracTracRaceRecordDTO(raceRecord.getID(), raceRecord.getEventName(), raceRecord.getName(), - raceRecord.getTrackingStartTime().asDate(), + raceRecord.getTrackingStartTime().asDate(), raceRecord.getTrackingEndTime().asDate(), raceRecord.getRaceStartTime() == null ? null : raceRecord.getRaceStartTime().asDate(), raceRecord.getBoatClassNames(), raceRecord.getRaceStatus(), raceRecord.getRaceVisibility(), raceRecord.getJsonURL().toString(), hasRememberedRegatta(raceRecord.getID()))); @@ -1274,7 +1274,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return config; }); } - + private RaceDefinition getRaceByName(Regatta regatta, String raceName) { if (regatta != null) { return regatta.getRaceByName(raceName); @@ -1282,7 +1282,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return null; } } - + @Override public WindInfoForRaceDTO getRawWindFixes(RegattaAndRaceIdentifier raceIdentifier, Collection windSources) { WindInfoForRaceDTO result = null; @@ -1464,7 +1464,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet private interface PositionAtTimeProvider { Position getPosition(TimePoint at); } - + private WindTrackInfoDTO createWindTrackInfoDTO(TimePoint from, long millisecondsStepWidth, int numberOfFixes, TrackedRace trackedRace, boolean onlyUpToNewestEvent, TimePoint newestEvent, WindSource windSource, PositionAtTimeProvider positionProvider) { @@ -1501,7 +1501,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } timePoint = new MillisecondsTimePoint(timePoint.asMillis() + millisecondsStepWidth); } - windTrackInfoDTO.minWindConfidence = minWindConfidence; + windTrackInfoDTO.minWindConfidence = minWindConfidence; windTrackInfoDTO.maxWindConfidence = maxWindConfidence; return windTrackInfoDTO; } @@ -1581,7 +1581,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet // get simulation-results from smart-future-cached simulation-service SimulatorResultsDTO result = null; SimulationService simulationService = getService().getSimulationService(); - if (simulationService == null) + if (simulationService == null) return result; SimulationResults simulationResults = simulationService.getSimulationResults(legIdentifier); if (simulationResults == null) { @@ -1617,7 +1617,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + private SimulatorWindDTO createSimulatorWindDTO(TimedPositionWithSpeed timedPositionWithSpeed) { Position position = timedPositionWithSpeed.getPosition(); SpeedWithBearing speedWithBearing = timedPositionWithSpeed.getSpeed(); @@ -1782,7 +1782,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return new CompactRaceMapDataDTO(boatPositions, coursePositions, courseSidelines, quickRanks, simulationResultVersion, raceCompetitorIdsAsStrings, estimatedDuration); } - + private Duration getEstimationForTargetTime(Date time, final TrackedRace trackedRace) { Duration estimatedDuration = null; if (trackedRace != null) { @@ -1808,7 +1808,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet /** * {@link LegType}s are cached within the method with a resolution of one minute. The cache key is a pair of * {@link TrackedLegOfCompetitor} and {@link TimePoint}. - * + * * @param from * for the list of competitors provided as keys of this map, requests the GPS fixes starting with the * date provided as value @@ -1941,7 +1941,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (fixIter.hasNext()) { fix = fixIter.next(); } else { - // check if fix was at date and if extrapolation is requested; + // check if fix was at date and if extrapolation is requested; if (!fix.getTimePoint().equals(toTimePointExcluding) && extrapolate) { Position position = track.getEstimatedPosition(toTimePointExcluding, extrapolate); Wind wind2 = trackedRace.getWind(position, toTimePointExcluding); @@ -2060,7 +2060,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } finally { trackedRace.getRace().getCourse().unlockAfterRead(); } - } + } if (raceTimesInfo != null) { raceTimesInfo.currentServerTime = new Date(); } @@ -2106,7 +2106,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + @Override public CoursePositionsDTO getCoursePositions(RegattaAndRaceIdentifier raceIdentifier, Date date) { CoursePositionsDTO result = new CoursePositionsDTO(); @@ -2179,7 +2179,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + @Override public RaceCourseDTO getRaceCourse(RegattaAndRaceIdentifier raceIdentifier, Date date) { List waypointDTOs = new ArrayList(); @@ -2208,14 +2208,14 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new RaceCourseDTO(waypointDTOs, allMarks); } - + class TrackedRaceMarkPositionFinder implements MarkPositionFinder{ private TrackedRace trackedRace; public TrackedRaceMarkPositionFinder(TrackedRace trackedRace) { this.trackedRace = trackedRace; } - + @Override public Position find(Mark mark, TimePoint at) { final TimePoint timePointToUse = trackedRace == null ? null : @@ -2229,17 +2229,17 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return result; } } - + interface MarkPositionFinder { Position find(Mark mark, TimePoint at); } - + private ControlPointDTO convertToControlPointDTO(ControlPoint controlPoint, MarkPositionFinder positionFinder, TimePoint timePoint) { ControlPointDTO result; - + if (controlPoint instanceof ControlPointWithTwoMarks) { final Mark left = ((ControlPointWithTwoMarks) controlPoint).getLeft(); - final Position leftPos = positionFinder.find(left, timePoint); + final Position leftPos = positionFinder.find(left, timePoint); final Mark right = ((ControlPointWithTwoMarks) controlPoint).getRight(); final Position rightPos = positionFinder.find(right, timePoint); result = new GateDTO(controlPoint.getId().toString(), controlPoint.getName(), @@ -2251,7 +2251,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected ControlPoint getOrCreateControlPoint(ControlPointDTO dto) { String idAsString = dto.getIdAsString(); if (idAsString == null) { @@ -2360,7 +2360,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet throw new RuntimeException(e); } } - + protected SecurityService getSecurityService() { try { return securityServiceTracker.getInitializedService(0); @@ -2368,7 +2368,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet throw new RuntimeException(e); } } - + @Override public List getLeaderboardNames() { return getLeaderboardNamesFilteredForCurrentUser(); @@ -2412,7 +2412,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return leaderboard; } - + @Override public StrippedLeaderboardDTO getLeaderboard(String leaderboardName) { Leaderboard leaderboard = getLeaderboardAndCheckReadPermission(leaderboardName); @@ -2455,7 +2455,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (leaderboard instanceof RegattaLeaderboard) { RegattaLeaderboard regattaLeaderboard = (RegattaLeaderboard) leaderboard; Regatta regatta = regattaLeaderboard.getRegatta(); - leaderboardDTO.regattaName = regatta.getName(); + leaderboardDTO.regattaName = regatta.getName(); leaderboardDTO.scoringScheme = regatta.getScoringScheme().getType(); leaderboardDTO.canBoatsOfCompetitorsChangePerRace = regatta.canBoatsOfCompetitorsChangePerRace(); } else { @@ -2484,9 +2484,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet raceDTO = baseDomainFactory.createRaceDTO(getService(), withGeoLocationData, raceIdentifier, trackedRace); if(withStatisticalData) { Iterable mediaTracksForRace = getService().getMediaTracksForRace(raceIdentifier); - raceDTO.trackedRaceStatistics = baseDomainFactory.createTrackedRaceStatisticsDTO(trackedRace, leaderboard, raceColumn, fleet, mediaTracksForRace); + raceDTO.trackedRaceStatistics = baseDomainFactory.createTrackedRaceStatisticsDTO(trackedRace, leaderboard, raceColumn, fleet, mediaTracksForRace); } - } + } final FleetDTO fleetDTO = baseDomainFactory.convertToFleetDTO(fleet); RaceColumnDTO raceColumnDTO = leaderboardDTO.addRace(raceColumn.getName(), raceColumn.getExplicitFactor(), leaderboard.getScoringScheme().getScoreFactor(raceColumn), @@ -2544,11 +2544,11 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } @Override - public SwissTimingEventRecordDTO getRacesOfSwissTimingEvent(String eventJsonURL) + public SwissTimingEventRecordDTO getRacesOfSwissTimingEvent(String eventJsonURL) throws UnknownHostException, IOException, InterruptedException, ParseException { - SwissTimingEventRecordDTO result = null; + SwissTimingEventRecordDTO result = null; List swissTimingRaces = new ArrayList(); - + // TODO: delete getSwissTimingAdapter().getSwissTimingRaceRecords() method // TODO: delete SwissTimingDomainFactory.getRaceTypeFromRaceID(String raceID) URL url = new URL(eventJsonURL); @@ -2558,9 +2558,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (eventResult != null) { for (RegattaResultDescriptor regattaResult : eventResult.getRegattaResults()) { for (RaceResultDescriptor race : regattaResult.getRaceResults()) { - // add only the tracked races + // add only the tracked races if (race.isTracked() != null && race.isTracked() == true) { - SwissTimingRaceRecordDTO swissTimingRaceRecordDTO = new SwissTimingRaceRecordDTO(race.getId(), race.getName(), + SwissTimingRaceRecordDTO swissTimingRaceRecordDTO = new SwissTimingRaceRecordDTO(race.getId(), race.getName(), regattaResult.getName(), race.getSeriesName(), race.getFleetName(), race.getStatus(), race.getStartTime(), regattaResult.getXrrEntriesUrl() != null ? regattaResult.getXrrEntriesUrl().toExternalForm() : null, hasRememberedRegatta(race.getId())); swissTimingRaceRecordDTO.boatClass = regattaResult.getIsafId() != null && !regattaResult.getIsafId().isEmpty() ? regattaResult.getIsafId() : regattaResult.getClassName(); @@ -2574,12 +2574,12 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected RaceLogStore getRaceLogStore() { return MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory); } - + protected RegattaLogStore getRegattaLogStore() { return MongoRegattaLogStoreFactory.INSTANCE.getMongoRegattaLogStore( mongoObjectFactory, domainObjectFactory); @@ -2592,7 +2592,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet @Override public List listSwissTiminigReplayRaces(String swissTimingUrl) { List replayRaces = getSwissTimingReplayService().listReplayRaces(swissTimingUrl); - List result = new ArrayList(replayRaces.size()); + List result = new ArrayList(replayRaces.size()); for (SwissTimingReplayRace replayRace : replayRaces) { result.add(new SwissTimingReplayRaceDTO(replayRace.getFlightNumber(), replayRace.getRaceId(), replayRace.getRsc(), replayRace.getName(), replayRace.getBoatClass(), replayRace.getStartTime(), @@ -2631,7 +2631,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } /** - * Finds a competitor in a sequence of competitors that has an {@link Competitor#getId()} equal to id. + * Finds a competitor in a sequence of competitors that has an {@link Competitor#getId()} equal to id. */ private Competitor getCompetitorByIdAsString(Iterable competitors, String idAsString) { for (Competitor c : competitors) { @@ -2730,7 +2730,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet case RACE_IMPLIED_WIND: final RankingMetric rankingMetric = trackedRace.getRankingMetric(); if (rankingMetric instanceof ORCPerformanceCurveRankingMetric) { - final ORCPerformanceCurveRankingMetric orcPcsRankingMetric = + final ORCPerformanceCurveRankingMetric orcPcsRankingMetric = (ORCPerformanceCurveRankingMetric) rankingMetric; try { final Speed impliedWind = orcPcsRankingMetric.getImpliedWind(competitor, timePoint, cache); @@ -2864,7 +2864,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet result = getBravoDoubleValue(BravoFixTrack::getTargetBoatspeedPIfAvailable, trackedRace, competitor, timePoint); break; } - + case EXPEDITION_RACE_AWA: { result = getBravoDoubleValue(BravoFixTrack::getExpeditionAWAIfAvailable, trackedRace, competitor, timePoint); break; @@ -3035,17 +3035,17 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet TrackedRace trackedRace, Competitor competitor, TimePoint timePoint) { return getBravoValue(valueGetter, Function.identity(), trackedRace, competitor, timePoint); } - + private Double getBravoBearingInDegrees(BiFunction, TimePoint, Bearing> valueGetter, TrackedRace trackedRace, Competitor competitor, TimePoint timePoint) { return getBravoValue(valueGetter, Bearing::getDegrees, trackedRace, competitor, timePoint); } - + private Double getBravoDistanceInMeters(BiFunction, TimePoint, Distance> valueGetter, TrackedRace trackedRace, Competitor competitor, TimePoint timePoint) { return getBravoValue(valueGetter, Distance::getMeters, trackedRace, competitor, timePoint); } - + private Double getBravoValue(BiFunction, TimePoint, T> valueGetter, Function mapperToDouble, TrackedRace trackedRace, Competitor competitor, TimePoint timePoint) { @@ -3063,7 +3063,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet @Override public CompetitorsRaceDataDTO getCompetitorsRaceData(RegattaAndRaceIdentifier race, List competitors, Date from, Date to, - final long stepSizeInMillis, final DetailType detailType, final String leaderboardGroupName, final UUID leaderboardGroupId, + final long stepSizeInMillis, final DetailType detailType, final String leaderboardGroupName, final UUID leaderboardGroupId, final String leaderboardName) throws NoWindException, NotFoundException { CompetitorsRaceDataDTO result = null; final TrackedRace trackedRace = getExistingTrackedRace(race); @@ -3155,7 +3155,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } @Override - public List, List>> getLeaderboardDataEntriesForAllRaceColumns(String leaderboardName, + public List, List>> getLeaderboardDataEntriesForAllRaceColumns(String leaderboardName, Date date, DetailType detailType) throws Exception { List, List>> result = new ArrayList<>(); // Attention: The reason why we read the data from the LeaderboardDTO and not from the leaderboard directly is to ensure @@ -3179,7 +3179,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet competitorDTOs.add(baseDomainFactory.convertToCompetitorDTO(e2.getKey())); pointSums.add(e2.getValue()); } - result.add(new Triple<>(e.getKey().getName(), competitorDTOs, pointSums)); + result.add(new Triple<>(e.getKey().getName(), competitorDTOs, pointSums)); } break; case REGATTA_RANK: @@ -3450,14 +3450,14 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet getSecurityService().checkCurrentUserReadPermission(leaderboardGroupByName); return leaderboardGroupByName == null ? null : convertToLeaderboardGroupDTO(leaderboardGroupByName, withGeoLocationData, false); } - + @Override public LeaderboardGroupDTO getLeaderboardGroupById(final UUID groupId) { final LeaderboardGroup leaderboardGroupById = getService().getLeaderboardGroupByID(groupId); getSecurityService().checkCurrentUserReadPermission(leaderboardGroupById); return leaderboardGroupById == null ? null : convertToLeaderboardGroupDTO(leaderboardGroupById, false, false); } - + /** * @see #getLeaderboardGroupByIdOrName(UUID, String) */ @@ -3467,7 +3467,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet getSecurityService().checkCurrentUserReadPermission(leaderboardGroup); return leaderboardGroup == null ? null : convertToLeaderboardGroupDTO(leaderboardGroup, false, false); } - + protected LeaderboardGroupDTO convertToLeaderboardGroupDTO(final LeaderboardGroup leaderboardGroup, final boolean withGeoLocationData, final boolean withStatisticalData) { final LeaderboardGroupDTO groupDTO = new LeaderboardGroupDTO(leaderboardGroup.getId(), @@ -3531,7 +3531,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet public String[] getReplicableIdsAsStringThatShallLeadToWarningAboutInstanceBeingReplica() { return new String[] { getService().getId().toString() }; } - + @Override public void startReplicatingFromMaster(String messagingHost, String masterHostName, String exchangeName, int servletPort, int messagingPort, String usernameOrNull, String passwordOrNull) @@ -3571,7 +3571,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet /** * Determines the base URL (protocol, host and port parts) used for the currently executing servlet request. Defaults * to http://sapsailing.com. - * @throws MalformedURLException + * @throws MalformedURLException */ private URL getRequestBaseURL() throws MalformedURLException { final URL url = new URL(getThreadLocalRequest().getRequestURL().toString()); @@ -3603,7 +3603,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return sailingServerDTO; } - + private Iterable convertToEventDTOs(Iterable events) { List result = new ArrayList<>(); for (EventBase event : events) { @@ -3624,7 +3624,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return imageDimensions; } - + protected String getEventBaseURLFromEventOrRequest(Event event) throws MalformedURLException { return event.getBaseURL() == null ? getRequestBaseURL().toString() : event.getBaseURL().toString(); } @@ -3650,7 +3650,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet leaderboardGroupBase.getDescription(), leaderboardGroupBase.getDisplayName(), leaderboardGroupBase.hasOverallLeaderboard()); } - + private void copyEventBaseFieldsToDTO(EventBase event, EventBaseDTO eventDTO) { eventDTO.venue = new VenueDTO(event.getVenue() != null ? event.getVenue().getName() : null); eventDTO.startDate = event.getStartDate() != null ? event.getStartDate().asDate() : null; @@ -3763,7 +3763,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } private VideoDTO convertToVideoDTO(VideoDescriptor video) { - VideoDTO result = new VideoDTO(video.getURL().toString(), video.getMimeType(), + VideoDTO result = new VideoDTO(video.getURL().toString(), video.getMimeType(), video.getCreatedAtDate() != null ? video.getCreatedAtDate().asDate() : null); result.setCopyright(video.getCopyright()); result.setTitle(video.getTitle()); @@ -3786,7 +3786,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return Locale.forLanguageTag(localeName); } - + private String toLocaleName(Locale locale) { if(locale == null) { return null; @@ -3820,7 +3820,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet courseAreaDTO.id = courseArea.getId(); return courseAreaDTO; } - + /** for backward compatibility with the regatta overview */ @Override public List getRegattaStructureForEvent(UUID eventId) { @@ -3882,9 +3882,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet * The name of the regatta to be shown on the regatta overview webpage is retrieved from the name of the {@link Leaderboard}. Since regattas are * not always represented by a {@link Regatta} object in the Sailing Suite but need to be shown on the regatta overview page, the leaderboard is * used as the representative of the sailing regatta. When a display name is set for a leaderboard, this name is favored against the (mostly technical) - * regatta name as the display name represents the publicly visible name of the regatta. + * regatta name as the display name represents the publicly visible name of the regatta. *
    - * When the leaderboard is a {@link RegattaLeaderboard} the name of the {@link Regatta} is used, otherwise the leaderboard + * When the leaderboard is a {@link RegattaLeaderboard} the name of the {@link Regatta} is used, otherwise the leaderboard * is a {@link FlexibleLeaderboard} and it's name is used as the last option. * @param leaderboard The {@link Leaderboard} from which the name is be retrieved * @return the name of the regatta to be shown on the regatta overview page @@ -3939,7 +3939,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet return new ScoreCorrectionEntryDTO(scoreCorrectionForCompetitor.getPoints(), scoreCorrectionForCompetitor.isDiscarded(), scoreCorrectionForCompetitor.getMaxPointsReason()); } - + @Override public List> getUrlResultProviderNamesAndOptionalSampleURL() { List> result = new ArrayList<>(); @@ -4091,7 +4091,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet /** * The client's day starts at 00:00:00Z - clientTimeZoneOffset and ends at * 23:59:59Z - clientTimeZoneOffset. - * + * * @param visibleRegattas * if {@code null}, entries from any regatta will be accepted; otherwise (including in case of an empty * list), only entries from regattas whose name is in the list will be accepted. @@ -4105,7 +4105,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (leaderboard != null) { if (visibleRegattas != null && !visibleRegattas.contains(leaderboard.getName())) { return result; - } + } String regattaName = getRegattaNameFromLeaderboard(leaderboard); if (leaderboard instanceof RegattaLeaderboard) { RegattaLeaderboard regattaLeaderboard = (RegattaLeaderboard) leaderboard; @@ -4140,7 +4140,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + private SeriesParameters getSeriesParameters(SeriesDTO seriesDTO) { SeriesParameters series = new SeriesParameters(seriesDTO.isFirstColumnIsNonDiscardableCarryForward(), seriesDTO.hasSplitFleetContiguousScoring(), seriesDTO.hasCrossFleetMergedRanking(), @@ -4153,7 +4153,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet series.setDiscardingThresholds(seriesDTO.getDiscardThresholds()); return series; } - + protected LinkedHashMap getSeriesCreationParameters(RegattaDTO regattaDTO) { LinkedHashMap seriesCreationParams = new LinkedHashMap(); for (SeriesDTO series : regattaDTO.series){ @@ -4167,7 +4167,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } @Override - public Iterable getRegattas(String manage2SailJsonUrl) { + public Iterable getRegattas(String manage2SailJsonUrl) { StructureImporter structureImporter = new StructureImporter(new SetRacenumberFromSeries(), baseDomainFactory); Iterable parsedEvent = structureImporter.parseEvent(manage2SailJsonUrl); List regattaDTOs = new ArrayList(); @@ -4229,7 +4229,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (!raceColumn.isCarryForward()) { for (Fleet fleet : raceColumn.getFleets()) { RegattaOverviewEntryDTO entry = createRegattaOverviewEntryDTO(leaderboard, - boatClassName, regattaName, buyZoneRadius, seriesName, raceColumn, fleet, showOnlyRacesOfSameDay, + boatClassName, regattaName, buyZoneRadius, seriesName, raceColumn, fleet, showOnlyRacesOfSameDay, clientTimeZoneOffset, dayToCheck); if (entry != null) { addRegattaOverviewEntryToEntriesPerFleet(entriesPerFleet, fleet, entry); @@ -4254,7 +4254,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet if (!entry.raceInfo.isRaceAbortedInPassBefore) { result.remove(entry); } - + } } } @@ -4273,7 +4273,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet private void addRegattaOverviewEntryToEntriesPerFleet(Map> entriesPerFleet, Fleet fleet, RegattaOverviewEntryDTO entry) { if (!entriesPerFleet.containsKey(fleet.getName())) { - entriesPerFleet.put(fleet.getName(), new ArrayList()); + entriesPerFleet.put(fleet.getName(), new ArrayList()); } entriesPerFleet.get(fleet.getName()).add(entry); } @@ -4382,8 +4382,8 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet raceLog.lockForRead(); try { for(RaceLogEvent raceLogEvent: raceLog.getRawFixes()) { - RaceLogEventDTO entry = new RaceLogEventDTO(raceLogEvent.getPassId(), - raceLogEvent.getAuthor().getName(), raceLogEvent.getAuthor().getPriority(), + RaceLogEventDTO entry = new RaceLogEventDTO(raceLogEvent.getPassId(), + raceLogEvent.getAuthor().getName(), raceLogEvent.getAuthor().getPriority(), raceLogEvent.getCreatedAt() != null ? raceLogEvent.getCreatedAt().asDate() : null, raceLogEvent.getLogicalTimePoint() != null ? raceLogEvent.getLogicalTimePoint().asDate() : null, raceLogEvent.getClass().getSimpleName(), raceLogEvent.getShortInfo()); @@ -4408,8 +4408,8 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet regattaLog.lockForRead(); try { for(RegattaLogEvent raceLogEvent: regattaLog.getRawFixes()) { - RegattaLogEventDTO entry = new RegattaLogEventDTO( - raceLogEvent.getAuthor().getName(), raceLogEvent.getAuthor().getPriority(), + RegattaLogEventDTO entry = new RegattaLogEventDTO( + raceLogEvent.getAuthor().getName(), raceLogEvent.getAuthor().getPriority(), raceLogEvent.getCreatedAt() != null ? raceLogEvent.getCreatedAt().asDate() : null, raceLogEvent.getLogicalTimePoint() != null ? raceLogEvent.getLogicalTimePoint().asDate() : null, raceLogEvent.getClass().getSimpleName(), raceLogEvent.getShortInfo()); @@ -4502,7 +4502,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet Map competitorsAndBoats = getService().getCompetitorToBoatMappingsForRace(leaderboardName, raceColumnName, fleetName); return baseDomainFactory.convertToCompetitorAndBoatDTOs(competitorsAndBoats); } - + @Override public Iterable getAllBoats() { final HasPermissions.Action[] requiredActionsForRead = SecuredSecurityTypes.PublicReadableActions.READ_AND_READ_PUBLIC_ACTIONS; @@ -4608,7 +4608,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return dto; } - + private void copyBasicRacingProcedureProperties(RacingProcedureConfiguration configuration, final RacingProcedureConfigurationDTO racingProcedureConfigurationDTO) { racingProcedureConfigurationDTO.classFlag = configuration.getClassFlag(); racingProcedureConfigurationDTO.hasIndividualRecall = configuration.hasIndividualRecall(); @@ -4700,7 +4700,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new com.sap.sse.common.Util.Triple(result.getA() == null ? null : result.getA().asDate(), result.getB(), result.getC()); } - + @Override public com.sap.sse.common.Util.Triple getFinishingAndFinishTime(String leaderboardName, @@ -4741,11 +4741,11 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet protected RaceLogTrackingAdapter getRaceLogTrackingAdapter() { return getRaceLogTrackingAdapterFactory().getAdapter(getBaseDomainFactory()); } - + protected YellowBrickTrackingAdapterFactory getYellowBrickTrackingAdapterFactory() { return yellowBrickTrackingAdapterTracker.getService(); } - + protected YellowBrickTrackingAdapter getYellowBrickTrackingAdapter() { return getYellowBrickTrackingAdapterFactory().getYellowBrickTrackingAdapter(getBaseDomainFactory()); } @@ -4782,7 +4782,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet protected RaceLog getRaceLog(com.sap.sse.common.Util.Triple triple) throws NotFoundException { return getRaceLog(triple.getA(), triple.getB(), triple.getC()); } - + protected RegattaLog getRegattaLogInternal(String leaderboardName) throws DoesNotHaveRegattaLogException { Leaderboard l = getService().getLeaderboardByName(leaderboardName); if (! (l instanceof HasRegattaLike)) { @@ -4790,7 +4790,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return ((HasRegattaLike) l).getRegattaLike().getRegattaLog(); } - + protected RaceLog getRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { RaceColumn raceColumn = getRaceColumn(leaderboardName, raceColumnName); Fleet fleet = getFleetByName(raceColumn, fleetName); @@ -4800,7 +4800,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet protected Competitor getCompetitor(CompetitorDTO dto) { return getService().getCompetitorAndBoatStore().getExistingCompetitorByIdAsString(dto.getIdAsString()); } - + protected CompetitorWithBoat getCompetitor(CompetitorWithBoatDTO dto) { return getService().getCompetitorAndBoatStore().getExistingCompetitorWithBoatByIdAsString(dto.getIdAsString()); } @@ -4823,7 +4823,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + /** * Also finds the last position of the marks if set by pinging them as long as currently a {@link TrackedRace} exists * whose tracking interval spans the current time. If at least a non-spanning {@link TrackedRace} can be found in the @@ -4836,7 +4836,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet final Position lastPos = getService().getMarkPosition(mark, leaderboard, now); return convertToMarkDTO(mark, lastPos); } - + /** * @param trackedRace * if null, no position data will be attached to the {@link MarkDTO}s @@ -4853,7 +4853,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new WaypointDTO(waypoint.getName(), cp, waypoint.getPassingInstructions()); } - + /** * @param course * the course to convert @@ -4878,7 +4878,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + @Override public RaceCourseDTO getLastCourseDefinitionInRaceLog(final String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { final RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); @@ -4895,7 +4895,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } }, /* timePoint */ MillisecondsTimePoint.now()); } - + private TypeBasedServiceFinder getDeviceIdentifierStringSerializerHandlerFinder( boolean withFallback) { TypeBasedServiceFinderFactory factory = getService().getTypeBasedServiceFinderFactory(); @@ -4905,35 +4905,35 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return finder; } - + private DeviceIdentifier deserializeDeviceIdentifier(String type, String deviceId) throws NoCorrespondingServiceRegisteredException, TransformationException { DeviceIdentifierStringSerializationHandler handler = getDeviceIdentifierStringSerializerHandlerFinder(false).findService(type); return handler.deserialize(deviceId, type, deviceId); } - + protected String serializeDeviceIdentifier(DeviceIdentifier deviceId) throws TransformationException { return getDeviceIdentifierStringSerializerHandlerFinder(true).findService( deviceId.getIdentifierType()).serialize(deviceId).getB(); } - + protected List> getLogHierarchy(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { List> result = new ArrayList<>(); RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); - + if (raceLog != null){ result.add(raceLog); } - + Leaderboard leaderboard = getLeaderboardByName(leaderboardName); if (leaderboard instanceof HasRegattaLike) { result.add(((HasRegattaLike) leaderboard).getRegattaLike().getRegattaLog()); } return result; } - + @Override public List getDeserializableDeviceIdentifierTypes() { List result = new ArrayList(); @@ -4943,7 +4943,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected DeviceMapping convertToDeviceMapping(DeviceMappingDTO dto) throws NoCorrespondingServiceRegisteredException, TransformationException { DeviceIdentifier device = deserializeDeviceIdentifier(dto.deviceIdentifier.deviceType, dto.deviceIdentifier.deviceId); @@ -4972,12 +4972,12 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet public Collection getGPSFixImporterTypes() { return getRegisteredImporterTypes(GPSFixImporter.class); } - + @Override public Collection getSensorDataImporterTypes() { return getRegisteredImporterTypes(DoubleVectorFixImporter.class); } - + private Collection getRegisteredImporterTypes(Class referenceClass) { Set result = new HashSet<>(); for (ServiceReference reference : getRegisteredServiceReferences(referenceClass)) { @@ -4985,7 +4985,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected S getRegisteredImporter(Class referenceClass, String type) throws NoCorrespondingServiceRegisteredException { for (ServiceReference reference : getRegisteredServiceReferences(referenceClass)) { @@ -4996,7 +4996,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } throw new NoCorrespondingServiceRegisteredException("No importer service found!", type, referenceClass.getName()); } - + private Collection> getRegisteredServiceReferences(Class referenceClass) { try { return Activator.getDefault().getServiceReferences(referenceClass, null); @@ -5005,7 +5005,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return Collections.emptyList(); } - + @Override public ArrayList getEventsForLeaderboard(String leaderboardName) { final RacingEventService service = getService(); @@ -5063,7 +5063,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet /** * Gets all Marks defined in the RegattaLog and the trackedRace - * @throws DoesNotHaveRegattaLogException + * @throws DoesNotHaveRegattaLogException */ @Override public Iterable getMarksInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException { @@ -5106,7 +5106,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } } return result; - } + } public boolean doesRegattaLogContainCompetitors(String leaderboardName) throws DoesNotHaveRegattaLogException, NotFoundException { @@ -5151,7 +5151,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet Fleet fleet = getFleetByName(raceColumn, fleetName); return convertToCompetitorAndBoatDTOs(raceColumn.getAllCompetitorsAndTheirBoats(fleet)); } - + @Override public Collection getCompetitorRegistrationsForLeaderboard(String leaderboardName) throws NotFoundException { Leaderboard leaderboard = getLeaderboardByName(leaderboardName); @@ -5169,7 +5169,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet HasRegattaLike regattaLikeLeaderboard = ((HasRegattaLike) leaderboard); return convertToCompetitorDTOs(regattaLikeLeaderboard.getCompetitorsRegisteredInRegattaLog()); } - + @Override public List getCompetitorRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { @@ -5178,7 +5178,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet Fleet fleet = getFleetByName(raceColumn, fleetName); return convertToCompetitorAndBoatDTOs(raceColumn.getCompetitorsRegisteredInRacelog(fleet)); } - + @Override public Map getCompetitorAndBoatRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { @@ -5199,7 +5199,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet HasRegattaLike regattaLikeLeaderboard = ((HasRegattaLike) leaderboard); return convertToBoatDTOs(regattaLikeLeaderboard.getBoatsRegisteredInRegattaLog()); } - + @Override public Collection getBoatRegistrationsForLeaderboard(String leaderboardName) throws NotFoundException { Leaderboard leaderboard = getLeaderboardByName(leaderboardName); @@ -5224,7 +5224,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet Fleet fleet = getFleetByName(raceColumn, fleetName); return raceColumn.isCompetitorRegistrationInRacelogEnabled(fleet); } - + protected Fleet getFleetByName(RaceColumn raceColumn, String fleetName) throws NotFoundException{ Fleet fleet = raceColumn.getFleetByName(fleetName); if (fleet == null){ @@ -5232,7 +5232,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return fleet; } - + protected Leaderboard getLeaderboardByName(String leaderboardName) throws NotFoundException{ Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName); if (leaderboard == null){ @@ -5240,12 +5240,12 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return leaderboard; } - + protected RaceColumn getRaceColumn(String leaderboardName, String raceColumnName) throws NotFoundException{ Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName); if (leaderboard == null){ throw new NotFoundException("leaderboard with name "+leaderboardName+" not found"); - } + } RaceColumn raceColumn = leaderboard.getRaceColumnByName(raceColumnName); if (raceColumn == null){ throw new NotFoundException("raceColumn with name "+raceColumnName+" not found"); @@ -5298,7 +5298,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + private GPSFixDTO convertToGPSFixDTO(GPSFix fix) { final GPSFixDTO result; if (fix == null) { @@ -5340,10 +5340,10 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet @Override public Map, Pair> getTrackingTimes( Collection> leaderboardRaceColumnFleetNames) { - Map, Pair> trackingTimes = new HashMap<>(); + Map, Pair> trackingTimes = new HashMap<>(); for (Triple leaderboardRaceColumnFleetName : leaderboardRaceColumnFleetNames) { try { - trackingTimes.put(leaderboardRaceColumnFleetName, getTrackingTimes(leaderboardRaceColumnFleetName.getA(), + trackingTimes.put(leaderboardRaceColumnFleetName, getTrackingTimes(leaderboardRaceColumnFleetName.getA(), leaderboardRaceColumnFleetName.getB(), leaderboardRaceColumnFleetName.getC())); } catch (Exception e) { trackingTimes.put(leaderboardRaceColumnFleetName, null); @@ -5362,7 +5362,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet final RegattaLeaderboardWithEliminations rlwe = (RegattaLeaderboardWithEliminations) leaderboard; return convertToCompetitorDTOs(rlwe.getEliminatedCompetitors()); } - + @Override public Iterable determineDetailTypesForCompetitorChart(String leaderboardGroupName, UUID leaderboardGroupId, RegattaAndRaceIdentifier identifier) { @@ -5435,15 +5435,15 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet @Override public PairingListTemplateDTO calculatePairingListTemplate(final int flightCount, final int groupCount, final int competitorCount, final int flightMultiplier, final int tolerance) { - PairingListTemplate template = getService().createPairingListTemplate(flightCount, groupCount, competitorCount, + PairingListTemplate template = getService().createPairingListTemplate(flightCount, groupCount, competitorCount, flightMultiplier, tolerance); return new PairingListTemplateDTO(flightCount, groupCount, competitorCount, flightMultiplier, tolerance, template.getBoatChanges(), template.getPairingListTemplate(), template.getQuality(), template.getBoatAssignmentsQuality()); } - + @Override public PairingListDTO getPairingListFromTemplate(final String leaderboardName, final int flightMultiplier, - final Iterable selectedRaceColumnNames, PairingListTemplateDTO templateDTO) + final Iterable selectedRaceColumnNames, PairingListTemplateDTO templateDTO) throws NotFoundException, PairingListCreationException { Leaderboard leaderboard = getLeaderboardByName(leaderboardName); getSecurityService().checkCurrentUserReadPermission(leaderboard); @@ -5487,7 +5487,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new PairingListDTO(result, Util.asList(selectedRaceColumnNames)); } - + @Override public PairingListDTO getPairingListFromRaceLogs(final String leaderboardName) throws NotFoundException { Leaderboard leaderboard = getLeaderboardByName(leaderboardName); @@ -5504,7 +5504,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet final Boat boat = competitorAndBoatPair.getB(); fleetList.add(new Pair(baseDomainFactory.convertToCompetitorDTO(competitorAndBoatPair.getA()), new BoatDTO(boat.getId().toString(), boat.getName(), - convertToBoatClassDTO(boat.getBoatClass()), boat.getSailID(), + convertToBoatClassDTO(boat.getBoatClass()), boat.getSailID(), boat.getColor()))); } if (fleetList.size() > 0) { @@ -5521,7 +5521,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return new PairingListDTO(result, raceColumnNames); } - + public List getRaceDisplayNamesFromLeaderboard(String leaderboardName,List raceColumnNames) throws NotFoundException { Leaderboard leaderboard = this.getLeaderboardByName(leaderboardName); getSecurityService().checkCurrentUserReadPermission(leaderboard); @@ -5651,7 +5651,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + protected boolean isSmartphoneTrackingEnabled(DynamicTrackedRace trackedRace) { boolean result = false; for (RaceLog raceLog : trackedRace.getAttachedRaceLogs()) { @@ -5663,7 +5663,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + @Override public SliceRacePreperationDTO prepareForSlicingOfRace(final RegattaAndRaceIdentifier raceIdentifier) { getSecurityService().checkCurrentUserReadPermission(raceIdentifier); @@ -5686,7 +5686,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet currentCount++; return new SliceRacePreperationDTO(prefix + currentCount, alreadyUsedRaceNames); } - + @Override public Boolean checkIfRaceIsTracking(RegattaAndRaceIdentifier race) { getSecurityService().checkCurrentUserReadPermission(race); @@ -5719,9 +5719,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet /** * Takes a list of source URLs, the resizing task and the sizes of the resized images to create a ImageDTO for every * resized image - * + * * @author Robin Fleige (D067799) - * + * * @param sourceRefs * list of source URLs * @param resizingTask @@ -5799,7 +5799,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + public String createRaceBoardLinkQrCode(String url) { String result; try { @@ -5810,7 +5810,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + public String createEncodedQRCodeFromUrl(String url, int size) throws Exception { final String result; DataInputStream imageIs = new DataInputStream(QRCodeGenerationUtil.create(url, size, "H")); @@ -6009,7 +6009,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet getService().getSecurityService().checkCurrentUserReadPermission(leaderboard); return getORCPerformanceCurveLegInfo(Collections.singleton(getRaceLog(leaderboardName, raceColumnName, fleetName))); } - + private Map getORCPerformanceCurveLegInfo(Iterable raceLogs) { final Map result = new HashMap<>(); for (final RaceLog raceLog : raceLogs) { @@ -6235,7 +6235,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } else { throw new IllegalArgumentException("Waypoints must contain one or two marks"); } - + return new WaypointTemplateImpl(controlPointTemplate, waypointTemplate.getPassingInstruction()); } @@ -6271,7 +6271,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } } return result; - + } @Override @@ -6282,7 +6282,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet getSecurityService().checkCurrentUserUpdatePermission(raceIdentifier); getSecurityService().checkCurrentUserUpdatePermission(regattaLeaderboard); getSecurityService().checkCurrentUserUpdatePermission(regatta); - + final boolean result; if (regatta == null || !(regattaLeaderboard instanceof RegattaLeaderboard) || trackedRace == null || trackedRace.getStartOfTracking() == null || !isSmartphoneTrackingEnabled(trackedRace)) { @@ -6295,7 +6295,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet } return result; } - + @Override public Integer getAdminConsoleChangeLogSize() { try (CloseableHttpClient client = HttpClients.createDefault()) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java index 41d70e68269..5b7adb28cc2 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java @@ -769,7 +769,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili com.sap.sse.common.Util.Pair, Exception> eventsOrException = getService() .updateRemoteServerEventCacheSynchronously(serverRef, false); return createRemoteSailingServerReferenceDTO(serverRef, eventsOrException); - + } @Override @@ -1276,9 +1276,9 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili Map cachedRegattaEntriesLists = new HashMap(); for (SwissTimingRaceRecordDTO rr : rrs) { BoatClass boatClass = getBaseDomainFactory().getOrCreateBoatClass(rr.boatClass); - String raceDescription = rr.regattaName != null ? rr.regattaName : ""; + String raceDescription = rr.regattaName != null ? rr.regattaName : ""; raceDescription += rr.seriesName != null ? "/" + rr.seriesName : ""; - raceDescription += raceDescription.length() > 0 ? "/" + rr.getName() : rr.getName(); + raceDescription += raceDescription.length() > 0 ? "/" + rr.getName() : rr.getName(); // try to find a cached entry list for the regatta RegattaResults regattaResults = cachedRegattaEntriesLists.get(rr.xrrEntriesUrl); if (regattaResults == null && rr.xrrEntriesUrl != null) { @@ -1583,15 +1583,15 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili } @Override - public void updateRegatta(RegattaIdentifier regattaName, Date startDate, Date endDate, List courseAreaUuids, + public void updateRegatta(RegattaIdentifier regattaName, Date startDate, Date endDate, List courseAreaUuids, RegattaConfigurationDTO configurationDTO, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference, boolean controlTrackingFromStartAndFinishTimes, boolean autoRestartTrackingUponCompetitorSetChange, String registrationLinkSecret, CompetitorRegistrationType registrationType) { Regatta regatta = getService().getRegatta(regattaName); if (regatta != null) { SecurityUtils.getSubject().checkPermission(SecuredDomainType.REGATTA.getStringPermissionForObject(DefaultActions.UPDATE, regatta)); } - TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null; - TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null; + TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null; + TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null; getService().apply(new UpdateSpecificRegatta(regattaName, startTimePoint, endTimePoint, courseAreaUuids, convertToRegattaConfiguration(configurationDTO), buoyZoneRadiusInHullLengths, useStartTimeInference, controlTrackingFromStartAndFinishTimes, autoRestartTrackingUponCompetitorSetChange, registrationLinkSecret, registrationType)); @@ -1614,7 +1614,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili } return result; } - + @Override public void updateSeries(RegattaIdentifier regattaIdentifier, String seriesName, String newSeriesName, boolean isMedal, boolean isFleetsCanRunInParallel, int[] resultDiscardingThresholds, boolean startsWithZeroScore, @@ -2192,7 +2192,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili * {@code competitorsToRegister} to avoid registering them again and then returns those competitors that need to be * de-registered. Those to de-register includes those registered but to a different boat, and those will be left in * the {@code competitorToBoatMappingsToRegister} map. - * + * * @param competitorToBoatMappingsToRegister * will be modified by removing all competitors in {@code competitorsRegistered} * @param competitorToBoatMappingsRegistered @@ -2500,7 +2500,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili private , VisitorT> boolean revokeEvent(boolean eventRevoked, Serializable idToRevoke, final AbstractLog abstractLog) throws NotRevokableException { - final EventT event; + final EventT event; abstractLog.lockForRead(); try { event = abstractLog.getEventById(idToRevoke); @@ -2508,12 +2508,12 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili abstractLog.unlockAfterRead(); } if (event != null) { - abstractLog.revokeEvent(getService().getServerAuthor(), event, "revoke triggered by GWT user action"); + abstractLog.revokeEvent(getService().getServerAuthor(), event, "revoke triggered by GWT user action"); eventRevoked = true; } return eventRevoked; } - + private void startRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName, final boolean trackWind, final boolean correctWindByDeclination) throws NotDenotedForRaceLogTrackingException, Exception { // no permission checks needed here, since they already exist in PermissionAwareRaceTrackingHandler @@ -2523,7 +2523,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili getRaceLogTrackingAdapter().startTracking(getService(), leaderboard, raceColumn, fleet, trackWind, correctWindByDeclination, getService().getPermissionAwareRaceTrackingHandler()); } - + @Override public void startRaceLogTracking(List> leaderboardRaceColumnFleetNames, final boolean trackWind, final boolean correctWindByDeclination) @@ -2587,7 +2587,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili new MillisecondsTimePoint(dateOfMarkPassing), indexOfWaypoint)); } } - + @Override public void updateSuppressedMarkPassings(String leaderboardName, String raceColumnName, String fleetName, Integer newZeroBasedIndexOfSuppressedMarkPassing, CompetitorDTO competitorDTO) throws NotFoundException { @@ -2934,7 +2934,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili hasFinishingTime = false; hasFinishedTime = false; } - + // Only wind fixes in the new tracking interval as well as the best fallback fixes are added to the new RaceLog final LogEventTimeRangeWithFallbackFilter windFixEvents = new LogEventTimeRangeWithFallbackFilter<>( timeRange); @@ -2951,7 +2951,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getStartTimeDifference(), event.getNextStatus(), event.getCourseAreaId())); } } - + @Override public void visit(RaceLogStartTimeEvent event) { if (!dependentStartTime && isLatestPass(event)) { @@ -2960,32 +2960,32 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getNextStatus(), event.getCourseAreaId())); } } - + @Override public void visit(RaceLogRegisterCompetitorEvent event) { raceLog.add(new RaceLogRegisterCompetitorEventImpl(event.getCreatedAt(), event.getLogicalTimePoint(), event.getAuthor(), UUID.randomUUID(), raceLog.getCurrentPassId(), event.getCompetitor(), event.getBoat())); } - + @Override public void visit(RaceLogWindFixEvent event) { windFixEvents.addEvent(event); } - + @Override public void visit(RaceLogUseCompetitorsFromRaceLogEvent event) { raceLog.add(new RaceLogUseCompetitorsFromRaceLogEventImpl(event.getCreatedAt(), event.getAuthor(), event.getLogicalTimePoint(), UUID.randomUUID(), raceLog.getCurrentPassId())); } - + @Override public void visit(RaceLogCourseDesignChangedEvent event) { raceLog.add(new RaceLogCourseDesignChangedEventImpl(event.getCreatedAt(), event.getLogicalTimePoint(), event.getAuthor(), UUID.randomUUID(), raceLog.getCurrentPassId(), event.getCourseDesign(), event.getCourseDesignerMode())); } - + @Override public void visit(RaceLogFlagEvent event) { if (hasStartTime && isLatestPass(event) && !event.getLogicalTimePoint().after(sliceTo)) { @@ -2994,7 +2994,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getLowerFlag(), event.isDisplayed())); } } - + @Override public void visit(RaceLogStartProcedureChangedEvent event) { if (hasStartTime && isLatestPass(event)) { @@ -3003,7 +3003,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili raceLog.getCurrentPassId(), event.getStartProcedureType())); } } - + @Override public void visit(RaceLogFinishPositioningConfirmedEvent event) { if (hasFinishedTime && isLatestPass(event)) { @@ -3012,7 +3012,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili raceLog.getCurrentPassId(), event.getPositionedCompetitorsIDsNamesMaxPointsReasons())); } } - + @Override public void visit(RaceLogFinishPositioningListChangedEvent event) { if (hasFinishedTime && isLatestPass(event)) { @@ -3021,7 +3021,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili raceLog.getCurrentPassId(), event.getPositionedCompetitorsIDsNamesMaxPointsReasons())); } } - + @Override public void visit(RaceLogFixedMarkPassingEvent event) { if (hasStartTime && isLatestPass(event) && timeRange.includes(event.getTimePointOfFixedPassing())) { @@ -3031,7 +3031,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getTimePointOfFixedPassing(), event.getZeroBasedIndexOfPassedWaypoint())); } } - + @Override public void visit(RaceLogSuppressedMarkPassingsEvent event) { if (hasStartTime && isLatestPass(event) && timeRange.includes(event.getLogicalTimePoint())) { @@ -3041,7 +3041,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getZeroBasedIndexOfFirstSuppressedWaypoint())); } } - + @Override public void visit(RaceLogProtestStartTimeEvent event) { if (hasFinishedTime && isLatestPass(event)) { @@ -3050,7 +3050,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili raceLog.getCurrentPassId(), event.getProtestTime())); } } - + @Override public void visit(RaceLogAdditionalScoringInformationEvent event) { if (hasFinishedTime && isLatestPass(event)) { @@ -3059,7 +3059,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili raceLog.getCurrentPassId(), event.getType())); } } - + @Override public void visit(RaceLogPathfinderEvent event) { if (hasStartTime && isLatestPass(event)) { @@ -3068,7 +3068,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getPathfinderId())); } } - + @Override public void visit(RaceLogGateLineOpeningTimeEvent event) { if (hasStartTime && isLatestPass(event)) { @@ -3078,7 +3078,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili event.getGateLineOpeningTimes().getGolfDownTime())); } } - + @Override public void visit(RaceLogRaceStatusEvent event) { if (isLatestPass(event) && !(event instanceof RaceLogDependentStartTimeEvent) @@ -3093,7 +3093,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili } } } - + @Override public void visit(RaceLogORCImpliedWindSourceEvent event) { raceLog.add(new RaceLogORCImpliedWindSourceEventImpl(event.getCreatedAt(), @@ -3138,7 +3138,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili final RaceHandle raceHandle = getRaceLogTrackingAdapter().startTracking(getService(), regattaLeaderboard, raceColumn, fleet, /* trackWind */ true, /* correctWindDirectionByMagneticDeclination */ true, getService().getPermissionAwareRaceTrackingHandler()); - + // wait for the RaceDefinition to be created raceHandle.getRace(); @@ -3159,7 +3159,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili } } } - + final Iterable mediaTracksForOriginalRace = getService().getMediaTracksForRace(raceIdentifier); for (MediaTrack mediaTrack : mediaTracksForOriginalRace) { if (mediaTrack.overlapsWith(sliceFrom, sliceTo)) { @@ -3225,9 +3225,9 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili /** * Stores a list of BufferedImages and returns a list of URLs as Strings under which the BufferedImages are stored - * + * * @author Robin Fleige (D067799) - * + * * @param resizedImages * the BufferedImages that will be stored * @param fileType @@ -3608,7 +3608,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili convertDtoToCommonMarkProperties(markTemplate.getCommonMarkProperties()))); return convertToMarkTemplateDTO(mTemplate); } - + private boolean existsSwissTimingArchiveConfigurationForCurrentUser(String jsonUrl) throws Exception, UnauthorizedException { boolean found = false; @@ -3621,7 +3621,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili } return found; } - + private boolean existsYellowBrickConfigurationForCurrentUser(String raceUrl) { boolean found = false; final String currentUserName = getSecurityService().getCurrentUser().getName(); @@ -3688,22 +3688,22 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili configuration.setPriority(dto.priority); return configuration; } - + @Override public Pair setFinishingAndEndTime(RaceLogSetFinishingAndFinishTimeDTO dto) throws NotFoundException { getSecurityService().checkCurrentUserUpdatePermission(getLeaderboardByName(dto.leaderboardName)); final MillisecondsTimePoint finishingTimePoint = dto.finishingTime==null?null:new MillisecondsTimePoint(dto.finishingTime); - TimePoint newFinsihingTime = getService().setFinishingTime(dto.leaderboardName, dto.raceColumnName, + TimePoint newFinsihingTime = getService().setFinishingTime(dto.leaderboardName, dto.raceColumnName, dto.fleetName, dto.authorName, dto.authorPriority, dto.passId, finishingTimePoint); - + final TimePoint finishTimePoint = dto.finishTime==null?null:new MillisecondsTimePoint(dto.finishTime); - TimePoint newEndTime = getService().setEndTime(dto.leaderboardName, dto.raceColumnName, + TimePoint newEndTime = getService().setEndTime(dto.leaderboardName, dto.raceColumnName, dto.fleetName, dto.authorName, dto.authorPriority, dto.passId, finishTimePoint); - + return new Pair(Util.equalsWithNull(finishingTimePoint, newFinsihingTime), Util.equalsWithNull(finishTimePoint, newEndTime)); } @@ -3711,7 +3711,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili @Override public boolean setStartTimeAndProcedure(RaceLogSetStartTimeAndProcedureDTO dto) throws NotFoundException { getSecurityService().checkCurrentUserUpdatePermission(getLeaderboardByName(dto.leaderboardName)); - TimePoint newStartTime = getService().setStartTimeAndProcedure(dto.leaderboardName, dto.raceColumnName, + TimePoint newStartTime = getService().setStartTimeAndProcedure(dto.leaderboardName, dto.raceColumnName, dto.fleetName, dto.authorName, dto.authorPriority, dto.passId, new MillisecondsTimePoint(dto.logicalTimePoint), new MillisecondsTimePoint(dto.startTime), dto.racingProcedure, dto.courseAreaId); @@ -3825,7 +3825,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili lastFix = null; } String deviceId = serializeDeviceIdentifier(mapping.getDevice()); - Date from = mapping.getTimeRange().from() == null || mapping.getTimeRange().from().equals(TimePoint.BeginningOfTime) ? + Date from = mapping.getTimeRange().from() == null || mapping.getTimeRange().from().equals(TimePoint.BeginningOfTime) ? null : mapping.getTimeRange().from().asDate(); Date to = mapping.getTimeRange().to() == null || mapping.getTimeRange().to().equals(TimePoint.EndOfTime) ? null : mapping.getTimeRange().to().asDate(); @@ -3877,7 +3877,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili RegattaLog regattaLog = getRegattaLogInternal(leaderboardName); return getDeviceMappings(regattaLog); } - + @Override public void updateServerConfiguration(ServerConfigurationDTO serverConfiguration) { getSecurityService().checkCurrentUserServerPermission(ServerActions.CONFIGURE_LOCAL_SERVER); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/SeriesDTO.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/SeriesDTO.java index e3e1a78567b..9d08a9154aa 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/SeriesDTO.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/SeriesDTO.java @@ -23,7 +23,7 @@ public class SeriesDTO extends NamedDTO { public SeriesDTO() { super(""); } - + public SeriesDTO(String name, List fleets, List raceColumns, boolean isMedal, boolean isFleetsCanRunInParallel, int[] discardThresholds, boolean startsWithZeroScore, boolean firstColumnIsNonDiscardableCarryForward, boolean hasSplitFleetContiguousScoring, boolean hasCrossFleetMergedRanking, Integer maximumNumberOfDiscards) { @@ -34,12 +34,12 @@ public class SeriesDTO extends NamedDTO { this.isFleetsCanRunInParallel = isFleetsCanRunInParallel; this.startsWithZeroScore = startsWithZeroScore; this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; - this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; + this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; this.discardThresholds = discardThresholds; this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; this.maximumNumberOfDiscards = maximumNumberOfDiscards; } - + /** * Copy/clone constructor; the {@link #raceColumns} collection is created as a copy and not just assigned by reference. * Therefore, altering the elements in the {@link #raceColumns} collection of the new object does not alter the {@link #raceColumns} @@ -92,7 +92,7 @@ public class SeriesDTO extends NamedDTO { public void setRaceColumns(List raceColumns) { this.raceColumns = raceColumns; } - + /** * @return whether this series defines its local result discarding rule; if so, any leaderboard based on the * enclosing regatta has to respect this and has to use a result discarding rule implementation that keeps @@ -105,7 +105,7 @@ public class SeriesDTO extends NamedDTO { public int[] getDiscardThresholds() { return discardThresholds; } - + public void setDiscardThresholds(int[] discardThresholds) { this.discardThresholds = discardThresholds; } @@ -117,7 +117,7 @@ public class SeriesDTO extends NamedDTO { public void setStartsWithZeroScore(Boolean startsWithZeroScore) { this.startsWithZeroScore = startsWithZeroScore; } - + public void setFirstColumnIsNonDiscardableCarryForward(boolean firstColumnIsNonDiscardableCarryForward) { this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialogPO.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialogPO.java index 042a31f61bf..30fa1f1c8e5 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialogPO.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesCreateDialogPO.java @@ -11,36 +11,36 @@ import com.sap.sailing.selenium.pages.common.DataEntryDialogPO; public class SeriesCreateDialogPO extends DataEntryDialogPO { @FindBy(how = BySeleniumId.class, using = "NameTextBox") private WebElement nameTextBox; - + // @FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox") // private WebElement medalSeriesCheckbox; - + // @FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox") // private WebElement startsWithZeroScoreCheckbox; - + // @FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox") // private WebElement startsWithNonDiscardableCarryForwardCheckbox; - + // @FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox") // private WebElement definesResultDiscardingRulesCheckbox; - + // @FindBy(how = BySeleniumId.class, using = "FleetListEditorComposite") // private WebElement fleetsPanel; - + // @FindBy(how = BySeleniumId.class, using = "HasSplitFleetContiguousScoringCheckbox") // private WebElement hasSplitFleetContiguousScoringCheckbox; - + // @FindBy(how = BySeleniumId.class, using = "HasCrossFleetMergedRankingCheckbox") // private WebElement hasCrossFleetMergedRankingCheckbox; public SeriesCreateDialogPO(WebDriver driver, WebElement element) { super(driver, element); } - + public void setSeriesName(String name) { this.nameTextBox.clear(); this.nameTextBox.sendKeys(name); } - + // TODO: Checkboxes and Fleets } diff --git a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialogPO.java b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialogPO.java index 0e8c96f85be..97f2f1f0dc6 100644 --- a/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialogPO.java +++ b/java/com.sap.sailing.selenium.test/src/com/sap/sailing/selenium/pages/adminconsole/regatta/SeriesEditDialogPO.java @@ -14,91 +14,91 @@ import com.sap.sailing.selenium.core.FindBy; import com.sap.sailing.selenium.pages.common.DataEntryDialogPO; public class SeriesEditDialogPO extends DataEntryDialogPO { - + @FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox") private WebElement medalSeriesCheckbox; - + @FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox") private WebElement startsWithZeroScoreCheckbox; - + @FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox") private WebElement startsWithNonDiscardableCarryForwardCheckbox; - + @FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox") private WebElement definesResultDiscardingRulesCheckbox; - + @FindBy(how = BySeleniumId.class, using = "AddRacesFromListBox") private WebElement addRacesFromListBox; - + @FindBy(how = BySeleniumId.class, using = "AddRacesToListBox") private WebElement addRacesToListBox; - + @FindBy(how = BySeleniumId.class, using = "RaceNamePrefixTextBox") private WebElement raceNamePrefixTextField; - + @FindBy(how = BySeleniumId.class, using = "AddRacesButton") private WebElement addRacesButton; - + @FindBy(how = BySeleniumId.class, using = "HasSplitFleetContiguousScoringCheckbox") - private WebElement hasSplitFleetContiguousScoringCheckbox; - + private WebElement hasSplitFleetContiguousScoringCheckbox; + @FindBy(how = BySeleniumId.class, using = "HasCrossFleetMergedRankingCheckbox") - private WebElement hasCrossFleetMergedRankingCheckbox; - + private WebElement hasCrossFleetMergedRankingCheckbox; + public SeriesEditDialogPO(WebDriver driver, WebElement element) { super(driver, element); } - + public int getFromNumberOfRacesToAdd() { Select select = new Select(this.addRacesFromListBox); WebElement option = select.getFirstSelectedOption(); - + return Integer.parseInt(option.getAttribute("value")); } - + public void setFromNumberOfRacesToAdd(int races) { Select select = new Select(this.addRacesFromListBox); select.selectByValue(Integer.toString(races)); } - + public int getToNumberOfRacesToAdd() { Select select = new Select(this.addRacesToListBox); WebElement option = select.getFirstSelectedOption(); - + return Integer.parseInt(option.getAttribute("value")); } - + public void setToNumberOfRacesToAdd(int races) { Select select = new Select(this.addRacesToListBox); select.selectByValue(Integer.toString(races)); } - + public String getRaceNamePrefix() { return this.raceNamePrefixTextField.getText(); } - + public void setRaceNamePrefix(String prefix) { this.raceNamePrefixTextField.clear(); this.raceNamePrefixTextField.sendKeys(prefix); } - + public void pressAddRaces() { this.addRacesButton.click(); } - + public void addRaces(int from, int to) { setFromNumberOfRacesToAdd(from); setToNumberOfRacesToAdd(to); pressAddRaces(); } - + public void addRaces(int from, int to, String prefix) { setFromNumberOfRacesToAdd(from); setToNumberOfRacesToAdd(to); setRaceNamePrefix(prefix); pressAddRaces(); } - + public void addSingleRace(String raceName) { setFromNumberOfRacesToAdd(1); setToNumberOfRacesToAdd(1); @@ -107,27 +107,27 @@ public class SeriesEditDialogPO extends DataEntryDialogPO { raceNameElement.clear(); raceNameElement.sendKeys(raceName); } - + public void renameRace(String race, String newName) { for(WebElement editorRow : getRaceNameEditors()) { WebElement valueTextBox = findElementBySeleniumId(editorRow, "ValueTextBox"); String raceName = valueTextBox.getAttribute("value"); - + if(raceName.equals(race)) { valueTextBox.clear(); valueTextBox.sendKeys(newName); } } } - + public void deleteRace(String race) { deleteRaces(Arrays.asList(race)); } - + public void deleteRaces(List races) { for(WebElement editorRow : getRaceNameEditors()) { WebElement valueTextBox = findElementBySeleniumId(editorRow, "ValueTextBox"); - + if (races.contains(valueTextBox.getAttribute("value"))) { WebElement removeButton = findElementBySeleniumId(editorRow, "RemoveButton"); // A simple "removeButton.click();" does not work on GeckoDriver here. @@ -137,26 +137,26 @@ public class SeriesEditDialogPO extends DataEntryDialogPO { } } } - + private List getRaceNameEditors() { WebElement raceNamesEditor = findElementBySeleniumId("RaceNamesStringListEditorComposite"); WebElement raceNamesGrid = findElementBySeleniumId(raceNamesEditor, "ExpandedValuesGrid"); - + return raceNamesGrid.findElements(By.tagName("tr")); } - + public void setMedalSeries(boolean medal) { if(medalSeriesCheckbox.isSelected() != medal) { new Actions(driver).moveToElement(medalSeriesCheckbox).click().build().perform(); } } - + public void setCrossFleetMergedRankingCheckboxStatus(boolean status) { if(hasCrossFleetMergedRankingCheckbox.isSelected() != status) { hasCrossFleetMergedRankingCheckbox.click(); } } - + public void setSplitFleetContiguousScoringCheckbox(boolean status) { if(hasSplitFleetContiguousScoringCheckbox.isSelected() != status) { hasSplitFleetContiguousScoringCheckbox.click(); diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java index 2bba618f954..154eb6c8dde 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java @@ -126,31 +126,31 @@ public class EventsResource extends AbstractSailingServerResource { public static final String V1_EVENTS = "/v1/events"; private static final Logger logger = Logger.getLogger(EventsResource.class.getName()); private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - + public static enum ErrorCodes { NO_VENUE(1), NO_BOAT_CLASS(2), LEADERBOARD_GROUP_ALREADY_EXISTS(3), REGATTA_ALREADY_EXISTS(4), LEADERBOARD_ALREADY_EXISTS(5); - + private ErrorCodes(int errorCode) { this.errorCode = errorCode; } - + public int getErrorCode() { return errorCode; } - + private final int errorCode; } - + public EventsResource() { } - - + + /** * Method to delete a specified {@link Event}. - * + * * @param eventId - The UUID of the event to delete * @param withLeaderboardGroups - Boolean whether to delete all associated {@link LeaderboardGroup}s or not. Doing so will also delete the overall {@link Leaderboard}s of each group. - * @param withLeaderboards - Boolean whether to delete all associated {@link Leaderboard}s. + * @param withLeaderboards - Boolean whether to delete all associated {@link Leaderboard}s. * @param withRegattas - Boolean whether to delete all associated {@link Regatta}s. Doing so will also delete all their {@link RegattaLeaderboard}s and {@link TrackedRace}s. * @return A 200 response, if the delete was successful or a 404 response, if the eventId was not found. * @throws ParseException @@ -301,7 +301,7 @@ public class EventsResource extends AbstractSailingServerResource { } return response; } - + private Response createErrorResponse(Status responseStatus, String message, ErrorCodes errorCode) { final JSONObject responseBody = new JSONObject(); responseBody.put("message", message); @@ -309,7 +309,7 @@ public class EventsResource extends AbstractSailingServerResource { responseBody.put("errorCode", errorCode.getErrorCode()); return Response.status(responseStatus).entity(responseBody.toString()).build(); } - + @PUT @Path("/{eventId}/update") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @@ -385,7 +385,7 @@ public class EventsResource extends AbstractSailingServerResource { } return response; } - + @GET @Produces("application/json;charset=UTF-8") public Response getEvents(@QueryParam("showNonPublic") String showNonPublic, @QueryParam("include") @DefaultValue("false") Boolean include, @@ -480,7 +480,7 @@ public class EventsResource extends AbstractSailingServerResource { } return response; } - + private RegattaLeaderboard validateAndCreateRegatta(String regattaNameParam, String boatClassNameParam, String scoringSchemeParam, UUID courseAreaId, String buoyZoneRadiusInHullLengthsParam, String useStartTimeInterferenceParam, String controlTrackingFromStartAndFinishTimesParam, @@ -517,7 +517,7 @@ public class EventsResource extends AbstractSailingServerResource { createDefaultSeriesCreationParameters(regattaName, numberOfRaces)); UUID regattaId = UUID.randomUUID(); Regatta regatta = getSecurityService().setOwnershipCheckPermissionForObjectCreationAndRevertOnError( - SecuredDomainType.REGATTA, Regatta.getTypeRelativeObjectIdentifier(regattaName), + SecuredDomainType.REGATTA, Regatta.getTypeRelativeObjectIdentifier(regattaName), regattaName, new Callable() { @Override public Regatta call() throws Exception { @@ -537,7 +537,7 @@ public class EventsResource extends AbstractSailingServerResource { } /** - * @param canBoatsOfCompetitorsChangePerRace + * @param canBoatsOfCompetitorsChangePerRace * @return the event created as first component; if a leaderboard group was to be created, the leaderboard group * created as the second component or {@code null} otherwise; the regatta leaderboard as the third component * in case a regatta was to be created, or {@code null} otherwise @@ -580,7 +580,7 @@ public class EventsResource extends AbstractSailingServerResource { String eventDescription = eventDescriptionParam == null ? eventName : eventDescriptionParam; final TimePoint startDate = parseTimePoint(startDateParam, startDateAsMillis, now()); final TimePoint endDate = parseTimePoint(endDateParam, endDateAsMillis, new MillisecondsTimePoint(addOneWeek(startDate.asDate()))); - URL officialWebsiteURL = officialWebsiteURLParam == null ? null : toURL(officialWebsiteURLParam); + URL officialWebsiteURL = officialWebsiteURLParam == null ? null : toURL(officialWebsiteURLParam); final URI baseUri = uriInfo.getBaseUri(); final int port = baseUri.getPort(); // guess the protocol; when behind an SSL-offloading reverse proxy or load balancer, all we'll see is a regular HTTP @@ -653,7 +653,7 @@ public class EventsResource extends AbstractSailingServerResource { return new Util.Triple<>(event, leaderboardGroup, leaderboard); } }; - + try { if (competitorRegistrationType == CompetitorRegistrationType.OPEN_UNMODERATED) { UUID newTenantId = UUID.randomUUID(); @@ -733,7 +733,7 @@ public class EventsResource extends AbstractSailingServerResource { defaultSeries.hasSplitFleetContiguousScoring(), defaultSeries.hasCrossFleetMergedRanking(), defaultSeries.getMaximumNumberOfDiscards(), defaultSeries.getFleets())); } - + private void addRaceColumns(String regattaName, String seriesName, int numberOfRaces) { final Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { @@ -791,19 +791,19 @@ public class EventsResource extends AbstractSailingServerResource { defaultLeaderboardGroup.addLeaderboard(leaderboard); List leaderboards = stream(defaultLeaderboardGroup.getLeaderboards().spliterator()).map(lg -> lg.getName()) .collect(Collectors.toList()); - + ResultDiscardingRule rule = defaultLeaderboardGroup.getOverallLeaderboard()==null?null:defaultLeaderboardGroup.getOverallLeaderboard().getResultDiscardingRule(); - int[] overallLeaderboardDiscardThresholds = null; + int[] overallLeaderboardDiscardThresholds = null; if(rule instanceof ThresholdBasedResultDiscardingRule){ ThresholdBasedResultDiscardingRule resultDiscardingRule = (ThresholdBasedResultDiscardingRule) rule; overallLeaderboardDiscardThresholds = resultDiscardingRule.getDiscardIndexResultsStartingWithHowManyRaces(); } getService().updateLeaderboardGroup(defaultLeaderboardGroup.getId(), defaultLeaderboardGroup.getName(), defaultLeaderboardGroup.getDescription(), - defaultLeaderboardGroup.getDisplayName(), leaderboards, overallLeaderboardDiscardThresholds, + defaultLeaderboardGroup.getDisplayName(), leaderboards, overallLeaderboardDiscardThresholds, defaultLeaderboardGroup.getOverallLeaderboard()==null?null:defaultLeaderboardGroup.getOverallLeaderboard().getScoringScheme().getType()); } } - + private RegattaLeaderboard addLeaderboard(String regattaName, int[] discardThresholds) { RegattaLeaderboard leaderboard = null; try { @@ -852,7 +852,7 @@ public class EventsResource extends AbstractSailingServerResource { throw new MalformedURLException(ExceptionManager.invalidURLFormatMsg(url)); } } - + private List toUUIDList(List list){ return list.stream().map(id -> toUUID(id)) .collect(Collectors.toList()); @@ -865,7 +865,7 @@ public class EventsResource extends AbstractSailingServerResource { throw new IllegalArgumentException(ExceptionManager.invalidIdFormatMsg(id)); } } - + private LinkedHashMap createDefaultSeriesCreationParameters(String regattaName,int numberOfRaces ) { final LinkedHashMap series = new LinkedHashMap<>(); series.put(LeaderboardNameConstants.DEFAULT_SERIES_NAME, new SeriesCreationParametersDTO( diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/RegattasResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/RegattasResource.java index 70c36b83675..ec6618e1d08 100755 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/RegattasResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/RegattasResource.java @@ -196,7 +196,7 @@ public class RegattasResource extends AbstractSailingServerResource { private static final Logger logger = Logger.getLogger(RegattasResource.class.getName()); private DataMiningResource dataMiningResource; - + private DataMiningResource getDataMiningResource() { if (dataMiningResource == null) { dataMiningResource = getResourceContext().getResource(DataMiningResource.class); @@ -213,7 +213,7 @@ public class RegattasResource extends AbstractSailingServerResource { return Response.status(Status.FORBIDDEN).entity("Self-registration to regatta '" + StringEscapeUtils.escapeHtml(regattaName) + "' is not allowed.") .type(MediaType.TEXT_PLAIN).build(); } - + private Response getBadRegattaRegistrationValidationErrorResponse(String errorText) { return Response.status(Status.BAD_REQUEST).entity(StringEscapeUtils.escapeHtml(errorText) + ".") .type(MediaType.TEXT_PLAIN).build(); @@ -223,7 +223,7 @@ public class RegattasResource extends AbstractSailingServerResource { return Response.status(Status.FORBIDDEN).entity("Device is already registered to regatta '" + StringEscapeUtils.escapeHtml(regattaName) + "'.") .type(MediaType.TEXT_PLAIN).build(); } - + private Response getDeregisterCompetitorErrorResponse(String regattaName, String competitorId, String errorText) { return Response.status(Status.BAD_REQUEST) .entity("Deregistering competitor " + StringEscapeUtils.escapeHtml(competitorId) + " from regatta " @@ -261,13 +261,13 @@ public class RegattasResource extends AbstractSailingServerResource { + StringEscapeUtils.escapeHtml(regattaName) + "'.") .type(MediaType.TEXT_PLAIN).build(); } - + private Response getBadSeriesErrorResponse(String regattaName, String seriesName) { return Response.status(Status.NOT_FOUND) .entity("Could not find a series with name '" + StringEscapeUtils.escapeHtml(seriesName) + "' in regatta '" + StringEscapeUtils.escapeHtml(regattaName) + "'.") .type(MediaType.TEXT_PLAIN).build(); } - + private Response getNoTrackedRaceErrorResponse(String regattaName, String raceName) { return Response.status(Status.NOT_FOUND) .entity("No tracked race for race with name '" + StringEscapeUtils.escapeHtml(raceName) + "' in regatta '" + StringEscapeUtils.escapeHtml(regattaName) + "'.") @@ -416,7 +416,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets all entries for a regatta. - * + * * @param regattaName * the name of the regatta * @return @@ -444,7 +444,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets all entries for a race. - * + * * @param regattaName * the name of the regatta * @return @@ -535,7 +535,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @FunctionalInterface private static interface BoatObtainer { DynamicBoat getBoat(String boatName, OwnershipAnnotation regattaOwnershipAnnotation, boolean skipPermissionChecksBasedOnCorrectRegattaSecretProvided); @@ -549,11 +549,11 @@ public class RegattasResource extends AbstractSailingServerResource { * {@link #createAndAddCompetitorWithBoat(String, String, String, String, String, String, String, Double, Long, String, String, String, String, String, String)} * has been used. The {@link CompetitorWithBoat} object will be registered on the regatta specified by the * {@code regattaName}.

    - * + * * Additionally, if a non-{@code null} {@code deviceUuid} is provided, a device mapping is created that maps the device with * the UUID provided to the competitor created and registered. If such a device mapping already exists, then that is considered an * error, and the method aborts.

    - * + * * Security-wise, in order for this to succeed, the caller either has to present the correct {@code registrationLinkSecret} for the regatta, * or the calling {@link Subject} must have the {@code REGATTA:UPDATE} permission for the regatta identified by {@code regattaName} as well as the * {@code SERVER:CREATE_OBJECT} permission for the server on which the request is executed, also the {@code CREATE:COMPETITOR} and, if the {@link Boat} @@ -835,7 +835,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets all GPS positions of the competitors for a given race. - * + * * @param regattaName * the name of the regatta * @param tack @@ -1007,7 +1007,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets all GPS positions of the course marks for a given race. - * + * * @param regattaName * the name of the regatta * @return @@ -1075,7 +1075,7 @@ public class RegattasResource extends AbstractSailingServerResource { } else { fixIter = track.getFixesIterator(from, /* inclusive */true); } - GPSFix fix = null; + GPSFix fix = null; boolean lastAdded = false; while (fixIter.hasNext()) { fix = fixIter.next(); @@ -1124,7 +1124,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets the course of the race. - * + * * @param regattaName * the name of the regatta * @return @@ -1149,10 +1149,10 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + /** * Gets the course of the race defined by the raceColumn/fleet tupel. - * + * * @param regattaName * the name of the regatta * @return @@ -1216,7 +1216,7 @@ public class RegattasResource extends AbstractSailingServerResource { response = Response.ok(streamingOutput(jsonCourse)).header("Content-Type", MediaType.APPLICATION_JSON + ";charset=UTF-8").build(); return response; } - + /** * The leg distance and bearing is taken for the time point when the first boat enters the leg, or for the start of the race * if no mark passing exists for that leg yet, or for the start of tracking if no start of race exists, or for "now" if no @@ -1269,7 +1269,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets the target time of the race - * + * * @param regattaName * the name of the regatta * @param timeasmillis @@ -1313,7 +1313,7 @@ public class RegattasResource extends AbstractSailingServerResource { } else { response = getNoTrackedRaceErrorResponse(regattaName, raceName); } - + } } return response; @@ -1346,7 +1346,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + /** * Calculates all start analysis parameters for all competitors in the race. */ @@ -1445,7 +1445,7 @@ public class RegattasResource extends AbstractSailingServerResource { /** * Gets the relevant times of the race. - * + * * @param regattaName * the name of the regatta * @return @@ -1587,7 +1587,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @GET @Produces("application/json;charset=UTF-8") @Path("{regattaname}/races/{racename}/highQualityWindFixes") @@ -1898,7 +1898,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @GET @Produces("application/json;charset=UTF-8") @Path("{regattaname}/races/{racename}/completeManeuverCurvesWithEstimationData") @@ -2024,7 +2024,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @GET @Produces("application/json;charset=UTF-8") @Path("{regattaname}/races/{racename}/competitors/legs") @@ -2340,7 +2340,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @GET @Produces("application/json;charset=UTF-8") @Path("datamining") @@ -2354,7 +2354,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/datamining/" + SailingPredefinedQueries.QUERY_AVERAGE_SPEED_PER_COMPETITOR_LEGTYPE) public Response avgSpeedPerCompetitorAndLegType(@PathParam("regattaname") String regattaName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2370,7 +2370,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/races/{racename}/datamining/" + SailingPredefinedQueries.QUERY_AVERAGE_SPEED_PER_COMPETITOR_LEGTYPE) public Response avgSpeedPerCompetitorAndLegType(@PathParam("regattaname") String regattaName, @PathParam("racename") String raceName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2391,7 +2391,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/datamining/" + SailingPredefinedQueries.QUERY_DISTANCE_TRAVELED_PER_COMPETITOR_LEGTYPE) public Response sumDistancePerCompetitorAndLegType(@PathParam("regattaname") String regattaName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2407,7 +2407,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/races/{racename}/datamining/" + SailingPredefinedQueries.QUERY_DISTANCE_TRAVELED_PER_COMPETITOR_LEGTYPE) public Response sumDistancePerCompetitorAndLegType(@PathParam("regattaname") String regattaName, @PathParam("racename") String raceName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2428,7 +2428,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/datamining/" + SailingPredefinedQueries.QUERY_MANEUVERS_PER_COMPETITOR) public Response sumManeuversPerCompetitor(@PathParam("regattaname") String regattaName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2444,7 +2444,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/races/{racename}/datamining/" + SailingPredefinedQueries.QUERY_MANEUVERS_PER_COMPETITOR) public Response sumManeuversPerCompetitor(@PathParam("regattaname") String regattaName, @PathParam("racename") String raceName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2465,7 +2465,7 @@ public class RegattasResource extends AbstractSailingServerResource { @Path("{regattaname}/datamining/" + SailingPredefinedQueries.QUERY_AVERAGE_SPEED_PER_COMPETITOR) public Response avgSpeedPerCompetitor(@PathParam("regattaname") String regattaName) { Response response; - + Regatta regatta = findRegattaByName(regattaName); if (regatta == null) { response = getBadRegattaErrorResponse(regattaName); @@ -2530,7 +2530,7 @@ public class RegattasResource extends AbstractSailingServerResource { } return response; } - + @POST @Produces("application/json;charset=UTF-8") @Path("{regattaname}/addracecolumns") @@ -2596,7 +2596,7 @@ public class RegattasResource extends AbstractSailingServerResource { private String getRaceName(final String raceNamePrefix, final int number) { return raceNamePrefix+number; } - + private int findNextFreeRaceName(Series series, String raceNamePrefix, int oneBasedNumberOfLast) { int result = oneBasedNumberOfLast; boolean clash = false; @@ -2762,7 +2762,7 @@ public class RegattasResource extends AbstractSailingServerResource { throw new IllegalStateException("Regatta named " + regattaName + " could not be resolved"); } } - + @POST @Path("{regattaname}/competitors/{competitorid}/updateToTHandicap") @Produces("application/json;charset=UTF-8") diff --git a/java/com.sap.sailing.server.gateway/webservices/api/v1/regattaUpdateOrCreateSeries.html b/java/com.sap.sailing.server.gateway/webservices/api/v1/regattaUpdateOrCreateSeries.html index aaa7601b396..ffa1d0aff58 100644 --- a/java/com.sap.sailing.server.gateway/webservices/api/v1/regattaUpdateOrCreateSeries.html +++ b/java/com.sap.sailing.server.gateway/webservices/api/v1/regattaUpdateOrCreateSeries.html @@ -30,8 +30,8 @@ Examples: - resultDiscardingThresholds and maximumNumberOfDiscards are optional - + resultDiscardingThresholds and maximumNumberOfDiscards are optional + Request: { "regattaName":"test", "seriesName":"NewRestCreatedSeries2", @@ -57,6 +57,6 @@

    -Back to Web Service Overview +Back to Web Service Overview diff --git a/java/com.sap.sailing.server.interface/src/com/sap/sailing/server/operationaltransformation/UpdateSeries.java b/java/com.sap.sailing.server.interface/src/com/sap/sailing/server/operationaltransformation/UpdateSeries.java index c09445c0008..bdd9765062c 100755 --- a/java/com.sap.sailing.server.interface/src/com/sap/sailing/server/operationaltransformation/UpdateSeries.java +++ b/java/com.sap.sailing.server.interface/src/com/sap/sailing/server/operationaltransformation/UpdateSeries.java @@ -18,7 +18,7 @@ import com.sap.sailing.server.interfaces.RacingEventServiceOperation; public class UpdateSeries extends AbstractSeriesOperation { private static final long serialVersionUID = 6356089749049112710L; - + private final List fleets; private final boolean isMedal; private final boolean isFleetsCanRunInParallel; @@ -26,7 +26,7 @@ public class UpdateSeries extends AbstractSeriesOperation { private final boolean startsWithZeroScore; private final boolean firstColumnIsNonDiscardableCarryForward; private final boolean hasSplitFleetContiguousScoring; - private final boolean hasCrossFleetMergedRanking; + private final boolean hasCrossFleetMergedRanking; private final boolean seriesNameChanged; private final String newSeriesName; private final Integer maximumNumberOfDiscards; @@ -44,7 +44,7 @@ public class UpdateSeries extends AbstractSeriesOperation { this.startsWithZeroScore = startsWithZeroScore; this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; - this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; + this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; this.maximumNumberOfDiscards = maximumNumberOfDiscards; this.fleets = fleets; } @@ -72,7 +72,7 @@ public class UpdateSeries extends AbstractSeriesOperation { } return null; } - + private Series createSeries(RacingEventService toState) { Regatta regatta = toState.getRegatta(getRegattaIdentifier()); final List emptyRaceColumnNames = Collections.emptyList(); diff --git a/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/RegattaReplicationTest.java b/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/RegattaReplicationTest.java index 7cf1f6856e9..56d9fc8839f 100755 --- a/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/RegattaReplicationTest.java +++ b/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/RegattaReplicationTest.java @@ -87,9 +87,9 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { /* course area ID */ (Serializable) null, /* buoyZoneRadiusInHullLengths */2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, /* autoRestartTrackingUponCompetitorSetChange */ false, OneDesignRankingMetric::new); - + Thread.sleep(1000); - + Regatta replicatedRegatta1 = replica.getRegatta(new RegattaName(masterRegatta1.getName())); assertNotNull(replicatedRegatta1); assertEquals(replicatedRegatta1.canBoatsOfCompetitorsChangePerRace(), canBoatsOfCompetitorsChangePerRaceRegatta1); @@ -118,7 +118,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { /* controlTrackingFromStartAndFinishTimes */ false, /* autoRestartTrackingUponCompetitorSetChange */ false, OneDesignRankingMetric::new); // Test for 'null' - master.apply(new UpdateSpecificRegatta(masterRegatta.getRegattaIdentifier(), /*startDate*/ null, /*endDate*/ null, + master.apply(new UpdateSpecificRegatta(masterRegatta.getRegattaIdentifier(), /*startDate*/ null, /*endDate*/ null, currentCourseAreaId, null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, /* autoRestartTrackingUponCompetitorSetChange */ false, /* registrationLinkSecret */ null, CompetitorRegistrationType.CLOSED)); Thread.sleep(1000); @@ -127,7 +127,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertTrue(Util.isEmpty(replicatedRegatta.getCourseAreas())); // Test for 'alpha' currentCourseAreaId = alphaCourseAreaId; - master.apply(new UpdateSpecificRegatta(masterRegatta.getRegattaIdentifier(), /*startDate*/ null, /*endDate*/ null, + master.apply(new UpdateSpecificRegatta(masterRegatta.getRegattaIdentifier(), /*startDate*/ null, /*endDate*/ null, currentCourseAreaId, null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, /* autoRestartTrackingUponCompetitorSetChange */ false, /* registrationLinkSecret */ null, CompetitorRegistrationType.CLOSED)); Thread.sleep(1000); @@ -155,7 +155,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertNotNull(replicatedRegatta); assertTrue(Util.isEmpty(replicatedRegatta.getCourseAreas())); } - + public void testUpdateSpecificRegattaReplicationForProcedureAndCourseDesignerAndConfig() throws InterruptedException { Regatta replicatedRegatta; final UUID alphaCourseAreaId = UUID.randomUUID(); @@ -203,17 +203,17 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertNotNull(replicatedRegatta); assertTrue(regattaId.equals(replicatedRegatta.getId())); } - + @Test public void testSpecificRegattaReplicationWithTwoEmptySeries() throws InterruptedException { final String baseEventName = "Kiel Week 2012"; final String boatClassName = "49er"; final List emptyRaceColumnNamesList = Collections.emptyList(); - Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, + Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Yellow"), new FleetImpl("Blue") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); - Series finals = new SeriesImpl("Finals", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, + Series finals = new SeriesImpl("Finals", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Gold", 1), new FleetImpl("Silver", 2) }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); - Series medal = new SeriesImpl("Medal", /* isMedal */ true, /* isFleetsCanRunInParallel */ true, + Series medal = new SeriesImpl("Medal", /* isMedal */ true, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Medal") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName, /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, @@ -247,13 +247,13 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertNotNull(replicatedMedal.getFleetByName("Medal")); assertTrue(Util.isEmpty(replicatedRegatta.getCourseAreas())); } - + @Test public void testRegattaUpdateSeriesWithNewSeries() throws InterruptedException { final String baseEventName = "Extreme Sailing Series 2020"; final String boatClassName = "Extreme40"; final List emptyRaceColumnNamesList = Collections.emptyList(); - Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, + Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Yellow"), new FleetImpl("Blue") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName, /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, @@ -272,7 +272,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertEquals("Qualification", replicatedQualification.getName()); assertEquals(2, Util.size(replicatedQualification.getFleets())); assertFalse(seriesIter.hasNext()); - Series finals = new SeriesImpl("Finals", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, + Series finals = new SeriesImpl("Finals", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Gold", 1) }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); FleetDTO finalsGoldFleet = new FleetDTO("Gold", 1, Color.GRAY); master.apply(new UpdateSeries(masterRegatta.getRegattaIdentifier(), finals.getName(), finals.getName(), finals.isMedal(), finals.isFleetsCanRunInParallel(), @@ -295,13 +295,13 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { assertNotNull(replicatedFinals.getFleetByName("Gold")); assertEquals(1, replicatedFinals.getFleetByName("Gold").getOrdering()); } - + @Test public void testSeriesNameChangeReplicationTest() throws InterruptedException { final String baseEventName = "Extreme Sailing Series 2021"; final String boatClassName = "Extreme40"; final List emptyRaceColumnNamesList = Collections.emptyList(); - Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, + Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Arrays.asList(new Fleet[] { new FleetImpl("Yellow"), new FleetImpl("Blue") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null); Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName, /* canBoatsOfCompetitorsChangePerRace */ true, CompetitorRegistrationType.CLOSED, @@ -317,12 +317,12 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { Iterator seriesIter = replicatedRegatta.getSeries().iterator(); Series replicatedQualification = seriesIter.next(); assertEquals("Qualification", replicatedQualification.getName()); - master.apply(new UpdateSeries(masterRegatta.getRegattaIdentifier(), qualification.getName(), "Simons Quali", + master.apply(new UpdateSeries(masterRegatta.getRegattaIdentifier(), qualification.getName(), "Simons Quali", qualification.isMedal(), qualification.isFleetsCanRunInParallel(), new int[] {}, qualification.isStartsWithZeroScore(), qualification.isFirstColumnIsNonDiscardableCarryForward(), qualification.hasSplitFleetContiguousScoring(), qualification.hasCrossFleetMergedRanking(), - qualification.getMaximumNumberOfDiscards(), Arrays.asList(new FleetDTO[] { }))); + qualification.getMaximumNumberOfDiscards(), Arrays.asList(new FleetDTO[] { }))); Thread.sleep(1000); replicatedRegatta = replica.getRegatta(new RegattaName(masterRegatta.getName())); assertNotNull(replicatedRegatta); @@ -330,7 +330,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest { replicatedQualification = seriesIter.next(); assertEquals("Simons Quali", replicatedQualification.getName()); } - + @Test public void testSpecificRegattaReplicationWithCourseArea() throws InterruptedException { final String eventName = "ESS Singapur"; diff --git a/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/TrackRaceBoatCompetitorMetadataReplicationTest.java b/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/TrackRaceBoatCompetitorMetadataReplicationTest.java index 9bcd095e7d6..f463f34b8ea 100644 --- a/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/TrackRaceBoatCompetitorMetadataReplicationTest.java +++ b/java/com.sap.sailing.server.replication.test/src/com/sap/sailing/server/replication/test/TrackRaceBoatCompetitorMetadataReplicationTest.java @@ -55,7 +55,7 @@ public class TrackRaceBoatCompetitorMetadataReplicationTest extends AbstractServ public void testTearDownIsNotBeingCalledWhenSetUpFailsWithAnException() { // no-op } - + @Before @Override public void setUp() throws Exception { @@ -129,16 +129,16 @@ public class TrackRaceBoatCompetitorMetadataReplicationTest extends AbstractServ } replicaReplicator.waitUntilQueueIsEmpty(); } - + @Test public void testStartTrackingRaceReplication() throws Exception { - final String boat1CompetitorName = "CYC"; + final String boat1CompetitorName = "CYC"; final String boat1Name = "Boot 1"; final String boat1Color = "#141414"; - final String boat2CompetitorName = "SVI"; + final String boat2CompetitorName = "SVI"; final String boat2Name = "Boot 2"; final String boat2Color = "#606060"; - final String boat3CompetitorName = "BYCÜ"; + final String boat3CompetitorName = "BYCÜ"; final String boat3Name = "Boot 3"; final String boat3Color = "#0169EF"; startTracking(); @@ -178,7 +178,7 @@ public class TrackRaceBoatCompetitorMetadataReplicationTest extends AbstractServ assertEquals(masterBoat.getColor(), replicaBoat.getColor()); assertEquals(expectedBoatName, replicaBoat.getName()); assertEquals(expectedBoatColor, replicaBoat.getColor().getAsHtml()); - } + } private Competitor findCompetitor(Iterable competitors, Competitor otherCompetitor) { for (Competitor competitor : competitors) { @@ -188,7 +188,7 @@ public class TrackRaceBoatCompetitorMetadataReplicationTest extends AbstractServ } return null; } - + @After @Override public void tearDown() throws Exception { diff --git a/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/SearchServiceTest.java b/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/SearchServiceTest.java index 7b1d45b39c3..cde971ed1fc 100755 --- a/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/SearchServiceTest.java +++ b/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/SearchServiceTest.java @@ -280,7 +280,7 @@ public class SearchServiceTest { /* millisecondsOverWhichToAverageWind */ 15000, /* millisecondsOverWhichToAverageSpeed */ 15000, null)); aalRegattaLeaderboard.getRaceColumnByName("R2").setTrackedRace(aalRegattaLeaderboard.getRaceColumnByName("R2").getFleetByName("Default"), aalOrcTrackedR2); } - + @Test public void testSetup() { assertNotNull(pfingstbusch29er); @@ -293,7 +293,7 @@ public class SearchServiceTest { assertNotNull(aalOrcTrackedR1); assertNotNull(aalOrcTrackedR2); } - + @Test public void testSimpleSearchByCompetitorName() { Result searchResults = server.search(new KeywordQueryWithOptionalEventQualification(Arrays.asList(new String[] { "Tobi" }))); diff --git a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java index 616770f41c7..c7bf5af14d8 100644 --- a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java +++ b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java @@ -370,7 +370,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa private final ConcurrentHashMap eventsById; private final RemoteSailingServerSet remoteSailingServerSet; - + /** * Holds the {@link Regatta} objects for those races registered with this service. Note that there may be * {@link Regatta} objects that exist outside this service for regattas not (yet) registered here. @@ -411,7 +411,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * {@link #addRace(RegattaIdentifier, RaceTrackingConnectivityParameters, long)} method cleans up by removing the * lock again from this map, again using a synchronized method ( * {@link #unlockRaceTrackersById(Object, NamedReentrantReadWriteLock)}).

    - * + * * If you need to obtain a lock from this map using {@link #lockRaceTrackersById(Object)} and you need * to lock {@link #raceTrackersByRegattaLock}, always make sure to first lock the one from this map, then * lock {@link #raceTrackersByRegattaLock}. @@ -507,7 +507,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa RacingEventService.class.getName(), 0); private PolarDataService polarDataService; - + private WindEstimationFactoryService windEstimationFactoryService; private final SimulationService simulationService; @@ -519,13 +519,13 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * have occurred. For example, the * {@link SailingNotificationService#notifyUserOnBoatClassWhenScoreCorrectionsAreAvailable(com.sap.sailing.domain.base.BoatClass, Leaderboard)} * method must be called whenever a new set of score corrections have been made available.

    - * + * * The field is transient because we don't want the service to be serialized from a master to a replica. * Replicas are expected to not notify users about anything, particularly because they usually don't * have a valid mail service, either. */ private transient SailingNotificationService notificationService; - + /** * Allow only one master data import at a time to avoid situation where multiple Imports override each other in * unpredictable fashion @@ -546,25 +546,25 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * these, synchronize on the object. See also {@link Collections#synchronizedSet(Set)}. */ private final ClassLoaderRegistry masterDataClassLoaders = ClassLoaderRegistry.createInstance(); - + private SailingServerConfiguration sailingServerConfiguration; private final TrackedRegattaListenerManager trackedRegattaListener; - + private long numberOfTrackedRacesToRestore; - + private final AtomicInteger numberOfTrackedRacesRestored; - + private final AtomicInteger numberOfTrackedRacesRestoredDoneLoading; - + private final AtomicInteger numberOfTrackedRacesStillLoading; - + private final ServiceTracker resultUrlRegistryServiceTracker; private final ServiceTracker scoreCorrectionProviderServiceTracker; - + private final ServiceTracker competitorProviderServiceTracker; - + private transient final ConcurrentHashMap scoreCorrectionListenersByLeaderboard; private transient final ConcurrentHashMap connectivityParametersByRace; @@ -581,10 +581,10 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa */ private final RaceChangeObserverForAnniversaryDetection raceChangeObserverForAnniversaryDetection; - private final PairingListTemplateFactory pairingListTemplateFactory = PairingListTemplateFactory.INSTANCE; - + private final PairingListTemplateFactory pairingListTemplateFactory = PairingListTemplateFactory.INSTANCE; + private final FullyInitializedReplicableTracker securityServiceTracker; - + private final CourseAndMarkConfigurationFactory courseAndMarkConfigurationFactory; /** @@ -593,7 +593,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * There is a dependency of many such objects on an instance of {@link RaceLogResolver} which is implemented * by {@link RacingEventServiceImpl}. However, therefore, this instance only becomes available in the * innermost constructor. - * + * * @author Axel Uhl (d043530) * */ @@ -636,7 +636,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa /** * Like {@link #RacingEventServiceImpl()}, but allows callers to specify that the persistent competitor collection * be cleared before the service starts. - * + * * @param clearPersistentCompetitorAndBoatStore * if true, the {@link PersistentCompetitorAndBoatStore} is created empty, with the * corresponding database collection cleared as well. Use with caution! When used with @@ -841,7 +841,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa @Override public void competitorCreated(Competitor competitor) { replicate(new CreateCompetitor(competitor.getId(), competitor.getName(), competitor.getShortName(), - competitor.getColor(), competitor.getEmail(), competitor.getFlagImage(), + competitor.getColor(), competitor.getEmail(), competitor.getFlagImage(), competitor.getTeam()==null?null:competitor.getTeam().getNationality(), competitor.getTimeOnTimeFactor(), competitor.getTimeOnDistanceAllowancePerNauticalMile(), competitor.getSearchTag(), @@ -855,8 +855,8 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } @Override public void boatCreated(Boat boat) { - replicate(new CreateBoat(boat.getId(), boat.getName(), - boat.getBoatClass()==null?null:boat.getBoatClass().getName(), + replicate(new CreateBoat(boat.getId(), boat.getName(), + boat.getBoatClass()==null?null:boat.getBoatClass().getName(), boat.getSailID(), boat.getColor())); } }); @@ -907,7 +907,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa loadMediaLibary(); loadStoredDeviceConfigurations(); loadAllRemoteSailingServersAndSchedulePeriodicEventCacheRefresh(); - // Stores all events which run through a data migration + // Stores all events which run through a data migration // Remark: must be called after loadLinksFromEventsToLeaderboardGroups(), otherwise would loose the Event -> LeaderboardGroup relation for (Pair eventAndRequireStoreFlag : loadedEventsWithRequireStoreFlag) { if (eventAndRequireStoreFlag.getB()) { @@ -927,7 +927,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa this.trackedRegattaListener.addListener(raceChangeObserverForAnniversaryDetection); } } - + public ClassLoaderRegistry getMasterDataClassLoaders() { return masterDataClassLoaders; } @@ -936,14 +936,14 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public void addTrackedRegattaListener(TrackedRegattaListener listener) { trackedRegattaListener.addListener(listener); } - + @Override public void removeTrackedRegattaListener(TrackedRegattaListener listener) { trackedRegattaListener.removeListener(listener); } - + /** - * FIXME: Attention! This method is a migration effort. It shall not be called outside of the Activators initial startup, + * FIXME: Attention! This method is a migration effort. It shall not be called outside of the Activators initial startup, * since it does manipulate Preference Objects directly, outside of the preferenceLock in the UserStoreImpl. */ public void migrateCompetitorNotificationPreferencesWithCompetitorNames() { @@ -1039,12 +1039,12 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public SimulationService getSimulationService() { return simulationService; } - + @Override public TaggingService getTaggingService() { return taggingService; } - + @Override public void clearState() throws Exception { for (UUID leaderboardGroupID : new ArrayList<>(this.leaderboardGroupsByID.keySet())) { @@ -1111,12 +1111,12 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public String getName() { return "Simulator of server "+ServerInfo.getName(); } - + @Override public HasPermissions getPermissionType() { return SecuredDomainType.SIMULATOR; } - + @Override public QualifiedObjectIdentifier getIdentifier() { return SecuredDomainType.SIMULATOR.getQualifiedObjectIdentifier(new TypeRelativeObjectIdentifier(ServerInfo.getName())); @@ -1195,7 +1195,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } private Iterable> loadStoredEvents() { - Iterable> loadedEventsWithRequireStoreFlag = domainObjectFactory.loadAllEvents(); + Iterable> loadedEventsWithRequireStoreFlag = domainObjectFactory.loadAllEvents(); for (Pair eventAndFlag : loadedEventsWithRequireStoreFlag) { Event event = eventAndFlag.getA(); if (event.getId() != null) @@ -1203,7 +1203,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return loadedEventsWithRequireStoreFlag; } - + private void loadLinksFromEventsToLeaderboardGroups() { domainObjectFactory.loadLeaderboardGroupLinksForEvents(/* eventResolver */this, /* leaderboardGroupResolver */ this); @@ -1218,10 +1218,10 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa /** * Collects media track references from the configured sources (mongo DB by default, ftp folder yet to be * implemented). The method is expected to be called initially blocking the API until finished. - * + * * Subsequent calls (assumed to be triggered from the admin console or in scheduled intervals) don't need to block. * In that case, the API will simply serve the current state. - * + * */ private void loadMediaLibary() { Collection allDbMediaTracks = mediaDB.loadAllMediaTracks(); @@ -1269,7 +1269,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa logger.log(Level.SEVERE, "Couldn't register MBean for leaderboard "+leaderboard.getName(), e); } } - + private void removeMBeanForLeaderboard(Leaderboard leaderboard) { try { // register an MBean for the leaderboard for JMX support @@ -1598,7 +1598,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } } } - final Position result; + final Position result; if (track != null) { result = track.getEstimatedPosition(timePoint, /* extrapolate */ false); } else { @@ -1647,13 +1647,13 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public SailingServerConfiguration getSailingServerConfiguration() { return sailingServerConfiguration; } - + @Override public void updateServerConfiguration(SailingServerConfiguration serverConfiguration) { this.sailingServerConfiguration = serverConfiguration; mongoObjectFactory.storeServerConfiguration(serverConfiguration); } - + @Override public Map, Exception>> getPublicEventsOfAllSailingServers() { return remoteSailingServerSet.getCachedEventsForRemoteSailingServers(); @@ -1706,7 +1706,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa RemoteSailingServerReference ref, boolean forceUpdate) { return remoteSailingServerSet.getEventsOrException(ref, forceUpdate); } - + @Override public com.sap.sse.common.Util.Pair, Exception> getCompleteRemoteServerReference( RemoteSailingServerReference ref) { @@ -1739,9 +1739,9 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa regattas = getAllRegattas(); } } - return regattas; + return regattas; } - + @Override public Iterable getEventsSelectively(final boolean include, final Iterable eventIds) { Iterable events; @@ -1756,7 +1756,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa events = getAllEvents(); } } - return events; + return events; } @Override @@ -1954,7 +1954,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public RaceHandle addRace(RegattaIdentifier regattaToAddTo, RaceTrackingConnectivityParameters params, long timeoutInMilliseconds) throws Exception { return addRace(regattaToAddTo, params, timeoutInMilliseconds, getPermissionAwareRaceTrackingHandler()); } - + @Override public RaceHandle addRace(RegattaIdentifier regattaToAddTo, RaceTrackingConnectivityParameters params, long timeoutInMilliseconds, RaceTrackingHandler raceTrackingHandler) throws Exception { @@ -2044,7 +2044,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * connectivity parameters from the * {@link MongoObjectFactory#removeConnectivityParametersForRaceToRestore(RaceTrackingConnectivityParameters) DB} * when the {@link #removeRace(Regatta, RaceDefinition) race is removed}. - * + * * @param tracker * must have produced a {@link RaceDefinition} which can be guaranteed by waiting for the callback on a * {@link RaceTracker.RaceCreationListener} @@ -2060,7 +2060,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa /** * The regatta and all its contained {@link Regatta#getAllRaces() races} are replicated to all replicas. - * + * * @param regatta * the series of this regatta must not have any {@link Series#getRaceColumns() race columns associated * (yet)}. @@ -2168,19 +2168,19 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * race. When a tracked race is removed, the {@link TrackedRaceReplicatorAndNotifier} that was added as listener to * that tracked race is removed again. *

    - * + * * A {@link PolarFixCacheUpdater} is added to every race so that polar fixes are aggregated when new GPS fixes * arrive. *

    - * + * * Furthermore, the {@link RacingEventServiceImpl#numberOfTrackedRacesStillLoading} counter is adjusted based * on the {@link TrackedRace#getStatus() race status}. If a tracked race is removed and it hasn't been fully loaded * yet, the counter is decremented. If a new race is added, the counter is incremented and a function will be * {@link TrackedRace#runWhenDoneLoading(Runnable) executed when the race is fully loaded} which will decrement * it again. - * + * * @author Axel Uhl (d043530) - * + * */ private class RaceAdditionListener implements RaceListener, Serializable { private static final long serialVersionUID = 1036955460477000265L; @@ -2236,11 +2236,11 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa trackedRace.runWhenDoneLoading(()->numberOfTrackedRacesStillLoading.decrementAndGet()); } } - + /** * A score correction listener for a leaderboard that notifies interested users through the * {@link RacingEventServiceImpl#notificationService} if one is available. - * + * * @author Axel Uhl (d043530) * */ @@ -2252,11 +2252,11 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * interested in new results for that leaderboard or this boat class. */ private final Duration HOW_LONG_BETWEEN_TWO_NOTIFICATIONS_FOR_SIMILAR_EVENT = Duration.ONE_MINUTE.times(5); - + private TimePoint lastNotificationForLeaderboard; - + private final ConcurrentHashMap lastNotificationForCompetitor; - + private final Leaderboard leaderboard; /** @@ -2309,7 +2309,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa lastNotificationForLeaderboard = now; } } - + /** * @param raceColumn * may be {@code null} which means that something may have changed for the competitor outside of a @@ -2342,7 +2342,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa polarDataService.competitorPositionChanged(fix, item, race); } } - + @Override public void statusChanged(TrackedRaceStatus newStatus, TrackedRaceStatus oldStatus) { if (oldStatus.getStatus() == TrackedRaceStatusEnum.LOADING @@ -2360,7 +2360,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * {@link RaceChangeListener}. It does two things: replicate the changes to replica servers and, potentially, if * this is a replica, back to a master; notify users who expressed a corresponding interest about the change if we * have a {@link RacingEventServiceImpl##notificationService} available. - * + * * @author Axel Uhl (d043530) * */ @@ -2395,7 +2395,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public void startOfRaceChanged(TimePoint oldStartOfRace, TimePoint newStartOfRace) { // no replication action required; the update signaled by this call is implicit; for explicit updates // see raceTimesChanged(TimePoint, TimePoint, TimePoint). - + if (newStartOfRace != null && newStartOfRace.after(MillisecondsTimePoint.now())) { scheduler.execute(()-> // Notify interested users if the new start time is in the future @@ -2495,12 +2495,12 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public void speedAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) { replicate(new UpdateWindAveragingTime(getRaceIdentifier(), newMillisecondsOverWhichToAverage)); } - + @Override public void competitorSensorTrackAdded(DynamicSensorFixTrack track) { replicate(new RecordCompetitorSensorFixTrack(getRaceIdentifier(), track)); } - + @Override public void competitorSensorFixAdded(Competitor competitor, String trackName, SensorFix fix, AddResult addedOrReplaced) { replicate(new RecordCompetitorSensorFix(getRaceIdentifier(), competitor, trackName, fix)); @@ -2514,12 +2514,12 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public void regattaLogAttached(RegattaLog regattaLog) { // no action required } - + @Override public void raceLogAttached(RaceLog regattaLog) { // no action required } - + @Override public void raceLogDetached(RaceLog raceLog) { // no action required @@ -2529,7 +2529,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa final Triple slot = findMostAppropriateLeaderboardSlot(); return slot == null ? null : slot.getA(); } - + private RaceColumn getMostAppropriateRaceColumn() { final Triple slot = findMostAppropriateLeaderboardSlot(); return slot == null ? null : slot.getB(); @@ -2544,11 +2544,11 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * When all we have is a {@link #trackedRace} and we're looking for a slot in a leaderboard, we have to * search the enclosing {@link RacingEventService} for a leaderboard that has the {@link #trackedRace} * in a {@link RaceColumn}/{@link Fleet} slot.

    - * + * * As a first approximation we'll use the fact that a {@link RegattaLeaderboard}'s name is derived * from the {@link Regatta} and as such can be looked up in constant time. Only if such a regatta * leaderboard is not found, a search across all leaderboards will need to be carried out.

    - * + * * Note that this method should be called in a background thread that runs outside of the call stack * of the notification sent to this {@link RaceChangeListener}, ideally as a task in an executor. * This will avoid performance hits due to an attempt to send out notifications. @@ -2666,7 +2666,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * this fails after some timeout, to avoid garbage and lingering threads, the task scheduled by this method will * check after the timeout expires if race master data was successfully received. If so, the tracker continues * normally. Otherwise, the tracker is shut down orderly by calling {@link RaceTracker#stop(boolean) stopping}. - * + * * @return the scheduled task, in case the caller wants to {@link ScheduledFuture#cancel(boolean) cancel} it, e.g., * when the tracker is stopped or has successfully received the race */ @@ -2715,7 +2715,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa throw new RuntimeException(e); } } - + @Override public void stopTracker(Regatta regatta, RaceTracker tracker) throws MalformedURLException, IOException, InterruptedException { @@ -2726,20 +2726,20 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa throws MalformedURLException, IOException, InterruptedException { stopTracking(regatta, matcher, /* stopTrackerPreemptively */ false, /* trackerWillBeRemoved */ false); } - + /** * Under the read lock of {@link #raceTrackersByRegattaLock} searches for a {@link RaceTracker} matched by * {@code matcher} in {@code regatta}'s trackers from {@link #raceTrackersByRegatta}. After the search, the read * lock is released. *

    - * + * * If a tracker was found, the write locks for {@link #raceTrackersByID} (see {@link #lockRaceTrackersById(Object)}) * and {@link #raceTrackersByRegattaLock} are acquired, and an attempt is made to remove the {@link RaceTracker} * found from {@link #raceTrackersByID} and {@link #raceTrackersByRegatta} consistently, including removing the * {@code regatta} key from {@link #raceTrackersByRegatta} if removing the {@link RaceTracker} from the * {@code regatta}'s tracker set turned that tracker set empty. *

    - * + * * Since there is no lock held between releasing the read lock and acquiring the write locks, anything may have * happened in between regarding the presence of the {@link RaceTracker} found: it may have been removed by another * concurrent call to this method, and even a new {@link RaceTracker} with equal {@link RaceTracker#getID() ID} may @@ -2749,11 +2749,11 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * equal ID would lead to an inconsistent state if removing it here. We therefore must make sure that we remove only * the tracker that we found while holding the read lock {@link #raceTrackersByRegattaLock} by comparing the * {@link RaceTracker} objects by object identity before actually removing.

    - * + * * Should the {@link RaceTracker} found under the read lock not be found anymore while holding the write locks, * a warning will be logged.

    - * - * The + * + * The * Obtains the write lock of {@link #raceTrackersByRegattaLock}, then searches the {@code regatta}'s * {@link RaceTracker}s for one that is matched by the {@code matcher}. If found, the tracker is removed from the * regatta's tracker set, and if this turns the tracker set empty, the {@code regatta} key is also removed from @@ -2834,7 +2834,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa return result; } - private void stopTracking(Regatta regatta, Predicate matcher, boolean stopTrackerPreemtively, + private void stopTracking(Regatta regatta, Predicate matcher, boolean stopTrackerPreemtively, boolean trackerWillBeRemoved) throws MalformedURLException, IOException, InterruptedException { final RaceTracker raceTracker = getAndRemoveRaceTracker(regatta, matcher); if (raceTracker != null) { @@ -2929,13 +2929,13 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return regatta; } - + /** * The current implementation uses {@link #removeRace(Regatta, RaceDefinition)} to remove the {@link TrackedRace} * and the {@link RaceDefinition} and based on the {@link #connectivityParametersByRace} uses the connectivity * parameters of the previously existing tracked race to restore the race by tracking it again after * {@link #removeRace(Regatta, RaceDefinition)} has completed. - * + * * @return {@code null} if it was not possible to re-load the race, either because the regatta doesn't allow for it, * or because the connectivity parameters were not found; a {@link RaceHandle} for the re-started race * otherwise. @@ -3197,7 +3197,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public LeaderboardGroup getLeaderboardGroupByID(UUID leaderboardGroupID) { final LeaderboardGroup result; if (leaderboardGroupID != null) { - result = leaderboardGroupsByID.get(leaderboardGroupID); + result = leaderboardGroupsByID.get(leaderboardGroupID); } else { result = null; } @@ -3215,7 +3215,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return null; } - + @Override public LeaderboardGroup addLeaderboardGroup(UUID leaderboardGroupId, String groupName, String description, String displayName, boolean displayGroupsInReverseOrder, List leaderboardNames, @@ -3301,7 +3301,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa * Renames the group with the name oldName to the newName.
    * If there's no group with the name oldName or there's already a group with the name * newName a {@link IllegalArgumentException} is thrown. - * + * * @param oldName The old name of the group * @param newName The new name of the group */ @@ -3389,7 +3389,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public ObjectInputStream createObjectInputStreamResolvingAgainstCache(InputStream is, Map> classLoaderCache) throws IOException { return getBaseDomainFactory().createObjectInputStreamResolvingAgainstThisFactory(is, /* resolve listener */ null, classLoaderCache); } - + @Override public ClassLoader getDeserializationClassLoader() { return masterDataClassLoaders.getCombinedMasterDataClassLoader(); @@ -3702,7 +3702,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa @Override public Event createEventWithoutReplication(String eventName, String eventDescription, TimePoint startDate, - TimePoint endDate, String venue, boolean isPublic, UUID id, URL officialWebsiteURL, URL baseURL, + TimePoint endDate, String venue, boolean isPublic, UUID id, URL officialWebsiteURL, URL baseURL, Map sailorsInfoWebsiteURLs, Iterable images, Iterable videos) { Event result = new EventImpl(eventName, startDate, endDate, venue, isPublic, id); addEvent(result); @@ -4022,7 +4022,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return Optional.ofNullable(resultUrlRegistryServiceTracker.getService()); } - + @Override public Optional getUrlBasedScoreCorrectionProvider(String resultProviderName) { for (ResultUrlProvider resultUrlProvider : getAllUrlBasedScoreCorrectionProviders()) { @@ -4075,7 +4075,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public String toString() { return "RacingEventService: " + this.hashCode() + " Build: " + ServerInfo.getBuildVersion(); } - + @Override public void reloadRaceLog(String leaderboardName, String raceColumnName, String fleetName) { Leaderboard leaderboard = getLeaderboardByName(leaderboardName); @@ -4089,7 +4089,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa logger.info("Reloaded race log for fleet " + fleetImpl + " for race column " + raceColumn.getName() + " for leaderboard " + leaderboard.getName()); } - } + } } } @@ -4156,7 +4156,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - + @Override public TimePoint setEndTime(String leaderboardName, String raceColumnName, String fleetName, String authorName, int authorPriority, int passId, TimePoint logicalTimePoint) { @@ -4172,7 +4172,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - + @Override public TimePoint setFinishingTime(String leaderboardName, String raceColumnName, String fleetName, String authorName, Integer authorPriority, int passId, MillisecondsTimePoint logicalTimePoint) { @@ -4210,17 +4210,17 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa if (raceColumn != null && fleet != null) { RaceLog raceLog = raceColumn.getRaceLog(fleet); // take the boats first from the racelog - if (raceLog != null) { + if (raceLog != null) { Map competitorAndBoatsInRacelog = new CompetitorsAndBoatsInLogAnalyzer<>(raceLog).analyze(); result.putAll(competitorAndBoatsInRacelog); } - // now look into the tracked race for mappings of competitors without a boat + // now look into the tracked race for mappings of competitors without a boat TrackedRace trackedRace = raceColumn.getTrackedRace(fleet); if (trackedRace != null) { Map competitorsAndBoatsFromRaceDef = trackedRace.getRace().getCompetitorsAndTheirBoats(); for (Competitor competitor: competitorsAndBoatsFromRaceDef.keySet()) { if (!result.containsKey(competitor)) { - result.put(competitor, competitorsAndBoatsFromRaceDef.get(competitor)); + result.put(competitor, competitorsAndBoatsFromRaceDef.get(competitor)); } } } @@ -4228,9 +4228,9 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - - + + @Override public com.sap.sse.common.Util.Triple getStartTimeAndProcedure( String leaderboardName, String raceColumnName, String fleetName) { @@ -4246,7 +4246,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - + @Override public com.sap.sse.common.Util.Triple getFinishingAndFinishTime( String leaderboardName, String raceColumnName, String fleetName) { @@ -4551,14 +4551,14 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } } } - + public void unsetPolarDataService(PolarDataService service) { if (polarDataService == service) { polarDataService = null; setPolarDataServiceOnAllTrackedRaces(null); } } - + /** * A {@link SimpleRaceLogIdentifier} in particular has a {@link SimpleRaceLogIdentifier#getRegattaLikeParentName()} * which identifies either a regatta by name or a flexible leaderboard by name. Here is why this can luckily be @@ -4588,7 +4588,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - + @Override public TrackedRace resolveTrackedRace(SimpleRaceLogIdentifier identifier) { return resolveFromSimpleRaceLogIdentifier(identifier, (raceColumn, fleet)->raceColumn.getTrackedRace(fleet)); @@ -4771,7 +4771,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa private static Stream stream(Iterable iterable) { return StreamSupport.stream(iterable.spliterator(), false); } - + @Override public Map> getLocalRaceList(Predicate eventListFilter) { Map> store = new HashMap<>(); @@ -4793,7 +4793,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa })); return store; } - + @Override public DetailedRaceInfo getFullDetailsForRaceLocal(RegattaAndRaceIdentifier raceIdentifier) { DetailedRaceInfo bestMatch = null; @@ -4879,7 +4879,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa return null; } } - + @Override public Set findEventsContainingLeaderboardAndMatchingAtLeastOneCourseArea(Leaderboard leaderboard, Iterable events) { @@ -4918,7 +4918,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return bestMatch; } - + @Override public Pair getNextAnniversary() { return anniversaryRaceDeterminator.getNextAnniversary(); @@ -4933,14 +4933,14 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa public Map> getKnownAnniversaries() { return anniversaryRaceDeterminator.getKnownAnniversaries(); } - + @Override public AnniversaryRaceDeterminatorImpl getAnniversaryRaceDeterminator() { return anniversaryRaceDeterminator; } - + @Override - public PairingListTemplate createPairingListTemplate(final int flightsCount, final int groupsCount, + public PairingListTemplate createPairingListTemplate(final int flightsCount, final int groupsCount, final int competitorsCount, final int flightMultiplier, final int boatChangeFactor) { PairingListTemplate template = pairingListTemplateFactory .createPairingListTemplate(new PairingFrameProvider() { @@ -4961,7 +4961,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa }, flightMultiplier, boatChangeFactor); return template; } - + @Override public PairingList getPairingListFromTemplate(PairingListTemplate pairingListTemplate, final String leaderboardName, final Iterable selectedRaceColumns) throws PairingListCreationException { @@ -4997,7 +4997,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa }); return pairingList; } - + @Override public Iterable getAllWindFinderReviewedSpotsCollectionIds() { final Set result = new HashSet<>(); @@ -5006,7 +5006,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } return result; } - + @Override public Iterable getWindFinderReviewedSpotsCollectionIdsByRegatta(RegattaIdentifier regattaIdentifier) { final Set result = new HashSet<>(); @@ -5027,7 +5027,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa /** * Creates a new {@link CompetitorWithBoat} objects from a {@link CompetitorDescriptor}. - * + * * @param searchTag * set as the {@link Competitor#getSearchTag() searchTag} property of all new competitors */ @@ -5063,7 +5063,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa return null; } } - + @Override public CourseAndMarkConfigurationFactory getCourseAndMarkConfigurationFactory() { return courseAndMarkConfigurationFactory; @@ -5171,7 +5171,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } } } - + private String createLeaderboardQuery(UUID[] leaderboardGroupIds, boolean compress, boolean exportWind, boolean exportDeviceConfigurations, boolean exportTrackedRacesAndStartTracking) throws UnsupportedEncodingException { @@ -5216,7 +5216,7 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa return super.read(b, off, len); } } - + @Override public int getNumberOfTrackedRacesStillLoading() { return numberOfTrackedRacesStillLoading.get(); @@ -5296,12 +5296,12 @@ implements RacingEventService, ClearStateTestSupport, RegattaListener, Leaderboa } } } - } + } StringBuilder racesInCollision = new StringBuilder(); for (String raceName : racesContainingMarksToDeleteInCourse) { racesInCollision.append(raceName+", "); } - return new Pair(marksAreUsedInOtherRaceLogs, + return new Pair(marksAreUsedInOtherRaceLogs, racesInCollision.substring(0, Math.max(0, racesInCollision.length()-2))); } } diff --git a/java/com.sap.sailing.xrr.structureimport/src/com/sap/sailing/xrr/structureimport/SeriesParameters.java b/java/com.sap.sailing.xrr.structureimport/src/com/sap/sailing/xrr/structureimport/SeriesParameters.java index 21c84fdd887..7d2d29b222f 100755 --- a/java/com.sap.sailing.xrr.structureimport/src/com/sap/sailing/xrr/structureimport/SeriesParameters.java +++ b/java/com.sap.sailing.xrr.structureimport/src/com/sap/sailing/xrr/structureimport/SeriesParameters.java @@ -12,7 +12,7 @@ public class SeriesParameters { boolean hasCrossFleetMergedRanking, boolean startswithZeroScore, int[] discardingThresholds, Integer maximumNumberOfDiscards) { this.firstColumnIsNonDiscardableCarryForward = firstColumnIsNonDiscardableCarryForward; this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; - this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; + this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; this.startswithZeroScore = startswithZeroScore; this.discardingThresholds = discardingThresholds; this.maximumNumberOfDiscards = maximumNumberOfDiscards; @@ -29,7 +29,7 @@ public class SeriesParameters { public boolean isHasSplitFleetContiguousScoring() { return hasSplitFleetContiguousScoring; } - + public boolean isHasCrossFleetMergedRanking() { return hasCrossFleetMergedRanking; } @@ -37,7 +37,7 @@ public class SeriesParameters { public void setSplitFleetContiguousScoring(boolean hasSplitFleetContiguousScoring) { this.hasSplitFleetContiguousScoring = hasSplitFleetContiguousScoring; } - + public void setCrossFleetMergedRanking(boolean hasCrossFleetMergedRanking) { this.hasCrossFleetMergedRanking = hasCrossFleetMergedRanking; }