mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-24 21:13:50 +00:00
added /maneuver method to regattas end point; refactored to let getManeuvers() return Iterable instead of List
Change-Id: Ida708e2a5e062cca0593a4e5f10517e5237cfe5e
This commit is contained in:
1 parent
d03f62e8f5
commit
f39afd34ed
37 files changed
+435
-187
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package com.sap.sse.common.util;
|
||||
|
||||
|
||||
public class RoundingUtil {
|
||||
public static final RoundingUtil distanceDecimalFormatter = new RoundingUtil(2);
|
||||
public static final RoundingUtil knotsDecimalFormatter = new RoundingUtil(2);
|
||||
public static final RoundingUtil bearingDecimalFormatter = new RoundingUtil(1);
|
||||
public static final RoundingUtil speedDecimalFormatter = new RoundingUtil(1);
|
||||
public static final RoundingUtil latLngDecimalFormatter = new RoundingUtil(6);
|
||||
|
||||
private final double shiftFactor;
|
||||
|
||||
private RoundingUtil(int decimals) {
|
||||
shiftFactor = getShiftFactor(decimals);
|
||||
}
|
||||
|
||||
private static double getShiftFactor(int decimals) {
|
||||
return Math.pow(10, decimals);
|
||||
}
|
||||
|
||||
public double format(double value) {
|
||||
return ((double) Math.round(value * shiftFactor)) / shiftFactor;
|
||||
}
|
||||
|
||||
public static double format(double value, int decimals) {
|
||||
final double shiftFactor = getShiftFactor(decimals);
|
||||
return ((double) Math.round(value * shiftFactor)) / shiftFactor;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user