Package de.xima.fc.common.measure
Class TimeUnit
- java.lang.Object
-
- de.xima.fc.common.measure.TimeUnit
-
- All Implemented Interfaces:
MeasurementUnit<Time>
,Time
public class TimeUnit extends Object implements Time
Common units of time.- Since:
- 8.4.0
-
-
Field Summary
Fields Modifier and Type Field Description static Time
D
A daystatic Time
DAY
A daystatic Time
H
An hourstatic Time
HOUR
An hourstatic Time
MICROSECOND
A microsecondstatic Time
MILLISECOND
A millisecondstatic Time
MIN
A minutestatic Time
MINUTE
A minutestatic Time
MS
A millisecondstatic Time
NANOSECOND
A nanosecondstatic Time
NS
A nanosecondstatic Time
S
A secondstatic Time
SECOND
A secondstatic Time
US
A microsecond
-
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 Time
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
-
D
public static final Time D
A day
-
DAY
public static final Time DAY
A day
-
H
public static final Time H
An hour
-
HOUR
public static final Time HOUR
An hour
-
MICROSECOND
public static final Time MICROSECOND
A microsecond
-
MILLISECOND
public static final Time MILLISECOND
A millisecond
-
MIN
public static final Time MIN
A minute
-
MINUTE
public static final Time MINUTE
A minute
-
MS
public static final Time MS
A millisecond
-
NANOSECOND
public static final Time NANOSECOND
A nanosecond
-
NS
public static final Time NS
A nanosecond
-
S
public static final Time S
A second
-
SECOND
public static final Time SECOND
A second
-
US
public static final Time US
A microsecond
-
-
Method Detail
-
self
protected Time 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.
-
-