Package com.irurueta.units
Enum Class EnergyUnit
- All Implemented Interfaces:
Serializable,Comparable<EnergyUnit>,Constable
Enumerator containing recognized typical energy units.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInternational Table British thermal unit (BTU).Thermochemical calorie (cal).Joule (J).Thermochemical kilocalorie (kcal).Kilojoule (kJ).Kilowatt hour (kWh).Megajoule (MJ). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EnergyUnit[]Gets all supported imperial energy units.static EnergyUnit[]Gets all supported metric energy units.static UnitSystemgetUnitSystem(EnergyUnit unit) Returns unit system for provided energy unit.static booleanisImperial(EnergyUnit unit) Indicates whether provided unit belongs to the imperial unit system.static booleanisMetric(EnergyUnit unit) Indicates whether provided unit belongs to the metric unit system.static EnergyUnitReturns the enum constant of this class with the specified name.static EnergyUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
JOULE
Joule (J). -
KILOJOULE
Kilojoule (kJ). -
MEGAJOULE
Megajoule (MJ). -
CALORIE
Thermochemical calorie (cal). -
KILOCALORIE
Thermochemical kilocalorie (kcal). -
KILOWATT_HOUR
Kilowatt hour (kWh). -
BTU
International Table British thermal unit (BTU).
-
-
Constructor Details
-
EnergyUnit
private EnergyUnit()
-
-
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 energy unit.- Parameters:
unit- energy unit to be checked.- Returns:
- unit system (metric or imperial).
- Throws:
IllegalArgumentException- if unit is null or not supported.
-
getMetricUnits
Gets all supported metric energy units.- Returns:
- all supported metric energy units.
-
getImperialUnits
Gets all supported imperial energy units.- Returns:
- all supported imperial energy units.
-
isMetric
Indicates whether provided unit belongs to the metric unit system.- Parameters:
unit- energy 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- energy unit to be checked.- Returns:
- true if unit belongs to imperial unit system.
- Throws:
IllegalArgumentException- if unit is null or not supported.
-