Package de.xima.fc.common.measure
Class LengthUnit
- java.lang.Object
-
- de.xima.fc.common.measure.LengthUnit
-
- All Implemented Interfaces:
Length,MeasurementUnit<Length>
public final class LengthUnit extends Object implements Length
Common units of length.- Since:
- 8.4.0
-
-
Field Summary
Fields Modifier and Type Field Description static LengthCENTIMETERA centimeterstatic LengthCMA centimeterstatic LengthDECIMETERA decimeterstatic LengthDMA decimeterstatic LengthINCHAn inch (2.54cm)static LengthKILOMETERA kilometerstatic LengthKMA kilometerstatic LengthMA meterstatic LengthMETERA meterstatic LengthMICROMETERA micrometerstatic LengthMILLIMETERA millimeterstatic LengthMMA millimeterstatic LengthNANOMETERA nanometerstatic LengthNMA nanometerstatic LengthPIXELA pixel.static LengthPOINTA pixel.static LengthPTA pixel.static LengthPXA pixel.static LengthUMA micrometer
-
Method Summary
All Methods Instance Methods Concrete 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.booleanequals(Object obj)inthashCode()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.protected Lengthself()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.-
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
-
CENTIMETER
public static final Length CENTIMETER
A centimeter
-
CM
public static final Length CM
A centimeter
-
DECIMETER
public static final Length DECIMETER
A decimeter
-
DM
public static final Length DM
A decimeter
-
INCH
public static final Length INCH
An inch (2.54cm)
-
KILOMETER
public static final Length KILOMETER
A kilometer
-
KM
public static final Length KM
A kilometer
-
M
public static final Length M
A meter
-
METER
public static final Length METER
A meter
-
MICROMETER
public static final Length MICROMETER
A micrometer
-
MILLIMETER
public static final Length MILLIMETER
A millimeter
-
MM
public static final Length MM
A millimeter
-
NANOMETER
public static final Length NANOMETER
A nanometer
-
NM
public static final Length NM
A nanometer
-
PIXEL
public static final Length PIXEL
A pixel. 1px = 1/96th of 1 inch.
-
POINT
public static final Length POINT
A pixel. 1pt = 1/72th of 1 inch.
-
PT
public static final Length PT
A pixel. 1pt = 1/72th of 1 inch.
-
PX
public static final Length PX
A pixel. 1px = 1/96th of 1 inch.
-
UM
public static final Length UM
A micrometer
-
-
Method Detail
-
self
protected Length self()
-
conversionFactorDenominator
public long conversionFactorDenominator()
Description copied from interface:MeasurementUnitThe denominator of the fraction representing the conversion factor from this unit to the reference unit.- Specified by:
conversionFactorDenominatorin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Returns:
- The conversion factor denominator.
-
conversionFactorNumerator
public long conversionFactorNumerator()
Description copied from interface:MeasurementUnitThe numerator of the fraction representing the conversion factor from this unit to the reference unit.- Specified by:
conversionFactorNumeratorin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Returns:
- The conversion factor numerator.
-
of
public final QuantityDouble<Self> of(double value)
Description copied from interface:MeasurementUnitCreates a newQuantityDoublethat uses double object with the specified value in this unit.- Specified by:
ofin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Parameters:
value- The value in this unit.- Returns:
- A new
QuantityDoubleobject with the specified value in this unit.
-
of
public QuantityBigDecimal<Self> of(BigDecimal value)
Description copied from interface:MeasurementUnitCreates a newQuantityBigDecimalthat uses big decimal object with the specified value in this unit.- Specified by:
ofin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Parameters:
value- The value in this unit.- Returns:
- A new
QuantityBigDecimalobject with the specified value in this unit.
-
symbol
public String symbol()
Description copied from interface:MeasurementUnitThe reference unit of this measurement unit. Also serves as a unique identifier for the unit.- Specified by:
symbolin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Returns:
- The unit symbol.
-
toString
public String toString()
Description copied from interface:MeasurementUnitGets a string representation of the unit, usually the unit symbol such as "m" for meters or "kg" for kilograms.- Specified by:
toStringin interfaceMeasurementUnit<Self extends MeasurementUnit<Self>>- Overrides:
toStringin classObject- Returns:
- The reference unit.
-
-