mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-18 02:00:58 +00:00
applied code formatter to Simon's last commit
Change-Id: I93e5a4e182ead6243c105c6690bf22e1f3544877
This commit is contained in:
1 parent
39656b5213
commit
b2d7d2ff10
2 files changed
+21
-21
No files matched your search
@@ -1013,11 +1013,11 @@ public interface TrackedRace extends Serializable, IsManagedByCache<SharedDomain
|
||||
Iterable<RaceLog> getAttachedRaceLogs();
|
||||
|
||||
/**
|
||||
* Computes the average speed over ground for a {@link Competitor} based on times and distances
|
||||
* for all finished {@link TrackedLegOfCompetitor}s.
|
||||
*
|
||||
* @param timePoint time point up and until to compute the speed
|
||||
* Computes the average speed over ground for a {@link Competitor} based on times and distances for all finished
|
||||
* {@link TrackedLegOfCompetitor}s.
|
||||
*
|
||||
* @param timePoint
|
||||
* time point up and until to compute the speed
|
||||
*/
|
||||
Speed getAverageSpeedOverGround(Competitor competitor, TimePoint timePoint);
|
||||
|
||||
Speed getAverageSpeedOverGround(Competitor competitor, TimePoint timePoint);
|
||||
}
|
||||
+15
-15
@@ -4193,20 +4193,20 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
|
||||
|
||||
@Override
|
||||
public Speed getAverageSpeedOverGround(Competitor competitor, TimePoint timePoint) {
|
||||
Speed result = null;
|
||||
Duration totalTimeSailedInRace = Duration.NULL;
|
||||
Distance totalDistanceSailedInRace = Distance.NULL;
|
||||
for (TrackedLeg legGeneral : getTrackedLegs()) {
|
||||
TrackedLegOfCompetitor leg = legGeneral.getTrackedLeg(competitor);
|
||||
if (leg != null && leg.getTime(timePoint) != null) {
|
||||
totalDistanceSailedInRace.add(leg.getDistanceTraveled(timePoint));
|
||||
totalTimeSailedInRace.plus(leg.getTime(timePoint));
|
||||
}
|
||||
}
|
||||
if (!totalTimeSailedInRace.equals(Duration.NULL) && !totalDistanceSailedInRace.equals(Distance.NULL)) {
|
||||
result = new KnotSpeedImpl(totalDistanceSailedInRace.getMeters() /
|
||||
totalTimeSailedInRace.asSeconds() / Mile.METERS_PER_NAUTICAL_MILE * 3600.0);
|
||||
}
|
||||
return result;
|
||||
Speed result = null;
|
||||
Duration totalTimeSailedInRace = Duration.NULL;
|
||||
Distance totalDistanceSailedInRace = Distance.NULL;
|
||||
for (TrackedLeg legGeneral : getTrackedLegs()) {
|
||||
TrackedLegOfCompetitor leg = legGeneral.getTrackedLeg(competitor);
|
||||
if (leg != null && leg.getTime(timePoint) != null) {
|
||||
totalDistanceSailedInRace.add(leg.getDistanceTraveled(timePoint));
|
||||
totalTimeSailedInRace.plus(leg.getTime(timePoint));
|
||||
}
|
||||
}
|
||||
if (!totalTimeSailedInRace.equals(Duration.NULL) && !totalDistanceSailedInRace.equals(Distance.NULL)) {
|
||||
result = new KnotSpeedImpl(totalDistanceSailedInRace.getMeters() / totalTimeSailedInRace.asSeconds()
|
||||
/ Mile.METERS_PER_NAUTICAL_MILE * 3600.0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user