public enum LengthUnit extends Enum<LengthUnit>
| Enum Constant and Description |
|---|
KILOMETER
Kilometers, the primary unit.
|
METER
Meters, for ease of use.
|
MILE
Miles, using the scale factor 0.6213712 miles per kilometer.
|
NAUTICAL_MILE
Nautical miles, using the scale factor 0.5399568 nautical miles per kilometer.
|
ROD
Rods, using the scale factor 198.8387815 rods to the kilometer.
|
| Modifier and Type | Field and Description |
|---|---|
static LengthUnit |
PRIMARY
The primary length unit.
|
| Modifier and Type | Method and Description |
|---|---|
double |
convertTo(LengthUnit toUnit,
double value)
Convert a value of this unit type to the units specified
in the parameters.
|
double |
getScaleFactor()
Retrieve the scale factor between this unit and the primary
length unit.
|
static LengthUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static LengthUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LengthUnit MILE
public static final LengthUnit NAUTICAL_MILE
public static final LengthUnit ROD
public static final LengthUnit KILOMETER
public static final LengthUnit METER
public static final LengthUnit PRIMARY
public static LengthUnit[] values()
for (LengthUnit c : LengthUnit.values()) System.out.println(c);
public static LengthUnit valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic double convertTo(LengthUnit toUnit, double value)
toUnit - the unit to convert to.value - the value to convert.public double getScaleFactor()
Copyright © 2010-2015. All Rights Reserved.