Package org.elasticsearch.common.unit
Class DistanceUnit.Distance
java.lang.Object
org.elasticsearch.common.unit.DistanceUnit.Distance
- All Implemented Interfaces:
Comparable<DistanceUnit.Distance>
- Enclosing class:
- DistanceUnit
public static class DistanceUnit.Distance
extends Object
implements Comparable<DistanceUnit.Distance>
This class implements a value+unit tuple.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
convert(DistanceUnit unit)
Converts aDistanceUnit.Distance
value given in a specificDistanceUnit
into a value equal to the specified value but in a otherDistanceUnit
.boolean
int
hashCode()
static DistanceUnit.Distance
parseDistance(String distance)
Parse aDistanceUnit.Distance
from a given String.toString()
-
Field Details
-
value
public final double value -
unit
-
-
Constructor Details
-
Distance
-
-
Method Details
-
convert
Converts aDistanceUnit.Distance
value given in a specificDistanceUnit
into a value equal to the specified value but in a otherDistanceUnit
.- Parameters:
unit
- unit of the result- Returns:
- converted distance
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<DistanceUnit.Distance>
-
toString
-
parseDistance
Parse aDistanceUnit.Distance
from a given String. If no unit is givenDistanceUnit.DEFAULT
will be used- Parameters:
distance
- String defining aDistanceUnit.Distance
- Returns:
- parsed
DistanceUnit.Distance
-