Package com.here.platform.location.core
Class Utils
java.lang.Object
com.here.platform.location.core.Utils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Provides binary search operations on an indexed sequence. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Utils.BinarySearchOps<T>
AdaptsBinarySearchOps
for arrays.static double
clamp
(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 primitiveDouble
s.static <V> boolean
forallRangesBetween
(scala.collection.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 thatpredicate
applies to all ranges betweenfromFraction
andtoFraction
.static boolean
isFractionValid
(double fraction) static double
normalizeLongitude
(double longitude) Returns longitude from range [-180;180) degreesstatic void
validateRange
(double startOffset, double endOffset) static <K,
T> scala.collection.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 primitiveDouble
s.- Parameters:
length
- length of the arrayvalue
- value to fill the array with- Returns:
- new array
-
arrayBinarySearchOps
AdaptsBinarySearchOps
for arrays. -
forallRangesBetween
public static <V> boolean forallRangesBetween(scala.collection.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 thatpredicate
applies to all ranges betweenfromFraction
andtoFraction
.- Returns:
true
, if the predicates applies to all,false
otherwise.
-
valuesInRange
public static <K,T> scala.collection.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)
-