public enum RangingUnit
- Object
- Enum<RangingUnit>
- RangingUnit
ImplementsComparable<RangingUnit>
The unit a distance is read in.
There is deliberately no zero-argument distance getter on
RangingUpdate: the caller always names the unit. Both platforms report
meters natively, so a bare getDistance() would have been correct on
every device and still wrong in every app that displayed it as feet.
Enum constants
METERS | Meters, the unit both platforms measure in. |
FEET | International feet, 0.3048 m exactly. |
CENTIMETERS | Centimeters. |
INCHES | International inches, 0.0254 m exactly. |
Methods
public static RangingUnit[] values() | |
public static RangingUnit valueOf(String name) | |
public double fromMeters(double meters) | Converts a distance expressed in meters into this unit. |
public double toMeters(double value) | Converts a distance expressed in this unit into meters. |
Inherited methods
Enum constant details
METERS
METERSMeters, the unit both platforms measure in.
FEET
FEETInternational feet, 0.3048 m exactly.
CENTIMETERS
CENTIMETERSCentimeters.
INCHES
INCHESInternational inches, 0.0254 m exactly.
Method details
values
public static RangingUnit[] values()valueOf
public static RangingUnit valueOf(String name)fromMeters
public double fromMeters(double meters)Converts a distance expressed in meters into this unit.
Parameters
metersdouble- the distance in meters
Returns
the same distance expressed in this unit
toMeters
public double toMeters(double value)Converts a distance expressed in this unit into meters.
Parameters
valuedouble- the distance in this unit
Returns
the same distance in meters