Class Utils

java.lang.Object
com.here.platform.location.core.Utils

public class Utils extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Provides binary search operations on an indexed sequence.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Utils.BinarySearchOps<T>
    Adapts BinarySearchOps 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 primitive Doubles.
    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 that predicate applies to all ranges between fromFraction and toFraction.
    static boolean
    isFractionValid(double fraction)
     
    static double
    normalizeLongitude(double longitude)
    Returns longitude from range [-180;180) degrees
    static 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)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 clamp
      lower - lower boundary
      upper - 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 primitive Doubles.

      Parameters:
      length - length of the array
      value - value to fill the array with
      Returns:
      new array
    • arrayBinarySearchOps

      public static <T> Utils.BinarySearchOps<T> arrayBinarySearchOps(Object seq)
      Adapts BinarySearchOps 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 that predicate applies to all ranges between fromFraction and toFraction.

      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)