Package com.irurueta.units
Enum Class DistanceUnit
- All Implemented Interfaces:
Serializable,Comparable<DistanceUnit>,Constable
Enumerator containing recognized typical distance units.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCentimeter distance unit.Foot distance unit.Inch distance unit.Kilometer distance unit.Meter distance unit.Mile distance unit.Millimeter distance unit.Yard distance unit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DistanceUnit[]Gets all supported imperial distance units.static DistanceUnit[]Gets all supported metric distance units.static UnitSystemgetUnitSystem(DistanceUnit unit) Returns unit system for provided distance unit.static booleanisImperial(DistanceUnit unit) Indicates whether provided unit belongs to the imperial unit system.static booleanisMetric(DistanceUnit unit) Indicates whether provided unit belongs to the metric unit system.static DistanceUnitReturns the enum constant of this class with the specified name.static DistanceUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MILLIMETER
Millimeter distance unit. -
CENTIMETER
Centimeter distance unit. -
METER
Meter distance unit. -
KILOMETER
Kilometer distance unit. -
INCH
Inch distance unit. -
FOOT
Foot distance unit. -
YARD
Yard distance unit. -
MILE
Mile distance unit.
-
-
Constructor Details
-
DistanceUnit
private DistanceUnit()
-
-
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
-
getUnitSystem
Returns unit system for provided distance unit.- Parameters:
unit- distance unit to be checked.- Returns:
- unit system (metric or imperial).
- Throws:
IllegalArgumentException- if unit is null or not supported.
-
getMetricUnits
Gets all supported metric distance units.- Returns:
- all supported metric distance units.
-
getImperialUnits
Gets all supported imperial distance units.- Returns:
- all supported imperial distance units.
-
isMetric
Indicates whether provided unit belongs to the metric unit system.- Parameters:
unit- distance unit to be checked.- Returns:
- true if unit belongs to metric unit system.
- Throws:
IllegalArgumentException- if unit is null or not supported.
-
isImperial
Indicates whether provided unit belongs to the imperial unit system.- Parameters:
unit- distance unit to be checked.- Returns:
- true if unit belongs to imperial unit system.
- Throws:
IllegalArgumentException- if unit is null or not supported.
-