mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 22:37:15 +00:00
fixed passing through of RankingMetricConstructor in test case
This commit is contained in:
1 parent
1a9ce82928
commit
d66df2f633
2 files changed
+24
-5
No files matched your search
+3
-2
@@ -80,6 +80,7 @@ public class TestSimpleTimeOnTimeRankingWithOneUpwindLeg {
|
||||
trackedRace = createTrackedRace(Arrays.asList(c1, c2), timeOnTimeFactors, timeOnDistanceFactors);
|
||||
tot = (TimeOnTimeAndDistanceRankingMetricWithAccessibleGetRankingInfo) trackedRace.getRankingMetric();
|
||||
assertEquals(60, trackedRace.getCourseLength().getNauticalMiles(), 0.01);
|
||||
assertSame(RankingMetrics.TIME_ON_TIME_AND_DISTANCE, trackedRace.getTrackedRegatta().getRegatta().getRankingMetricType());
|
||||
}
|
||||
|
||||
private DynamicTrackedRace createTrackedRace(Iterable<Competitor> competitors, Function<Competitor, Double> timeOnTimeFactors, Function<Competitor, Double> timeOnDistanceFactors) {
|
||||
@@ -87,7 +88,7 @@ public class TestSimpleTimeOnTimeRankingWithOneUpwindLeg {
|
||||
BoatClassImpl boatClass = new BoatClassImpl("Some Handicap Boat Class", /* typicallyStartsUpwind */ true);
|
||||
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
|
||||
RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
|
||||
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null);
|
||||
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* courseArea */ null, TimeOnTimeAndDistanceRankingMetric::new);
|
||||
TrackedRegatta trackedRegatta = new DynamicTrackedRegattaImpl(regatta);
|
||||
List<Waypoint> waypoints = new ArrayList<Waypoint>();
|
||||
// create a two-lap upwind/downwind course:
|
||||
@@ -209,7 +210,7 @@ public class TestSimpleTimeOnTimeRankingWithOneUpwindLeg {
|
||||
|
||||
@Test
|
||||
public void testTimeOnDistanceWithFactorTwoC1TwiceAsFarAsC2() {
|
||||
setUp(c -> 1.0, c -> c==c1 ? 180. : 360.); // c1 is twice as fast (350s instead of 700s to the mile) as c2
|
||||
setUp(c -> 1.0, c -> c==c1 ? 180. : 360.); // c1 is twice as fast (180s instead of 360s to the mile) as c2
|
||||
final TimePoint startOfRace = MillisecondsTimePoint.now();
|
||||
final TimePoint middleOfFirstLeg = startOfRace.plus(Duration.ONE_HOUR.times(3));
|
||||
trackedRace.updateMarkPassings(
|
||||
|
||||
@@ -134,11 +134,29 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
|
||||
public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass, TimePoint startDate, TimePoint endDate,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, ScoringScheme scoringScheme, Serializable id,
|
||||
CourseArea courseArea) {
|
||||
this(raceLogStore, regattaLogStore, name, boatClass, startDate, endDate, Collections.singletonList(
|
||||
new SeriesImpl(LeaderboardNameConstants.DEFAULT_SERIES_NAME,
|
||||
this(raceLogStore, regattaLogStore, name, boatClass, startDate, endDate, trackedRegattaRegistry, scoringScheme,
|
||||
id, courseArea, OneDesignRankingMetric::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a regatta with a single default series with empty race column list, and a single default fleet which
|
||||
* is not {@link #isPersistent() marked for persistence}.
|
||||
*
|
||||
* @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)}
|
||||
* with this column's series' {@link TrackedRegatta}, and the tracked race's {@link RaceDefinition} with
|
||||
* this column's series {@link Regatta}, respectively. If <code>null</code>, the re-association won't be
|
||||
* carried out.
|
||||
*/
|
||||
public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass,
|
||||
TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
ScoringScheme scoringScheme, Serializable id, CourseArea courseArea, RankingMetricConstructor rankingMetricConstructor) {
|
||||
this(raceLogStore, regattaLogStore, name, boatClass, startDate, endDate, Collections
|
||||
.singletonList(new SeriesImpl(LeaderboardNameConstants.DEFAULT_SERIES_NAME,
|
||||
/* isMedal */false, Collections.singletonList(new FleetImpl(LeaderboardNameConstants.DEFAULT_FLEET_NAME)),
|
||||
/* race column names */new ArrayList<String>(), trackedRegattaRegistry)), /* persistent */false,
|
||||
scoringScheme, id, courseArea, /* useStartTimeInference */ true, OneDesignRankingMetric::new);
|
||||
scoringScheme, id, courseArea, /* useStartTimeInference */ true, rankingMetricConstructor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user