Class ExhaustiveGeoLocationNearestFinderImpl<D extends Comparable<? super D>>

java.lang.Object
rgu.transport.impl.ExhaustiveGeoLocationNearestFinderImpl<D>
Type Parameters:
D - the edge type
All Implemented Interfaces:
NearestFinder<GeoLocation>

public final class ExhaustiveGeoLocationNearestFinderImpl<D extends Comparable<? super D>> extends Object implements NearestFinder<GeoLocation>
Exhaustive search on a set of geo locations. Not exported as this requires defensive copy outside the call. Can be bypassed when the underlying set is known to be unmodifiable.
  • Constructor Details

    • ExhaustiveGeoLocationNearestFinderImpl

      public ExhaustiveGeoLocationNearestFinderImpl(Metric<GeoLocation, D> metric, Collection<GeoLocation> elements, Predicate<D> filter)
      Creates a new instance of ExhaustiveGeoLocationNearestFinderImpl.
      Parameters:
      metric - the distance metric, not null
      elements - the elements, not null, reference will be maintained to this collection for read access
      filter - the filter for elements, not null, targets with no filter-accepted elements will be mapped to null
  • Method Details

    • nearest

      public GeoLocation nearest(GeoLocation target)
      Returns the element which is nearest to the specified target. Targets with no filter-accepted elements will be mapped to null.
      Specified by:
      nearest in interface NearestFinder<D extends Comparable<? super D>>
      Parameters:
      target - the target, not null
      Returns:
      the nearest match, null if no filter-accepted elements exist