added scoring scheme HighPointWinnerGetsFiveIgnoringRaceCount as a variant that ignores the race count; geared towards Bundesliga scoring

This commit is contained in:
Axel Uhl committed 2014-07-21 15:42:02 +02:00
1 parent fb94da5985
commit 2dad273c4f
8 files changed
+17 -3

No files matched your search

@@ -2,5 +2,6 @@ package com.sap.sailing.domain.common;
public enum ScoringSchemeType {
LOW_POINT, HIGH_POINT, HIGH_POINT_ESS_OVERALL, HIGH_POINT_LAST_BREAKS_TIE, HIGH_POINT_FIRST_GETS_TEN,
HIGH_POINT_FIRST_GETS_ONE, LOW_POINT_WINNER_GETS_ZERO, HIGH_POINT_WINNER_GETS_SIX, HIGH_POINT_WINNER_GETS_FIVE
HIGH_POINT_FIRST_GETS_ONE, LOW_POINT_WINNER_GETS_ZERO, HIGH_POINT_WINNER_GETS_SIX, HIGH_POINT_WINNER_GETS_FIVE,
HIGH_POINT_WINNER_GETS_FIVE_IGNORING_RACE_COUNT
}
@@ -35,6 +35,7 @@ import com.sap.sailing.domain.leaderboard.impl.HighPointFirstGets10LastBreaksTie
import com.sap.sailing.domain.leaderboard.impl.HighPointFirstGets1LastBreaksTie;
import com.sap.sailing.domain.leaderboard.impl.HighPointLastBreaksTie;
import com.sap.sailing.domain.leaderboard.impl.HighPointWinnerGetsFive;
import com.sap.sailing.domain.leaderboard.impl.HighPointWinnerGetsFiveIgnoringRaceCount;
import com.sap.sailing.domain.leaderboard.impl.HighPointWinnerGetsSix;
import com.sap.sailing.domain.leaderboard.impl.LowPoint;
import com.sap.sailing.domain.leaderboard.impl.LowPointWinnerGetsZero;
@@ -90,6 +91,8 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
return new LowPointWinnerGetsZero();
case HIGH_POINT_WINNER_GETS_FIVE:
return new HighPointWinnerGetsFive();
case HIGH_POINT_WINNER_GETS_FIVE_IGNORING_RACE_COUNT:
return new HighPointWinnerGetsFiveIgnoringRaceCount();
case HIGH_POINT_WINNER_GETS_SIX:
return new HighPointWinnerGetsSix();
}
@@ -128,7 +128,6 @@ public abstract class AbstractScoringSchemeImpl implements ScoringScheme {
*/
@Override
public int compareByBetterScore(List<com.sap.sse.common.Util.Pair<RaceColumn, Double>> o1Scores, List<com.sap.sse.common.Util.Pair<RaceColumn, Double>> o2Scores, boolean nullScoresAreBetter) {
assert o1Scores.size() == o2Scores.size();
final Comparator<Double> pureScoreComparator = getScoreComparator(nullScoresAreBetter);
// needs to compare net points; therefore, divide the total points by the column factor for comparison:
List<Double> o1NetScores = new ArrayList<>();
@@ -148,6 +147,11 @@ public abstract class AbstractScoringSchemeImpl implements ScoringScheme {
while (result == 0 && o1Iter.hasNext() && o2Iter.hasNext()) {
result = pureScoreComparator.compare(o1Iter.next(), o2Iter.next());
}
if (o1Iter.hasNext() != o2Iter.hasNext()) {
// if, as may be allowed by some scoring scheme variants, competitors with different numbers of scored races are compared
// and are equal for all races of the competitor who scored fewer races, the competitor who scored more races is preferred
result = o1Iter.hasNext() ? -1 : 1;
}
return result;
}
@@ -380,7 +380,8 @@ public interface StringMessages extends Messages {
String scoringSchemeLowPointSystem();
String scoringSchemeHighPointSystem();
String scoringSchemeLowPointWinnerGetsZero();
String scoringSchemeWinnerGetsFive();
String scoringSchemeWinnerGetsFive();
String scoringSchemeWinnerGetsFiveIgnoringRaceCount();
String scoringSchemeWinnerGetsSix();
String scoringSystem();
String createFlexibleLeaderboard();
@@ -408,6 +408,7 @@ scoringSchemeHighPointEssOverall=High Point System ESS Overall
scoringSchemeHighPointLastBreaksTie=High Point System, Last Race Breaks Tie
scoringSchemeLowPointWinnerGetsZero=Low Point System, Winner Gets Zero
scoringSchemeWinnerGetsFive=High Point System, Winner Gets 5 Points
scoringSchemeWinnerGetsFiveIgnoringRaceCount=High Point System, Winner Gets 5 Points, Ignoring Race Count
scoringSchemeWinnerGetsSix=High Point System, Winner Gets 6 Points
scoringSystem=Scoring system
createFlexibleLeaderboard=Create flexible leaderboard
@@ -409,6 +409,7 @@ scoringSchemeHighPointEssOverall=High Point System ESS Gesamtwertung
scoringSchemeHighPointLastBreaksTie=High Point System, letztes Rennen entscheidet bei Gleichstand
scoringSchemeLowPointWinnerGetsZero=Low Point System, Gewinner erhält 0 Punkte
scoringSchemeWinnerGetsFive=High Point System, Gewinner erhält 5 Punkte
scoringSchemeWinnerGetsFiveIgnoringRaceCount=High Point System, Gewinner erhält 5 Punkte, Anzahl Wettfahrten egal
scoringSchemeWinnerGetsSix=High Point System, Gewinner erhält 6 Punkte
scoringSystem=Bepunktungssystem
createFlexibleLeaderboard=Flexible Rangliste anlegen
@@ -399,6 +399,7 @@ scoringSchemeHighPointEssOverall=Высокобальная система по
scoringSchemeHighPointLastBreaksTie=Высокобальная система подсчета, тай-брейк на последней гонке
scoringSchemeLowPointWinnerGetsZero=Низкобальная система подсчета очков, победитель получает ноль очков
scoringSchemeWinnerGetsFive=Высокобальная система подсчета, победитель получает 5 очков
scoringSchemeWinnerGetsFiveIgnoringRaceCount=Высокобальная система подсчета, победитель получает 5 очков, Ignoring Race Count
scoringSchemeWinnerGetsSix=Высокобальная система подсчета, победитель получает 6 очков
scoringSystem=Система подсчета очков
createFlexibleLeaderboard=Создание адаптивной таблицы лидеров
@@ -22,6 +22,8 @@ public class ScoringSchemeTypeFormatter {
return stringMessages.scoringSchemeLowPointWinnerGetsZero();
case HIGH_POINT_WINNER_GETS_FIVE:
return stringMessages.scoringSchemeWinnerGetsFive();
case HIGH_POINT_WINNER_GETS_FIVE_IGNORING_RACE_COUNT:
return stringMessages.scoringSchemeWinnerGetsFiveIgnoringRaceCount();
case HIGH_POINT_WINNER_GETS_SIX:
return stringMessages.scoringSchemeWinnerGetsSix();
}