Package de.xima.fc.common.measure
Class MassUnit
- java.lang.Object
-
- de.xima.fc.common.measure.MassUnit
-
- All Implemented Interfaces:
Mass
,MeasurementUnit<Mass>
public class MassUnit extends Object implements Mass
Common units of mass.- Since:
- 8.4.0
-
-
Field Summary
Fields Modifier and Type Field Description static Mass
G
A gramstatic Mass
GRAM
A gramstatic Mass
KG
A kilogramstatic Mass
KILOGRAM
A kilogramstatic Mass
MG
A milligramstatic Mass
MICROGRAM
A microgramstatic Mass
MILLIGRAM
A milligramstatic Mass
NANOGRAM
A nanogramstatic Mass
NG
A nanogramstatic Mass
T
A metric ton.static Mass
TON
A metric ton.static Mass
UG
A microgram
-
Method Summary
All Methods Instance Methods Concrete 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.boolean
equals(Object obj)
int
hashCode()
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.protected Mass
self()
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.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.xima.fc.common.measure.MeasurementUnit
conversionFactorDenominator, conversionFactorNumerator, of, of, symbol, toString
-
-
-
-
Field Detail
-
G
public static final Mass G
A gram
-
GRAM
public static final Mass GRAM
A gram
-
KG
public static final Mass KG
A kilogram
-
KILOGRAM
public static final Mass KILOGRAM
A kilogram
-
MG
public static final Mass MG
A milligram
-
MICROGRAM
public static final Mass MICROGRAM
A microgram
-
MILLIGRAM
public static final Mass MILLIGRAM
A milligram
-
NANOGRAM
public static final Mass NANOGRAM
A nanogram
-
NG
public static final Mass NG
A nanogram
-
T
public static final Mass T
A metric ton.
-
TON
public static final Mass TON
A metric ton.
-
UG
public static final Mass UG
A microgram
-
-
Method Detail
-
self
protected Mass self()
-
conversionFactorDenominator
public long conversionFactorDenominator()
Description copied from interface:MeasurementUnit
The denominator of the fraction representing the conversion factor from this unit to the reference unit.- Specified by:
conversionFactorDenominator
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Returns:
- The conversion factor denominator.
-
conversionFactorNumerator
public long conversionFactorNumerator()
Description copied from interface:MeasurementUnit
The numerator of the fraction representing the conversion factor from this unit to the reference unit.- Specified by:
conversionFactorNumerator
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Returns:
- The conversion factor numerator.
-
of
public final QuantityDouble<Self> of(double value)
Description copied from interface:MeasurementUnit
Creates a newQuantityDouble
that uses double object with the specified value in this unit.- Specified by:
of
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Parameters:
value
- The value in this unit.- Returns:
- A new
QuantityDouble
object with the specified value in this unit.
-
of
public QuantityBigDecimal<Self> of(BigDecimal value)
Description copied from interface:MeasurementUnit
Creates a newQuantityBigDecimal
that uses big decimal object with the specified value in this unit.- Specified by:
of
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Parameters:
value
- The value in this unit.- Returns:
- A new
QuantityBigDecimal
object with the specified value in this unit.
-
symbol
public String symbol()
Description copied from interface:MeasurementUnit
The reference unit of this measurement unit. Also serves as a unique identifier for the unit.- Specified by:
symbol
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Returns:
- The unit symbol.
-
toString
public String toString()
Description copied from interface:MeasurementUnit
Gets a string representation of the unit, usually the unit symbol such as "m" for meters or "kg" for kilograms.- Specified by:
toString
in interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>
- Overrides:
toString
in classObject
- Returns:
- The reference unit.
-
-