public enum DistanceUnit extends java.lang.Enum<DistanceUnit> implements UnitEnumHasShortUnit<DistanceUnit>
Enum Constant and Description |
---|
CM
Distances in centimeters.
|
DEG_LAT
Distances in degrees of latitude upon the Earth.
|
FEET
Distances in feet.
|
INCH
Distances in inches.
|
KM
Distances in kilometers,
|
METER
Distances in meters.
|
MI
Distances in statute miles.
|
MM
Distances in millimeters.
|
NM
Distances in nautical miles.
|
STORIES
Distances (heights) in building floors or stories.
|
Modifier and Type | Field and Description |
---|---|
static float |
CONV_DEGLAT_TO_METERS
Convenience constant for degrees latitude to meters when both units are fixed in
equation.
|
static float |
CONV_METERS_TO_DEGLAT
Convenience constant for meters to degrees latitude when both units are fixed in
equation.
|
static float |
CONV_METERS_TO_FT
Convenience constant for meters to feet when both units are fixed in equation.
|
static float |
CONV_METERS_TO_MI
Convenience constant for meters to statute miles when both units are fixed in
equation.
|
static float |
CONV_NM_TO_METERS
Convenience constant for nautical miles to meters when both units are fixed in
equation.
|
static float |
CONV_NM_TO_MI
Convenience constant for nautical miles to statute miles.
|
Modifier and Type | Method and Description |
---|---|
float |
from(DistanceUnit other)
Get the multiplicative conversion factor to convert a distance from the specified
units to this unit.
|
java.lang.String |
getAbbreviation()
Get short standard abbreviations for this DistanceUnit.
|
int |
getDepth()
Get depth index for this unit instance's hierarchy of different-sized units.
|
static DistanceUnit[] |
getLandDistanceUnits()
Get an array of all DistanceUnits that are commonly used for traveling distances
across land or sea.
|
float |
getOffset(DistanceUnit other)
Get the additive offset to convert a value from the specified unit to this unit.
|
DistanceUnit |
getShortUnit()
Get the shorter DistanceUnit associated with this DistanceUnit.
|
float |
getSpeedDurationScaleToHr()
Get the scaling factor for a speed duration unit relative to the most common
unit of hours (e.g., miles per hour).
|
java.lang.String |
getSpeedString()
Get the descriptive String for a DistanceUnit when used for velocity as
DistanceUnit per hour.
|
DistanceUnit |
getTinyUnit()
Get the extremely short DistanceUnit associated with this DistanceUnit.
|
static DistanceUnit |
getUnitForName(java.lang.String name)
Convert a string representing the abbreviations for a DistanceUnit into the enum
instance for that unit.
|
static DistanceUnit |
lookupSpeedUnit(java.lang.String speedUnit)
Find the DistanceUnit whose speed has the specified unit name.
|
static DistanceUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DistanceUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DistanceUnit MM
public static final DistanceUnit CM
public static final DistanceUnit INCH
public static final DistanceUnit METER
public static final DistanceUnit FEET
public static final DistanceUnit KM
public static final DistanceUnit MI
public static final DistanceUnit NM
public static final DistanceUnit DEG_LAT
public static final DistanceUnit STORIES
public static final float CONV_DEGLAT_TO_METERS
public static final float CONV_METERS_TO_DEGLAT
public static final float CONV_NM_TO_METERS
public static final float CONV_METERS_TO_MI
public static final float CONV_METERS_TO_FT
public static final float CONV_NM_TO_MI
public static DistanceUnit[] values()
for (DistanceUnit c : DistanceUnit.values()) System.out.println(c);
public static DistanceUnit valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final float from(DistanceUnit other)
from
in interface UnitEnum<DistanceUnit>
other
- another DistanceUnit representing the existing units of a distance valuepublic float getOffset(DistanceUnit other)
getOffset
in interface UnitEnum<DistanceUnit>
other
- another DistanceUnit representing the existing units of a valuepublic final DistanceUnit getShortUnit()
getShortUnit
in interface UnitEnumHasShortUnit<DistanceUnit>
public final DistanceUnit getTinyUnit()
public static DistanceUnit lookupSpeedUnit(java.lang.String speedUnit)
speedUnit
- String of speed unit, such as "mph", "kph", etc.public java.lang.String getSpeedString()
public float getSpeedDurationScaleToHr()
public java.lang.String getAbbreviation()
public static DistanceUnit getUnitForName(java.lang.String name)
name
- String to be translated into a DistanceUnitpublic static DistanceUnit[] getLandDistanceUnits()
public int getDepth()
getDepth
in interface UnitEnumHasShortUnit<DistanceUnit>