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
Modifier and TypeMethodDescriptionAdds the given distance to the current one.intbooleandoubleReturns the normalized value regarding the underlyingMetric.getUnit()Returns aStringrepresentation of the unit the distance is in.doublegetValue()inthashCode()static Distanceof(double value) Creates a newDistancewith a neutral metric.static DistancetoString()
-
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 value.
-
Distance
-
-
Method Details
-
of
-
of
-
between
-
between
-
getNormalizedValue
public double getNormalizedValue()Returns the normalized value regarding the underlyingMetric.- Returns:
- the normalized value.
-
getUnit
-
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:
- sum of this and the other distance.
-
add
-
in
-
compareTo
- Specified by:
compareToin interfaceComparable<Distance>
-
getValue
public double getValue() -
getMetric
-
equals
-
hashCode
-
toString
-