Enum Class EnergyUnit

java.lang.Object
java.lang.Enum<EnergyUnit>
com.irurueta.units.EnergyUnit
All Implemented Interfaces:
Serializable, Comparable<EnergyUnit>, Constable

public enum EnergyUnit extends Enum<EnergyUnit>
Enumerator containing recognized typical energy units.
  • Enum Constant Details

    • JOULE

      public static final EnergyUnit JOULE
      Joule (J).
    • KILOJOULE

      public static final EnergyUnit KILOJOULE
      Kilojoule (kJ).
    • MEGAJOULE

      public static final EnergyUnit MEGAJOULE
      Megajoule (MJ).
    • CALORIE

      public static final EnergyUnit CALORIE
      Thermochemical calorie (cal).
    • KILOCALORIE

      public static final EnergyUnit KILOCALORIE
      Thermochemical kilocalorie (kcal).
    • KILOWATT_HOUR

      public static final EnergyUnit KILOWATT_HOUR
      Kilowatt hour (kWh).
    • BTU

      public static final EnergyUnit BTU
      International Table British thermal unit (BTU).
  • Constructor Details

    • EnergyUnit

      private EnergyUnit()
  • Method Details

    • values

      public static EnergyUnit[] 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

      public static EnergyUnit valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getUnitSystem

      public static UnitSystem getUnitSystem(EnergyUnit unit)
      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

      public static EnergyUnit[] getMetricUnits()
      Gets all supported metric energy units.
      Returns:
      all supported metric energy units.
    • getImperialUnits

      public static EnergyUnit[] getImperialUnits()
      Gets all supported imperial energy units.
      Returns:
      all supported imperial energy units.
    • isMetric

      public static boolean isMetric(EnergyUnit unit)
      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

      public static boolean isImperial(EnergyUnit unit)
      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.