Package de.xima.fc.common.measure
Interface MeasurementUnit<Self extends MeasurementUnit<Self>>
-
- All Known Implementing Classes:
LengthUnit
,MassUnit
,TimeUnit
public interface MeasurementUnit<Self extends MeasurementUnit<Self>>
Represents a unit of measurement, such as length, weight, or time. Each unit has a reference unit from and to which it can be converted. The reference unit depends on the subtype, but is usually an SI unit.- Since:
- 8.4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
conversionFactorDenominator()
The denominator of the fraction representing the conversion factor from this unit to the reference unit.long
conversionFactorNumerator()
The numerator of the fraction representing the conversion factor from this unit to the reference unit.QuantityDouble<Self>
of(double value)
Creates a newQuantityDouble
that uses double object with the specified value in this unit.QuantityBigDecimal<Self>
of(BigDecimal value)
Creates a newQuantityBigDecimal
that uses big decimal object with the specified value in this unit.String
symbol()
The reference unit of this measurement unit.String
toString()
Gets a string representation of the unit, usually the unit symbol such as "m" for meters or "kg" for kilograms.
-
-
-
Method Detail
-
conversionFactorDenominator
long conversionFactorDenominator()
The denominator of the fraction representing the conversion factor from this unit to the reference unit.- Returns:
- The conversion factor denominator.
-
conversionFactorNumerator
long conversionFactorNumerator()
The numerator of the fraction representing the conversion factor from this unit to the reference unit.- Returns:
- The conversion factor numerator.
-
of
QuantityDouble<Self> of(double value)
Creates a newQuantityDouble
that uses double object with the specified value in this unit.- Parameters:
value
- The value in this unit.- Returns:
- A new
QuantityDouble
object with the specified value in this unit.
-
of
QuantityBigDecimal<Self> of(BigDecimal value)
Creates a newQuantityBigDecimal
that uses big decimal object with the specified value in this unit.- Parameters:
value
- The value in this unit.- Returns:
- A new
QuantityBigDecimal
object with the specified value in this unit.
-
symbol
String symbol()
The reference unit of this measurement unit. Also serves as a unique identifier for the unit.- Returns:
- The unit symbol.
-
-