Package org.springframework.data.geo
Class Distance
java.lang.Object
org.springframework.data.geo.Distance
- All Implemented Interfaces:
 Serializable,Comparable<Distance>
Value object to represent distances in a given metric.
- Since:
 - 1.8
 - Author:
 - Oliver Gierke, Thomas Darimont
 - See Also:
 
- 
Constructor Summary
Constructors - 
Method Summary
 
- 
Constructor Details
- 
Distance
public Distance(double value) Creates a newDistancewith a neutral metric. This means the provided value needs to be in normalized form.- Parameters:
 value-
 - 
Distance
- Parameters:
 value-metric- must not be null.
 
 - 
 - 
Method Details
- 
between
- Parameters:
 min- can be null.max- can be null.- Returns:
 - will never be null.
 
 - 
between
public static Range<Distance> between(double minValue, Metric minMetric, double maxValue, Metric maxMetric) - Parameters:
 minValue-minMetric- can be null.maxValue-maxMetric- can be null.- Returns:
 
 - 
getNormalizedValue
public double getNormalizedValue()Returns the normalized value regarding the underlyingMetric.- Returns:
 
 - 
getUnit
Returns aStringrepresentation of the unit the distance is in.- Returns:
 - the unit
 - See Also:
 
 - 
add
Adds the given distance to the current one. The resultingDistancewill be in the same metric as the current one.- Parameters:
 other- must not be null.- Returns:
 
 - 
add
- Parameters:
 other- must not be null.metric- must not be null.- Returns:
 
 - 
in
Returns a newDistancein the givenMetric. This means that the returned instance will have the same normalized value as the original instance.- Parameters:
 metric- must not be null.- Returns:
 
 - 
compareTo
- Specified by:
 compareToin interfaceComparable<Distance>
 - 
toString
 - 
getValue
public double getValue() - 
getMetric
 - 
equals
 - 
hashCode
public int hashCode() 
 -