introduced JSON format for TargetTimeInfo and use it in RegattasResource's targettime method

Change-Id: I93bf54964c34b0a25b5a15e37f9efb6e962bab01
This commit is contained in:
Axel Uhl committed 2017-01-04 10:39:30 +01:00
1 parent 710ea4d23b
commit 1664286df3
22 files changed
+251 -72

No files matched your search

@@ -1,6 +1,7 @@
package com.sap.sailing.domain.base.racegroup;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.common.TargetTimeInfo;
import com.sap.sse.common.Named;
import com.sap.sse.common.Util;
@@ -33,4 +34,11 @@ public interface RaceCell extends Named {
* index 0.
*/
int getZeroBasedIndexInFleet();
/**
* If there is a tracked race for this race and we have sufficient information about wind and the boat class's
* polar / VPP data this method will return an estimated duration for how long the race will take based on the
* current course.
*/
TargetTimeInfo getTargetTime();
}
@@ -2,6 +2,7 @@ package com.sap.sailing.domain.base.racegroup.impl;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.base.racegroup.RaceCell;
import com.sap.sailing.domain.common.TargetTimeInfo;
import com.sap.sse.common.Util;
import com.sap.sse.common.impl.NamedImpl;
@@ -21,6 +22,8 @@ public class RaceCellImpl extends NamedImpl implements RaceCell {
private final Double explicitFactor;
private final int zeroBasedIndexInFleet;
private final TargetTimeInfo targetTime;
/**
* @param zeroBasedIndexInFleet
@@ -34,12 +37,13 @@ public class RaceCellImpl extends NamedImpl implements RaceCell {
* 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.
*/
public RaceCellImpl(String raceColumnName, RaceLog raceLog, double factor, Double explicitFactor, int zeroBasedIndexInFleet) {
public RaceCellImpl(String raceColumnName, RaceLog raceLog, double factor, Double explicitFactor, int zeroBasedIndexInFleet, TargetTimeInfo targetTime) {
super(raceColumnName);
this.raceLog = raceLog;
this.factor = factor;
this.explicitFactor = explicitFactor;
this.zeroBasedIndexInFleet = zeroBasedIndexInFleet;
this.targetTime = targetTime;
}
@Override
@@ -70,9 +74,14 @@ public class RaceCellImpl extends NamedImpl implements RaceCell {
return zeroBasedIndexInFleet;
}
@Override
public TargetTimeInfo getTargetTime() {
return targetTime;
}
@Override
public String toString() {
return "RaceCellImpl [factor=" + factor + ", explicitFactor=" + explicitFactor + ", zeroBasedIndexInFleet="
+ zeroBasedIndexInFleet + ", getName()=" + getName() + "]";
+ zeroBasedIndexInFleet + ", name=" + getName() + ", targetTime: " + getTargetTime() + "]";
}
}