Package wtf.choco.dyson4j.setting
Enum Class TemperatureUnit
- All Implemented Interfaces:
Serializable
,Comparable<TemperatureUnit>
,Constable
A unit of measurement for temperature.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe Celsius scale (C°).The Fahrenheit scale (F°).The Kelvin scale (K). -
Method Summary
Modifier and TypeMethodDescriptionfloat
Get the maximum value accepted by a Dyson fan for this temperature unit.float
Get the minimum value accepted by a Dyson fan for this temperature unit.getName()
Get the friendly name of this temperature unit.float
to
(@NotNull TemperatureUnit unit, float temperature) Convert the given value from this temperature unit to the givenTemperatureUnit
.float
toCelsius
(float temperature) Convert the given value from this temperature unit to Celsius.float
toFahrenheit
(float temperature) Convert the given value from this temperature unit to Fahrenheit.float
toKelvin
(float temperature) Convert the given value from this temperature unit to Kelvin.static TemperatureUnit
Returns the enum constant of this class with the specified name.static TemperatureUnit[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CELSIUS
The Celsius scale (C°). -
FAHRENHEIT
The Fahrenheit scale (F°). -
KELVIN
The Kelvin scale (K).
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
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
Convert the given value from this temperature unit to the givenTemperatureUnit
.- Parameters:
unit
- the unit to which the temperature should be convertedtemperature
- the temperature to convert- Returns:
- the temperature in the given unit
-