Class RadioSourceKNearestFinder<P extends com.irurueta.geometry.Point<?>,S extends RadioSource>

java.lang.Object
com.irurueta.navigation.indoor.RadioSourceKNearestFinder<P,S>
Type Parameters:
P - a Point type.
S - a RadioSource type.

public class RadioSourceKNearestFinder<P extends com.irurueta.geometry.Point<?>,S extends RadioSource> extends Object
Finds k-nearest radio source fingerprints based on their signal Euclidean distances (not their actual location).
  • Field Details

  • Constructor Details

  • Method Details

    • findNearestTo

      public RssiFingerprintLocated<S,RssiReading<S>,P> findNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint)
      Finds nearest fingerprint to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Parameters:
      fingerprint - fingerprint to find the nearest to.
      Returns:
      nearest fingerprint or null if none could be found.
    • findKNearestTo

      public List<RssiFingerprintLocated<S,RssiReading<S>,P>> findKNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint, int k)
      Finds k-nearest fingerprints to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Parameters:
      fingerprint - fingerprint to find the k-nearest ones to.
      k - number of nearest fingerprints to find.
      Returns:
      nearest fingerprints ordered from closest to farthest or an empty list if none could be found.
      Throws:
      IllegalArgumentException - if either fingerprint is null or k is less than 1.
    • findKNearestTo

      public void findKNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint, int k, List<RssiFingerprintLocated<S,RssiReading<S>,P>> nearestFingerprints, List<Double> nearestSqrDistances)
      Finds k-nearest fingerprints to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Parameters:
      fingerprint - fingerprint to find the k-nearest ones to.
      k - number of nearest fingerprints to find.
      nearestFingerprints - list where found nearest fingerprints will be stored ordered from closest to farthest or an empty list if none could be found.
      nearestSqrDistances - list where squared signal Euclidean distances corresponding to found fingerprints will be stored or an empty list if no fingerprint is found.
      Throws:
      IllegalArgumentException - if any parameter is null or k is less than 1.
    • getFingerprints

      public Collection<RssiFingerprintLocated<S,RssiReading<S>,P>> getFingerprints()
      Gets collection of fingerprints to match against.
      Returns:
      collection of fingerprints to match against.
    • findNearestTo

      public static <P extends com.irurueta.geometry.Point<?>, S extends RadioSource> RssiFingerprintLocated<S,RssiReading<S>,P> findNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint, Collection<? extends RssiFingerprintLocated<S,RssiReading<S>,P>> fingerprints)
      Finds nearest fingerprint to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Type Parameters:
      P - a Point type.
      S - a RadioSource type.
      Parameters:
      fingerprint - fingerprint to find the nearest to.
      fingerprints - collection of fingerprints to make the search for the nearest one.
      Returns:
      nearest fingerprint or null if none could be found.
      Throws:
      IllegalArgumentException - if either fingerprint or collection of fingerprints is null.
    • findKNearestTo

      public static <P extends com.irurueta.geometry.Point<?>, S extends RadioSource> List<RssiFingerprintLocated<S,RssiReading<S>,P>> findKNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint, Collection<? extends RssiFingerprintLocated<S,RssiReading<S>,P>> fingerprints, int k)
      Finds k-nearest fingerprints to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Type Parameters:
      P - a Point type.
      S - a RadioSource type.
      Parameters:
      fingerprint - fingerprint to find the k-nearest ones to.
      fingerprints - collection of fingerprints to make the search for the nearest ones.
      k - number of nearest fingerprints to find.
      Returns:
      nearest fingerprints ordered from closest to farthest or an empty list if none could be found.
      Throws:
      IllegalArgumentException - if either fingerprint or collection of fingerprints is null, or k is less than 1.
    • findKNearestTo

      public static <P extends com.irurueta.geometry.Point<?>, S extends RadioSource> void findKNearestTo(RssiFingerprint<S,RssiReading<S>> fingerprint, Collection<? extends RssiFingerprintLocated<S,RssiReading<S>,P>> fingerprints, int k, List<RssiFingerprintLocated<S,RssiReading<S>,P>> nearestFingerprints, List<Double> nearestSqrDistances)
      Finds k-nearest fingerprints to provided one, in terms of signal Euclidean distances, within the collection of provided fingerprints.
      Type Parameters:
      P - a Point type.
      S - a RadioSource type.
      Parameters:
      fingerprint - fingerprint to find the k-nearest ones to.
      fingerprints - collection of fingerprints ot make the search for the nearest ones.
      k - number of nearest fingerprints to find.
      nearestFingerprints - list where found nearest fingerprints will be stored ordered from closest to farthest or an empty list if none could be found.
      nearestSqrDistances - list where squared signal Euclidean distances corresponding to found fingerprints will be stored or an empty list if no fingerprint is found.
      Throws:
      IllegalArgumentException - if any parameter is null or k is less than 1.