public final class TimeUnitQuantity extends AbstractQuantity<javax.measure.quantity.Time>
TimeUnit in Unit-API| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
private java.util.concurrent.TimeUnit |
timeUnit |
private java.lang.Integer |
value |
NONE, ONE| Constructor and Description |
|---|
TimeUnitQuantity(java.util.concurrent.TimeUnit timeUnit,
java.lang.Integer value)
|
| Modifier and Type | Method and Description |
|---|---|
ComparableQuantity<javax.measure.quantity.Time> |
add(javax.measure.Quantity<javax.measure.quantity.Time> that) |
java.math.BigDecimal |
decimalValue(javax.measure.Unit<javax.measure.quantity.Time> unit,
java.math.MathContext ctx) |
ComparableQuantity<javax.measure.quantity.Time> |
divide(java.lang.Number that) |
ComparableQuantity<?> |
divide(javax.measure.Quantity<?> that) |
double |
doubleValue(javax.measure.Unit<javax.measure.quantity.Time> unit) |
boolean |
equals(java.lang.Object obj)
Compares this measure against the specified object for strict equality (same unit and same amount).
|
java.util.concurrent.TimeUnit |
getTimeUnit()
get to
TimeUnit |
java.lang.Integer |
getValue()
get value expressed in
Integer |
int |
hashCode()
Returns the hash code for this measure.
|
ComparableQuantity<?> |
inverse() |
boolean |
isBig() |
ComparableQuantity<javax.measure.quantity.Time> |
multiply(java.lang.Number multiplier) |
ComparableQuantity<?> |
multiply(javax.measure.Quantity<?> multiplier) |
static TimeUnitQuantity |
of(javax.measure.Quantity<javax.measure.quantity.Time> quantity)
|
static TimeUnitQuantity |
of(java.util.concurrent.TimeUnit timeUnit,
java.lang.Integer number)
|
ComparableQuantity<javax.measure.quantity.Time> |
subtract(javax.measure.Quantity<javax.measure.quantity.Time> that) |
TimeUnitQuantity |
to(java.util.concurrent.TimeUnit timeUnit) |
javax.measure.Quantity<javax.measure.quantity.Time> |
toQuantity()
Converts the
TimeUnitQuantity to Quantity |
java.lang.String |
toString()
Returns the
String representation of this measure. |
javax.measure.Unit<javax.measure.quantity.Time> |
toUnit()
converts the
TimeUnit to Unit |
private static javax.measure.Unit<javax.measure.quantity.Time> |
toUnit(java.util.concurrent.TimeUnit timeUnit) |
asType, compareTo, divide, equals, floatValue, getUnit, intValue, inverse, isEquivalentTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, longValue, multiply, parse, to, to, toSIprivate static final long serialVersionUID
private final java.util.concurrent.TimeUnit timeUnit
private final java.lang.Integer value
TimeUnitQuantity(java.util.concurrent.TimeUnit timeUnit,
java.lang.Integer value)
timeUnit - - time to be usedvalue - - value to be usedpublic static TimeUnitQuantity of(java.util.concurrent.TimeUnit timeUnit, java.lang.Integer number)
timeUnit - - time to be usedvalue - - value to be usedpublic static TimeUnitQuantity of(javax.measure.Quantity<javax.measure.quantity.Time> quantity)
quantity - - quantity to be usedTimeUnitQuantity converted be quantity in seconds.public java.util.concurrent.TimeUnit getTimeUnit()
TimeUnitpublic java.lang.Integer getValue()
IntegergetValue in interface javax.measure.Quantity<javax.measure.quantity.Time>getValue in interface tec.uom.lib.common.function.ValueSupplier<java.lang.Number>getValue in class AbstractQuantity<javax.measure.quantity.Time>public javax.measure.Unit<javax.measure.quantity.Time> toUnit()
TimeUnit to UnitgetTimeUnit() converted to Unitpublic javax.measure.Quantity<javax.measure.quantity.Time> toQuantity()
TimeUnitQuantity to Quantitypublic TimeUnitQuantity to(java.util.concurrent.TimeUnit timeUnit)
private static javax.measure.Unit<javax.measure.quantity.Time> toUnit(java.util.concurrent.TimeUnit timeUnit)
public int hashCode()
AbstractQuantityhashCode in class AbstractQuantity<javax.measure.quantity.Time>public boolean equals(java.lang.Object obj)
AbstractQuantity
Similarly to the BigDecimal.equals(java.lang.Object) method which consider 2.0 and 2.00 as different objects because of different internal scales,
quantities such as Quantities.getQuantity(3.0, KILOGRAM) Quantities.getQuantity(3, KILOGRAM) and
Quantities.getQuantity("3 kg") might not be considered equals because of possible differences in their implementations.
To compare measures stated using different units or using different amount implementations the compareTo or
equals(Quantity, epsilon, epsilonUnit) methods should be used.
equals in class AbstractQuantity<javax.measure.quantity.Time>obj - the object to compare with.this.getUnit.equals(obj.getUnit())
&& this.getValue().equals(obj.getValue())public java.lang.String toString()
AbstractQuantityString representation of this measure. The string produced for a given measure is always the same; it is not affected by
locale. This means that it can be used as a canonical string representation for exchanging measure, or as a key for a Hashtable, etc.
Locale-sensitive measure formatting and parsing is handled by the MeasurementFormat class and its subclasses.toString in class AbstractQuantity<javax.measure.quantity.Time>UnitFormat.getInternational().format(this)public ComparableQuantity<javax.measure.quantity.Time> add(javax.measure.Quantity<javax.measure.quantity.Time> that)
Quantity.add(Quantity)public ComparableQuantity<javax.measure.quantity.Time> subtract(javax.measure.Quantity<javax.measure.quantity.Time> that)
Quantity.subtract(Quantity)public ComparableQuantity<?> divide(javax.measure.Quantity<?> that)
Quantity.divide(Quantity)public ComparableQuantity<javax.measure.quantity.Time> divide(java.lang.Number that)
Quantity.divide(Number)public ComparableQuantity<?> multiply(javax.measure.Quantity<?> multiplier)
Quantity.multiply(Quantity)public ComparableQuantity<javax.measure.quantity.Time> multiply(java.lang.Number multiplier)
Quantity.multiply(Number)public ComparableQuantity<?> inverse()
Quantity.inverse()public boolean isBig()
isBig in class AbstractQuantity<javax.measure.quantity.Time>public java.math.BigDecimal decimalValue(javax.measure.Unit<javax.measure.quantity.Time> unit,
java.math.MathContext ctx)
throws java.lang.ArithmeticException
decimalValue in class AbstractQuantity<javax.measure.quantity.Time>java.lang.ArithmeticExceptionpublic double doubleValue(javax.measure.Unit<javax.measure.quantity.Time> unit)
throws java.lang.ArithmeticException
doubleValue in class AbstractQuantity<javax.measure.quantity.Time>java.lang.ArithmeticException