- All Implemented Interfaces:
Serializable,Comparable<Speed.Unit>,Constable
- Enclosing class:
- Speed
Represents a given speed unit.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents the speed unit kilometers per hour: km/h.Represents the speed unit knots: kt.Represents the speed unit mach: Ma.Represents the speed unit meters per second: m/s.Represents the speed unit miles per hour: mi/h. -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvert(double speed, Speed.Unit sourceUnit) Convert the given speed value of the givensourceUnitinto a speed value ofthisspeed unit.static Speed.UnitReturns the enum constant of this class with the specified name.static Speed.Unit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
METERS_PER_SECOND
Represents the speed unit meters per second: m/s. -
KILOMETERS_PER_HOUR
Represents the speed unit kilometers per hour: km/h. -
MILES_PER_HOUR
Represents the speed unit miles per hour: mi/h. -
KNOTS
Represents the speed unit knots: kt. -
MACH
Represents the speed unit mach: Ma.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
convert
Convert the given speed value of the givensourceUnitinto a speed value ofthisspeed unit. The given example converts 3 knots into kilometers per hour.final double kilometersPerHour = KILOMETERS_PER_HOUR.convert(3, KNOTS);- Parameters:
speed- the speed valuesourceUnit- the source speed unit- Returns:
- the speed value of
thisspeed unit
-