mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-31 00:07:14 +00:00
added zeroBasedIndexInFleet to FilterableRace and ManagedRaceImpl
Change-Id: I0d14a949d1905ded6d84107f2f4de3af30d512b3
This commit is contained in:
1 parent
3ff77640e8
commit
2fe8099f61
5 files changed
+59
-13
No files matched your search
+6
-3
@@ -111,7 +111,8 @@ public class OfflineDataManager extends DataManager {
|
||||
AppPreferences.on(context).getAuthor(), 1, RaceLogRaceStatus.FINISHING));
|
||||
|
||||
ManagedRace q1 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("A.B", new FleetImpl("A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration));
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 0);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
@@ -120,7 +121,8 @@ public class OfflineDataManager extends DataManager {
|
||||
*/
|
||||
|
||||
ManagedRace q2 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("B", new FleetImpl("A.A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration));
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 1);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
@@ -128,7 +130,8 @@ public class OfflineDataManager extends DataManager {
|
||||
* RaceLogRaceStatus.FINISHED));
|
||||
*/
|
||||
ManagedRace q3 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("Q3", new FleetImpl("Default"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration));
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 2);
|
||||
/*
|
||||
* ManagedRace m1 = new ManagedRaceImpl( new ManagedRaceIdentifierImpl( "M1", new FleetImpl("Default"), medal,
|
||||
* raceGroup), null);
|
||||
|
||||
+5
-3
@@ -64,7 +64,8 @@ public class ManagedRacesDataParser implements DataParser<Collection<ManagedRace
|
||||
for (RaceRow raceRow : series.getRaceRows()) {
|
||||
Fleet fleet = raceRow.getFleet();
|
||||
for (RaceCell cell : raceRow.getCells()) {
|
||||
ManagedRace race = createManagedRace(raceGroup, series, fleet, cell.getName(), cell.getRaceLog(), cell.getFactor(), cell.getExplicitFactor());
|
||||
ManagedRace race = createManagedRace(raceGroup, series, fleet, cell.getName(), cell.getRaceLog(),
|
||||
cell.getFactor(), cell.getExplicitFactor(), cell.getZeroBasedIndexInFleet());
|
||||
target.add(race);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +73,7 @@ public class ManagedRacesDataParser implements DataParser<Collection<ManagedRace
|
||||
}
|
||||
|
||||
private ManagedRace createManagedRace(RaceGroup raceGroup, SeriesBase series, Fleet fleet, String raceColumnName,
|
||||
RaceLog raceLog, double factor, Double explicitFactor) {
|
||||
RaceLog raceLog, double factor, Double explicitFactor, int zeroBasedIndexInFleet) {
|
||||
ConfigurationLoader<RegattaConfiguration> configurationLoader = globalConfigurationLoader;
|
||||
RegattaConfiguration localConfiguration = raceGroup.getRegattaConfiguration();
|
||||
if (localConfiguration != null) {
|
||||
@@ -80,7 +81,8 @@ public class ManagedRacesDataParser implements DataParser<Collection<ManagedRace
|
||||
}
|
||||
FleetIdentifier fleetIdentifier = new FleetIdentifierImpl(fleet, series, raceGroup);
|
||||
ManagedRaceIdentifier identifier = new ManagedRaceIdentifierImpl(raceColumnName, fleetIdentifier);
|
||||
return new ManagedRaceImpl(identifier, new ManagedRaceCalculator(raceLog, author, configurationLoader), factor, explicitFactor);
|
||||
return new ManagedRaceImpl(identifier, new ManagedRaceCalculator(raceLog, author, configurationLoader),
|
||||
factor, explicitFactor, zeroBasedIndexInFleet);
|
||||
}
|
||||
|
||||
}
|
||||
+30
-5
@@ -12,6 +12,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceCell;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
@@ -21,6 +22,7 @@ import com.sap.sailing.racecommittee.app.domain.ManagedRaceIdentifier;
|
||||
import com.sap.sailing.racecommittee.app.domain.MapMarker;
|
||||
import com.sap.sailing.racecommittee.app.utils.ManagedRaceCalculator;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class ManagedRaceImpl implements ManagedRace {
|
||||
@@ -33,22 +35,39 @@ public class ManagedRaceImpl implements ManagedRace {
|
||||
private ManagedRaceCalculator calculator;
|
||||
private double factor;
|
||||
private Double explicitFactor;
|
||||
private final int zeroBasedIndexInFleet;
|
||||
|
||||
private ManagedRaceImpl(ManagedRaceIdentifier identifier, double factor, Double explicitFactor) {
|
||||
/**
|
||||
* @param zeroBasedIndexInFleet
|
||||
* A Series offers a sequence of RaceColumns, each of them split according to the Fleets modeled for the
|
||||
* Series. A {@link RaceCell} describes a "slot" in this grid, defined by the series, the fleet and the
|
||||
* race column. While this object's {@link #getName() name} represents the race column's name, this
|
||||
* doesn't tell anything about the "horizontal" position in the "grid" or in other words what the index
|
||||
* is of the race column in which this cell lies.
|
||||
* <p>
|
||||
*
|
||||
* Indices returned by this method start with zero, meaning the first race column in the series. This
|
||||
* corresponds to what one would get by asking {@link Util#indexOf(Iterable, Object)
|
||||
* Util.indexOf(series.getRaceColumns(), thisCellsRaceColumn)}, except in case the first race column is a
|
||||
* "virtual" one that holds a non-discardable carry-forward result. In this case, the second Race Column,
|
||||
* which is the first "non-virtual" one, receives index 0.
|
||||
*/
|
||||
private ManagedRaceImpl(ManagedRaceIdentifier identifier, double factor, Double explicitFactor, int zeroBasedIndexInFleet) {
|
||||
this.identifier = identifier;
|
||||
this.competitors = new ArrayList<>();
|
||||
this.courseOnServer = null;
|
||||
this.factor = factor;
|
||||
this.explicitFactor = explicitFactor;
|
||||
this.zeroBasedIndexInFleet = zeroBasedIndexInFleet;
|
||||
}
|
||||
|
||||
public ManagedRaceImpl(ManagedRaceIdentifier identifier, RaceState state) {
|
||||
this(identifier, 0, null);
|
||||
public ManagedRaceImpl(ManagedRaceIdentifier identifier, RaceState state, int zeroBasedIndexInFleet) {
|
||||
this(identifier, 0, null, zeroBasedIndexInFleet);
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public ManagedRaceImpl(ManagedRaceIdentifier identifier, ManagedRaceCalculator calculator, double factor, Double explicitFactor) {
|
||||
this(identifier, factor, explicitFactor);
|
||||
public ManagedRaceImpl(ManagedRaceIdentifier identifier, ManagedRaceCalculator calculator, double factor, Double explicitFactor, int zeroBasedIndexInFleet) {
|
||||
this(identifier, factor, explicitFactor, zeroBasedIndexInFleet);
|
||||
this.calculator = calculator;
|
||||
}
|
||||
|
||||
@@ -201,4 +220,10 @@ public class ManagedRaceImpl implements ManagedRace {
|
||||
public String toString() {
|
||||
return "ManagedRaceImpl [identifier=" + identifier + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZeroBasedIndexInFleet() {
|
||||
return zeroBasedIndexInFleet;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -529,10 +529,10 @@ public class RaceListFragment extends LoggableFragment implements OnItemClickLis
|
||||
}
|
||||
}
|
||||
|
||||
private void showProtestTimeDialog(String raceGroupName) {
|
||||
private void showProtestTimeDialog(String raceGroupDisplayName) {
|
||||
// Find the race group for which the
|
||||
for (RaceGroupSeriesFleet raceGroupSeriesFleet : mRacesByGroup.keySet()) {
|
||||
Boolean matchingRaceGroup = raceGroupName.equals(raceGroupSeriesFleet.getDisplayName());
|
||||
Boolean matchingRaceGroup = raceGroupDisplayName.equals(raceGroupSeriesFleet.getDisplayName());
|
||||
if (matchingRaceGroup) {
|
||||
List<ManagedRace> races = mRacesByGroup.get(raceGroupSeriesFleet);
|
||||
if (!isRaceListDirty(races)) {
|
||||
|
||||
Reference in new issue
Block a user