Enum Class TemperatureUnit

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

public enum TemperatureUnit extends Enum<TemperatureUnit>
Enumerator containing recognized typical temperature units.
  • Enum Constant Details

  • Constructor Details

    • TemperatureUnit

      private TemperatureUnit()
  • Method Details

    • values

      public static TemperatureUnit[] 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 TemperatureUnit 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(TemperatureUnit unit)
      Returns unit system for provided temperature unit.
      Parameters:
      unit - temperature unit to be checked.
      Returns:
      unit system (metric or imperial).
      Throws:
      IllegalArgumentException - if unit is null or not supported.
    • getMetricUnits

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

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

      public static boolean isMetric(TemperatureUnit unit)
      Indicates whether provided unit belongs to the metric unit system.
      Parameters:
      unit - temperature 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(TemperatureUnit unit)
      Indicates whether provided unit belongs to the imperial unit system.
      Parameters:
      unit - temperature unit to be checked.
      Returns:
      true if unit belongs to imperial unit system.
      Throws:
      IllegalArgumentException - if unit is null or not supported.