mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 17:21:00 +00:00
Adds the ability to get only the comeptitors registered in the Racelog
This commit is contained in:
1 parent
770377d75d
commit
919623f0b6
2 files changed
+43
No files matched your search
@@ -262,4 +262,19 @@ public interface RaceColumn extends Named {
|
||||
* Same as {@link #getAllCompetitors()}, but restricted to the single race identified by the <code>fleet</code> parameter.
|
||||
*/
|
||||
Iterable<Mark> getAllMarks(Fleet fleet);
|
||||
|
||||
/**
|
||||
* Returns the competitor set registered in the race column's race log associated to the passed fleet.
|
||||
* If competitor registration in RaceLog is disabled or in case of a MetaLeaderboardColumn an empty set is returned.
|
||||
* @param fleet
|
||||
* @return competitors in RaceLog if registration enabled or empty set in case this column belongs to a {@link MetaLeaderboard}
|
||||
*/
|
||||
Iterable<Competitor> getCompetitorsRegisteredInRacelog(Fleet fleet);
|
||||
|
||||
/**
|
||||
* Checks whether competitor registration on RaceLog is enabled.
|
||||
* @param fleet
|
||||
* @return boolean if competitor registration on the RaceLog is enabled, false in case this column belongs to a {@link MetaLeaderboard}
|
||||
*/
|
||||
boolean isCompetitorRegistrationInRacelogEnabled(Fleet fleet);
|
||||
}
|
||||
+28
@@ -1,5 +1,10 @@
|
||||
package com.sap.sailing.domain.base.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogRegisteredCompetitorsAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
@@ -114,5 +119,28 @@ public abstract class SimpleAbstractRaceColumn implements RaceColumn {
|
||||
public boolean hasSplitFleets() {
|
||||
return Util.size(getFleets()) > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Competitor> getCompetitorsRegisteredInRacelog(final Fleet fleet) {
|
||||
RaceLog raceLog = getRaceLog(fleet);
|
||||
|
||||
if (raceLog == null){
|
||||
return Collections.emptySet();
|
||||
} else {
|
||||
RaceLogRegisteredCompetitorsAnalyzer analyzer = new RaceLogRegisteredCompetitorsAnalyzer(raceLog);
|
||||
return analyzer.analyze();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompetitorRegistrationInRacelogEnabled(final Fleet fleet) {
|
||||
RaceLog raceLog = getRaceLog(fleet);
|
||||
|
||||
if (raceLog == null){
|
||||
return false;
|
||||
} else {
|
||||
RaceLogUsesOwnCompetitorsAnalyzer analyzer = new RaceLogUsesOwnCompetitorsAnalyzer(raceLog);
|
||||
return analyzer.analyze();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user