bug5292: renamed variables to highlight their role as effective values

This commit is contained in:
Dennis Aulenbacher
2020-07-01 12:54:58 +02:00
parent 610fbd2d0c
commit b546358cee
3 changed files with 21 additions and 21 deletions
@@ -427,11 +427,11 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
}
// replace null values of Regatta specific competitor handicap values with the respective competitor's default values
for(LeaderboardRowDTO row : rows.values()) {
if(row.timeOnDistanceAllowancePerNauticalMile == null) {
row.timeOnDistanceAllowancePerNauticalMile = row.competitor.getTimeOnDistanceAllowancePerNauticalMile();
if(row.effectiveTimeOnDistanceAllowancePerNauticalMile == null) {
row.effectiveTimeOnDistanceAllowancePerNauticalMile = row.competitor.getTimeOnDistanceAllowancePerNauticalMile();
}
if(row.timeOnTimeFactor == null) {
row.timeOnTimeFactor = row.competitor.getTimeOnTimeFactor();
if(row.effectiveTimeOnTimeFactor == null) {
row.effectiveTimeOnTimeFactor = row.competitor.getTimeOnTimeFactor();
}
}
final Set<String> rowsUnchangedForCompetitorsWithIdAsString = new HashSet<>();
@@ -620,12 +620,12 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
cloner.clone(competitorAndRow.getValue(), newRowDTO);
// if the Regatta specific competitor handicap values are equal to the competitor's default values they
// do not need to be transfered reduntantly
if (newRowDTO.timeOnDistanceAllowancePerNauticalMile
if (newRowDTO.effectiveTimeOnDistanceAllowancePerNauticalMile
.equals(competitorDTO.getTimeOnDistanceAllowancePerNauticalMile())) {
newRowDTO.timeOnDistanceAllowancePerNauticalMile = null;
newRowDTO.effectiveTimeOnDistanceAllowancePerNauticalMile = null;
}
if (newRowDTO.timeOnTimeFactor.equals(competitorDTO.getTimeOnTimeFactor())) {
newRowDTO.timeOnTimeFactor = null;
if (newRowDTO.effectiveTimeOnTimeFactor.equals(competitorDTO.getTimeOnTimeFactor())) {
newRowDTO.effectiveTimeOnTimeFactor = null;
}
CompetitorDTO compactCompetitor = compactCompetitorMap.get(competitorDTO);
newRowDTO.competitor = compactCompetitor;
@@ -30,8 +30,8 @@ public class LeaderboardRowDTO implements Serializable {
public Double totalDurationFoiledInSeconds;
public Double totalDistanceFoiledInMeters;
public Integer totalScoredRaces;
public Double timeOnTimeFactor;
public Duration timeOnDistanceAllowancePerNauticalMile;
public Double effectiveTimeOnTimeFactor;
public Duration effectiveTimeOnDistanceAllowancePerNauticalMile;
@Override
public int hashCode() {
@@ -44,9 +44,9 @@ public class LeaderboardRowDTO implements Serializable {
result = prime * result
+ ((maximumSpeedOverGroundInKnots == null) ? 0 : maximumSpeedOverGroundInKnots.hashCode());
result = prime * result + ((netPoints == null) ? 0 : netPoints.hashCode());
result = prime * result + ((timeOnDistanceAllowancePerNauticalMile == null) ? 0
: timeOnDistanceAllowancePerNauticalMile.hashCode());
result = prime * result + ((timeOnTimeFactor == null) ? 0 : timeOnTimeFactor.hashCode());
result = prime * result + ((effectiveTimeOnDistanceAllowancePerNauticalMile == null) ? 0
: effectiveTimeOnDistanceAllowancePerNauticalMile.hashCode());
result = prime * result + ((effectiveTimeOnTimeFactor == null) ? 0 : effectiveTimeOnTimeFactor.hashCode());
result = prime * result + ((totalDistanceFoiledInMeters == null) ? 0 : totalDistanceFoiledInMeters.hashCode());
result = prime * result
+ ((totalDistanceTraveledInMeters == null) ? 0 : totalDistanceTraveledInMeters.hashCode());
@@ -104,15 +104,15 @@ public class LeaderboardRowDTO implements Serializable {
return false;
} else if (!netPoints.equals(other.netPoints))
return false;
if (timeOnDistanceAllowancePerNauticalMile == null) {
if (other.timeOnDistanceAllowancePerNauticalMile != null)
if (effectiveTimeOnDistanceAllowancePerNauticalMile == null) {
if (other.effectiveTimeOnDistanceAllowancePerNauticalMile != null)
return false;
} else if (!timeOnDistanceAllowancePerNauticalMile.equals(other.timeOnDistanceAllowancePerNauticalMile))
} else if (!effectiveTimeOnDistanceAllowancePerNauticalMile.equals(other.effectiveTimeOnDistanceAllowancePerNauticalMile))
return false;
if (timeOnTimeFactor == null) {
if (other.timeOnTimeFactor != null)
if (effectiveTimeOnTimeFactor == null) {
if (other.effectiveTimeOnTimeFactor != null)
return false;
} else if (!timeOnTimeFactor.equals(other.timeOnTimeFactor))
} else if (!effectiveTimeOnTimeFactor.equals(other.effectiveTimeOnTimeFactor))
return false;
if (totalDistanceFoiledInMeters == null) {
if (other.totalDistanceFoiledInMeters != null)
@@ -569,8 +569,8 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
LeaderboardThatHasRegattaLike regattaLikeLeaderboard = (LeaderboardThatHasRegattaLike) this;
final Duration regattaLevelTimeOnDistanceAllowancePerNauticalMile = regattaLikeLeaderboard.getRegattaLike().getTimeOnDistanceAllowancePerNauticalMile(competitor, Optional.empty());
final Double regattaLevelTimeOnTimeFactor = regattaLikeLeaderboard.getRegattaLike().getTimeOnTimeFactor(competitor, Optional.empty());
row.timeOnDistanceAllowancePerNauticalMile = regattaLevelTimeOnDistanceAllowancePerNauticalMile;
row.timeOnTimeFactor = regattaLevelTimeOnTimeFactor;
row.effectiveTimeOnDistanceAllowancePerNauticalMile = regattaLevelTimeOnDistanceAllowancePerNauticalMile;
row.effectiveTimeOnTimeFactor = regattaLevelTimeOnTimeFactor;
}
}
final Duration computeTime = startOfRequestHandling.until(MillisecondsTimePoint.now());