|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<DistanceUnit>
org.ka2ddo.util.DistanceUnit
public enum DistanceUnit
This enumeration declares units (with conversion factors) for measuring distances.
Enum Constant Summary | |
---|---|
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. |
Field Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 abbreviation for this DistanceUnit. |
int |
getDepth()
Get depth index for this unit instance's hierarchy of different-sized units. |
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. |
java.lang.String |
getSpeedString()
Get the descriptive String for a DistanceUnit when used for velocity as DistanceUnit per hour. |
static DistanceUnit[] |
getSpeedUnits()
Get an array of all DistanceUnits that can do speeds. |
DistanceUnit |
getTinyUnit()
Get the extremely short DistanceUnit associated with this DistanceUnit. |
static DistanceUnit |
getUnitForName(java.lang.String name)
Convert a string representing the abbreviation 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[] |
nonClonedValues()
Get a non-copied array of all DistanceUnit enum values. |
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. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final DistanceUnit MM
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
Field Detail |
---|
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
Method Detail |
---|
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 name
java.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 value
public float getOffset(DistanceUnit other)
getOffset
in interface UnitEnum<DistanceUnit>
other
- another DistanceUnit representing the existing units of a value
public 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 java.lang.String getAbbreviation()
public static DistanceUnit getUnitForName(java.lang.String name)
name
- String to be translated into a DistanceUnit
public static DistanceUnit[] nonClonedValues()
public static DistanceUnit[] getSpeedUnits()
public int getDepth()
getDepth
in interface UnitEnumHasShortUnit<DistanceUnit>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |