Package ch.tocco.nice2.toolbox.api.util
Class Distance
java.lang.Object
ch.tocco.nice2.toolbox.api.util.Distance
- All Implemented Interfaces:
Serializable
Holds distances normalized to km offering some convenience access
methods.
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDistance
(BigDecimal km) Constructs a distance with the given argument interpreted as KM. -
Method Summary
Modifier and TypeMethodDescriptionabs()
Returns the sum of this distance and the argument.Returns the average of this distance and the argument.static Distance
centimeter
(String cm) int
boolean
double
getCm()
double
getKm()
double
getMeter()
getValue()
int
hashCode()
static Distance
static Distance
mult
(BigDecimal factor) static Distance
Parses a distance string given asstatic Distance
parse
(String dst, @Nullable Distance.Unit fallback) toString()
-
Constructor Details
-
Distance
Constructs a distance with the given argument interpreted as KM.
-
-
Method Details
-
getValue
-
getKm
public double getKm() -
getMeter
public double getMeter() -
getCm
public double getCm() -
meter
-
kilometer
-
centimeter
-
add
Returns the sum of this distance and the argument. -
avg
Returns the average of this distance and the argument. -
mult
-
abs
-
parse
Parses a distance string given as<number>[km|m|cm]
-
parse
-
compareTo
-
equals
-
hashCode
public int hashCode() -
toString
-
serialize
-