Enum Class TemperatureUnit

java.lang.Object
java.lang.Enum<TemperatureUnit>
wtf.choco.dyson4j.setting.TemperatureUnit
All Implemented Interfaces:
Serializable, Comparable<TemperatureUnit>, Constable

public enum TemperatureUnit extends Enum<TemperatureUnit>
A unit of measurement for temperature.
  • Enum Constant Details

    • CELSIUS

      public static final TemperatureUnit CELSIUS
      The Celsius scale (C°).
    • FAHRENHEIT

      public static final TemperatureUnit FAHRENHEIT
      The Fahrenheit scale (F°).
    • KELVIN

      public static final TemperatureUnit KELVIN
      The Kelvin scale (K).
  • 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
    • getName

      @NotNull public @NotNull String getName()
      Get the friendly name of this temperature unit.
      Returns:
      the name
    • getMinValue

      public float getMinValue()
      Get the minimum value accepted by a Dyson fan for this temperature unit.
      Returns:
      the minimum value
    • getMaxValue

      public float getMaxValue()
      Get the maximum value accepted by a Dyson fan for this temperature unit.
      Returns:
      the maximum value
    • toCelsius

      public float toCelsius(float temperature)
      Convert the given value from this temperature unit to Celsius.
      Parameters:
      temperature - the temperature to convert
      Returns:
      the temperature in Celsius
    • toFahrenheit

      public float toFahrenheit(float temperature)
      Convert the given value from this temperature unit to Fahrenheit.
      Parameters:
      temperature - the temperature to convert
      Returns:
      the temperature in Fahrenheit
    • toKelvin

      public float toKelvin(float temperature)
      Convert the given value from this temperature unit to Kelvin.
      Parameters:
      temperature - the temperature to convert
      Returns:
      the temperature in Kelvin
    • to

      public float to(@NotNull @NotNull TemperatureUnit unit, float temperature)
      Convert the given value from this temperature unit to the given TemperatureUnit.
      Parameters:
      unit - the unit to which the temperature should be converted
      temperature - the temperature to convert
      Returns:
      the temperature in the given unit