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 SummaryConstructors
- 
Method Summary
- 
Constructor Details- 
Distancepublic 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.
 
- 
betweenpublic static Range<Distance> between(double minValue, Metric minMetric, double maxValue, Metric maxMetric) - Parameters:
- minValue-
- minMetric- can be null.
- maxValue-
- maxMetric- can be null.
- Returns:
 
- 
getNormalizedValuepublic double getNormalizedValue()Returns the normalized value regarding the underlyingMetric.- Returns:
 
- 
getUnitReturns aStringrepresentation of the unit the distance is in.- Returns:
- the unit
- See Also:
 
- 
addAdds 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:
 
- 
inReturns 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 interface- Comparable<Distance>
 
- 
toString
- 
getValuepublic double getValue()
- 
getMetric
- 
equals
- 
hashCodepublic int hashCode()
 
-