Package com.iizix
Enum Class TemperatureUnit
- All Implemented Interfaces:
Serializable
,Comparable<TemperatureUnit>
,Constable
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 ConstantDescriptionCelcius formatted as "°C".Fahrenheit formatted as "°F".Kelvin "°K".Rankine "°R".Field Summary
Method Summary
Modifier and TypeMethodDescriptionabstract 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.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
CELCIUS
Celcius formatted as "°C".FAHRENHEIT
Fahrenheit formatted as "°F".KELVIN
Kelvin "°K".RANKINE
Rankine "°R".
Field Details
suffix
Suffix for temperature value.
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
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
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
- Ifunit
isnull
.
toType
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
- Ifunit
isnull
.