Adds the ability to get only the comeptitors registered in the Racelog

This commit is contained in:
Jan Broß committed 2015-11-28 12:50:08 +01:00
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);
}
@@ -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();
}
}
}