Package com.here.platform.location.core
Class Utils
java.lang.Object
com.here.platform.location.core.Utils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvides binary search operations on an indexed sequence. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Utils.BinarySearchOps<T>AdaptsBinarySearchOpsfor arrays.static doubleclamp(double x, double lower, double upper) Returns the value restricted to the given boundaries.static double[]filledArray(int length, double value) Returns a pre-filled array of primitiveDoubles.static <V> booleanforallRangesBetween(scala.collection.immutable.Seq<com.here.platform.location.core.graph.RangeBasedProperty<V>> ranges, double fromFraction, double toFraction, scala.Function1<com.here.platform.location.core.graph.RangeBasedProperty<V>, Object> predicate) Verifies thatpredicateapplies to all ranges betweenfromFractionandtoFraction.static booleanisFractionValid(double fraction) static doublenormalizeLongitude(double longitude) Returns longitude from range [-180;180) degreesstatic voidvalidateRange(double startOffset, double endOffset) static <K,T> scala.collection.immutable.Seq<com.here.platform.location.core.graph.RangeBasedProperty<T>> valuesInRange(com.here.platform.location.core.graph.RangeBasedPropertyMap<K, T> map, K key, double start, double end)
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
clamp
public static double clamp(double x, double lower, double upper) Returns the value restricted to the given boundaries.- Parameters:
x- value to clamplower- lower boundaryupper- upper boundary- Returns:
- clamped value
-
normalizeLongitude
public static double normalizeLongitude(double longitude) Returns longitude from range [-180;180) degrees -
filledArray
public static double[] filledArray(int length, double value) Returns a pre-filled array of primitiveDoubles.- Parameters:
length- length of the arrayvalue- value to fill the array with- Returns:
- new array
-
arrayBinarySearchOps
AdaptsBinarySearchOpsfor arrays. -
forallRangesBetween
public static <V> boolean forallRangesBetween(scala.collection.immutable.Seq<com.here.platform.location.core.graph.RangeBasedProperty<V>> ranges, double fromFraction, double toFraction, scala.Function1<com.here.platform.location.core.graph.RangeBasedProperty<V>, Object> predicate) Verifies thatpredicateapplies to all ranges betweenfromFractionandtoFraction.- Returns:
true, if the predicates applies to all,falseotherwise.
-
valuesInRange
public static <K,T> scala.collection.immutable.Seq<com.here.platform.location.core.graph.RangeBasedProperty<T>> valuesInRange(com.here.platform.location.core.graph.RangeBasedPropertyMap<K, T> map, K key, double start, double end) -
isFractionValid
public static boolean isFractionValid(double fraction) -
validateRange
public static void validateRange(double startOffset, double endOffset)
-