public enum DistanceUnit extends Enum<DistanceUnit>
| Enum Constant and Description |
|---|
KILOMETERS
Kilometers as defined by the International Bureau of Weights and Measures.
|
METERS
Meters as defined by the International Bureau of Weights and Measures.
|
MILES
A mile defined as 1609.344 meters.
|
NAUTICAL_MILES
A nautical mile defined as 1852 meters.
|
| Modifier and Type | Field and Description |
|---|---|
static double |
METERS_TO_MILES |
static double |
METERS_TO_NAUTICAL_MILES |
| Modifier and Type | Method and Description |
|---|---|
double |
toKilometers(double distance)
Converts the specified distance from this distance unit to kilometers.
|
abstract double |
toMeters(double distance)
Converts the specified distance from this distance unit to miles.
|
double |
toMiles(double distance)
Converts the specified distance from this distance unit to miles.
|
double |
toNauticalMiles(double distance)
Converts the specified distance from this distance unit to nautical miles.
|
static DistanceUnit |
valueOf(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 KILOMETERS
public static final DistanceUnit METERS
public static final DistanceUnit MILES
public static final DistanceUnit NAUTICAL_MILES
public static final double METERS_TO_MILES
public static final double METERS_TO_NAUTICAL_MILES
public static DistanceUnit[] values()
for (DistanceUnit c : DistanceUnit.values()) System.out.println(c);
public static DistanceUnit 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 toKilometers(double distance)
DistanceUnit.METERS.toKilometers(100).distance - the distance to convertpublic abstract double toMeters(double distance)
DistanceUnit.MILES.toMeters(100).distance - the distance to convertpublic double toMiles(double distance)
DistanceUnit.METERS.toMiles(100).distance - the distance to convertpublic double toNauticalMiles(double distance)
DistanceUnit.METERS.toNauticalMiles(100).distance - the distance to convertCopyright © 2012–2015 Danish Maritime Authority. All rights reserved.