Package org.djunits.quantity
Class Temperature.Unit
- All Implemented Interfaces:
UnitInterface<TemperatureDifference>
- Enclosing class:
- Temperature
Temperature.Unit encodes the units of relative and absolute temperature. Note that he reference is not initialized
immediately for the units, since Reference needs working units to initialize itself. Therefore, references will be
allocated when an reference is retrieved for the first time.
Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
- Author:
- Alexander Verbraeck
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Temperature.UnitDegree Celsius.static final Temperature.UnitDegree Fahrenheit.static final Temperature.UnitDegree Rankine.static final Temperature.UnitDegree Reaumur.static final Temperature.UnitKelvin.static final Temperature.UnitThe SI or BASE unit.static final SIUnitThe dimensions of temperature: K. -
Constructor Summary
ConstructorsConstructorDescriptionUnit(String id, String name, double scaleFactorToBaseUnit, UnitSystem unitSystem) Create a new Temperature unit.Unit(String textualAbbreviation, String displayAbbreviation, String name, Scale scale, UnitSystem unitSystem, SIPrefix siPrefix) Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation. -
Method Summary
Modifier and TypeMethodDescriptionderiveUnit(String abbreviation, String name, double scaleFactor, UnitSystem unitSystem) Return a linearly scaled derived unit for this unit, with an abbreviation and scale factor.deriveUnit(String textualAbbreviation, String displayAbbreviation, String name, double scaleFactor, UnitSystem unitSystem, SIPrefix siPrefix) Return a linearly scaled derived unit for this unit, with textual abbreviation(s) and a display abbreviation.Return the base unit for this unit.protected Temperature.ReferenceReturn the default reference for this unit.ofSi(double si, UnitInterface<TemperatureDifference> displayUnit) Return a quantity for this unit with the SI-value and the provided display unit.siUnit()Return the SI unit for this unit.Methods inherited from class org.djunits.unit.AbstractUnit
equals, generateSiPrefixes, getDisplayAbbreviation, getId, getName, getScale, getSiPrefix, getStoredDisplayAbbreviation, getStoredName, getStoredTextualAbbreviation, getTextualAbbreviation, getUnitSystem, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djunits.unit.UnitInterface
fromBaseValue, ofSi, quantityInUnit, toBaseValue
-
Field Details
-
SI_UNIT
The dimensions of temperature: K. -
K
Kelvin. -
SI
The SI or BASE unit. -
degC
Degree Celsius. -
degF
Degree Fahrenheit. -
degR
Degree Rankine. -
degRe
Degree Reaumur.
-
-
Constructor Details
-
Unit
Create a new Temperature unit.- Parameters:
id- the id or main abbreviation of the unitname- the full name of the unitscaleFactorToBaseUnit- the scale factor of the unit to convert it TO the base (SI) unitunitSystem- the unit system such as SI or IMPERIAL
-
Unit
public Unit(String textualAbbreviation, String displayAbbreviation, String name, Scale scale, UnitSystem unitSystem, SIPrefix siPrefix) Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.- Parameters:
textualAbbreviation- the textual abbreviation of the unit, which doubles as the iddisplayAbbreviation- the display abbreviation of the unitname- the full name of the unitscale- the scale to use to convert from this unit to the standard (e.g., SI, BASE) unitunitSystem- unit system, e.g. SI or ImperialsiPrefix- the SI Prefix of this unit
-
-
Method Details
-
getReference
Return the default reference for this unit. References are assigned lazily and safely (once) to avoid circular class initialization issues.- Returns:
- the reference for an absolute temperature
-
siUnit
Description copied from interface:UnitInterfaceReturn the SI unit for this unit.- Returns:
- the SI unit for this unit
-
getBaseUnit
Description copied from interface:UnitInterfaceReturn the base unit for this unit.- Returns:
- the base unit for this unit
-
ofSi
Description copied from interface:UnitInterfaceReturn a quantity for this unit with the SI-value and the provided display unit.- Parameters:
si- the value in SI or BASE unitsdisplayUnit- the display unit to use- Returns:
- a quantity for this unit with the SI-value and the provided display unit
-
deriveUnit
public Temperature.Unit deriveUnit(String abbreviation, String name, double scaleFactor, UnitSystem unitSystem) Description copied from class:AbstractUnitReturn a linearly scaled derived unit for this unit, with an abbreviation and scale factor.- Overrides:
deriveUnitin classAbstractUnit<TemperatureDifference>- Parameters:
abbreviation- the textual abbreviation of the unit, which doubles as the idname- the full name of the unitscaleFactor- the (linear) scale factor to multiply with the current (linear) scale factorunitSystem- unit system, e.g. SI or Imperial- Returns:
- a derived unit for this unit
-
deriveUnit
public Temperature.Unit deriveUnit(String textualAbbreviation, String displayAbbreviation, String name, double scaleFactor, UnitSystem unitSystem, SIPrefix siPrefix) Description copied from class:AbstractUnitReturn a linearly scaled derived unit for this unit, with textual abbreviation(s) and a display abbreviation.- Specified by:
deriveUnitin classAbstractUnit<TemperatureDifference>- Parameters:
textualAbbreviation- the textual abbreviation of the unit, which doubles as the iddisplayAbbreviation- the display abbreviation of the unitname- the full name of the unitscaleFactor- the (linear) scale factor to multiply with the current (linear) scale factorunitSystem- unit system, e.g. SI or ImperialsiPrefix- the SI prefix of this unit- Returns:
- a derived unit for this unit
-