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 longconversionFactorDenominator()The denominator of the fraction representing the conversion factor from this unit to the reference unit.longconversionFactorNumerator()The numerator of the fraction representing the conversion factor from this unit to the reference unit.QuantityDouble<Self>of(double value)Creates a newQuantityDoublethat uses double object with the specified value in this unit.QuantityBigDecimal<Self>of(BigDecimal value)Creates a newQuantityBigDecimalthat uses big decimal object with the specified value in this unit.Stringsymbol()The reference unit of this measurement unit.StringtoString()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 newQuantityDoublethat uses double object with the specified value in this unit.- Parameters:
value- The value in this unit.- Returns:
- A new
QuantityDoubleobject with the specified value in this unit.
-
of
QuantityBigDecimal<Self> of(BigDecimal value)
Creates a newQuantityBigDecimalthat uses big decimal object with the specified value in this unit.- Parameters:
value- The value in this unit.- Returns:
- A new
QuantityBigDecimalobject 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.
-
-