Package com.iizix

Enum Class TemperatureUnit

All Implemented Interfaces:
Serializable, Comparable<TemperatureUnit>, Constable

public enum TemperatureUnit extends Enum<TemperatureUnit>
Enum for temperature types.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Celcius formatted as "°C".
    Fahrenheit formatted as "°F".
    Kelvin "°K".
    Rankine "°R".
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    Suffix for temperature value.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract double
    toCelcius(double temperature)
    Converts the temperature of the current temperature unit to Celcius.
    abstract float
    toCelcius(float temperature)
    Converts the temperature of the current temperature unit to Celcius.
    abstract double
    toFahrenheit(double temperature)
    Converts the temperature of the current temperature unit to Fahrenheit.
    abstract float
    toFahrenheit(float temperature)
    Converts the temperature of the current temperature unit to Fahrenheit.
    abstract double
    toKelvin(double temperature)
    Converts the temperature of the current temperature unit to Kelvin.
    abstract float
    toKelvin(float temperature)
    Converts the temperature of the current temperature unit to Kelvin.
    abstract double
    toRankine(double temperature)
    Converts the temperature of the current temperature unit to Rankine.
    abstract float
    toRankine(float temperature)
    Converts the temperature of the current temperature unit to Rankine.
    double
    toType(double temperature, TemperatureUnit unit)
    Converts the temperature of the current temperature unit to the requested temperature unit type.
    float
    toType(float temperature, TemperatureUnit unit)
    Converts the temperature of the current temperature unit to the requested temperature unit type.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

  • Field Details

    • suffix

      public final String suffix
      Suffix for temperature value.
  • 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
    • toCelcius

      public abstract double toCelcius(double temperature)
      Converts the temperature of the current temperature unit to Celcius.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Celcius.
    • toCelcius

      public abstract float toCelcius(float temperature)
      Converts the temperature of the current temperature unit to Celcius.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Celcius.
    • toFahrenheit

      public abstract double toFahrenheit(double temperature)
      Converts the temperature of the current temperature unit to Fahrenheit.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Fahrenheit.
    • toFahrenheit

      public abstract float toFahrenheit(float temperature)
      Converts the temperature of the current temperature unit to Fahrenheit.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Fahrenheit.
    • toKelvin

      public abstract double toKelvin(double temperature)
      Converts the temperature of the current temperature unit to Kelvin.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Kelvin.
    • toKelvin

      public abstract float toKelvin(float temperature)
      Converts the temperature of the current temperature unit to Kelvin.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Kelvin.
    • toRankine

      public abstract double toRankine(double temperature)
      Converts the temperature of the current temperature unit to Rankine.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Rankine.
    • toRankine

      public abstract float toRankine(float temperature)
      Converts the temperature of the current temperature unit to Rankine.
      Parameters:
      temperature - The temperature.
      Returns:
      The temperature in Rankine.
    • toType

      public double toType(double temperature, TemperatureUnit unit)
      Converts the temperature of the current temperature unit to the requested temperature unit type.
      Parameters:
      temperature - The temperature.
      unit - Requested conversion temperature unit type.
      Returns:
      The temperature in the requested unit type.
      Throws:
      NullPointerException - If unit is null.
    • toType

      public float toType(float temperature, TemperatureUnit unit)
      Converts the temperature of the current temperature unit to the requested temperature unit type.
      Parameters:
      temperature - The temperature.
      unit - Requested conversion temperature unit type.
      Returns:
      The temperature in the requested unit type.
      Throws:
      NullPointerException - If unit is null.