Distance

  • Distance represents the distance to a nearby Message and implements Comparable for distance comparison.

  • It provides methods to get the distance estimate in meters (getMeters()) and the accuracy of the estimate (getAccuracy()).

  • compareTo() method compares distances based solely on meters, ignoring accuracy, and treats UNKNOWN distances as equal.

  • UNKNOWN represents an unknown distance with low accuracy and NaN meters.

public interface Distance implements Comparable<Distance>

Represents the distance to a Message.

Nested Class Summary

@interface Distance.Accuracy Possible values for the accuracy of a distance estimate. 

Field Summary

public static final Distance UNKNOWN Represents an unknown distance, with accuracy = Distance.Accuracy.LOW, and meters = Double.NaN.

Public Method Summary

abstract int
compareTo(Distance other)
Note: This compares only getMeters(), not accuracy.
abstract int
getAccuracy()
The accuracy of the distance estimate.
abstract double
getMeters()
The distance estimate, in meters.

Inherited Method Summary

Fields

public static final Distance UNKNOWN

Represents an unknown distance, with accuracy = Distance.Accuracy.LOW, and meters = Double.NaN.

Public Methods

public abstract int compareTo (Distance other)

Note: This compares only getMeters(), not accuracy. We also consider NaN == NaN, so that UNKNOWN.equals(UNKNOWN).

public abstract int getAccuracy ()

The accuracy of the distance estimate.

public abstract double getMeters ()

The distance estimate, in meters.