Enum Class TemperatureUnit

java.lang.Object
java.lang.Enum<TemperatureUnit>
com.github.thedeathlycow.thermoo.api.util.TemperatureUnit
All Implemented Interfaces:
Serializable, Comparable<TemperatureUnit>, Constable, net.minecraft.util.StringRepresentable

public enum TemperatureUnit extends Enum<TemperatureUnit> implements net.minecraft.util.StringRepresentable
Defines the basic units of temperature and allows for conversions between them.
  • Enum Constant Details

  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<TemperatureUnit> CODEC
  • 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
    • getAbsoluteUnit

      public TemperatureUnit getAbsoluteUnit()
      Gets the absolute unit scale for this unit. That is, the unit that has the same temperature step as this unit, but whose origin point (0 degrees) is absolute zero.
      Returns:
      If this unit is Celsius or Kelvin, returns Kelvin. If this unit is Fahrenheit or Rankine, returns Rankine.
    • getAbsoluteZero

      public double getAbsoluteZero()
      Gets the absolute zero temperature value of this unit
      Returns:
      Returns 0 if this is the absolute unit, or some other negative value if it is not the absolute unit.
    • getUnitSymbol

      public String getUnitSymbol()
    • toCelsius

      public double toCelsius(double value)
      Converts a temperature value in this unit to Celsius.
      Parameters:
      value - A temperature value in this unit
      Returns:
      Returns the equivalent temperature value in Celsius
    • fromCelsius

      public double fromCelsius(double celsiusValue)
      Converts a temperature value in Celsius to this unit.
      Parameters:
      celsiusValue - A temperature value in Celsius
      Returns:
      Returns the equivalent temperature value in this unit
    • convertTemperature

      public double convertTemperature(double inputValue, TemperatureUnit inputUnit)
      Converts a temperature in some other unit to this unit.
      Parameters:
      inputValue - The input temperature value in the other unit
      inputUnit - The other unit
      Returns:
      Returns the equivalent temperature value in this unit.
    • convertTemperature

      public double convertTemperature(TemperatureRecord temperatureRecord)
      Converts a temperature record in some other unit to this unit.
      Parameters:
      temperatureRecord - The record of the temperature to convert
      Returns:
      Returns the equivalent temperature value in this unit.
    • getSerializedName

      public String getSerializedName()
      Specified by:
      getSerializedName in interface net.minecraft.util.StringRepresentable