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
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDistance(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 Distancecentimeter(String cm) intbooleandoublegetCm()doublegetKm()doublegetMeter()getValue()inthashCode()static Distancestatic Distancemult(BigDecimal factor) static DistanceParses a distance string given asstatic Distanceparse(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
-