public enum RangingUnit

  1. Object
  2. Enum<RangingUnit>
  3. 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

METERSMeters, the unit both platforms measure in.
FEETInternational feet, 0.3048 m exactly.
CENTIMETERSCentimeters.
INCHESInternational 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

METERS
Meters, the unit both platforms measure in.

FEET

FEET
International feet, 0.3048 m exactly.

CENTIMETERS

CENTIMETERS
Centimeters.

INCHES

INCHES
International 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

meters double
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

value double
the distance in this unit

Returns

the same distance in meters