public final class TemporalQuantity extends AbstractQuantity<javax.measure.quantity.Time>
TemporalUnit
in Unit-APINONE, ONE
Modifier and Type | Method and Description |
---|---|
ComparableQuantity<javax.measure.quantity.Time> |
add(javax.measure.Quantity<javax.measure.quantity.Time> that) |
BigDecimal |
decimalValue(javax.measure.Unit<javax.measure.quantity.Time> unit,
MathContext ctx) |
ComparableQuantity<javax.measure.quantity.Time> |
divide(Number that) |
ComparableQuantity<?> |
divide(javax.measure.Quantity<?> that) |
double |
doubleValue(javax.measure.Unit<javax.measure.quantity.Time> unit) |
boolean |
equals(Object obj)
Compares this measure against the specified object for strict equality (same unit and same amount).
|
java.time.temporal.TemporalAmount |
getTemporalAmount()
get to
TemporalAmount |
java.time.temporal.TemporalUnit |
getTemporalUnit()
get to
TemporalUnit |
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(Number multiplier) |
ComparableQuantity<?> |
multiply(javax.measure.Quantity<?> multiplier) |
static TemporalQuantity |
of(Integer number,
java.time.temporal.TemporalUnit timeUnit)
|
static TemporalQuantity |
of(javax.measure.Quantity<javax.measure.quantity.Time> quantity)
|
ComparableQuantity<javax.measure.quantity.Time> |
subtract(javax.measure.Quantity<javax.measure.quantity.Time> that) |
TemporalQuantity |
to(java.time.temporal.TemporalUnit timeUnit) |
javax.measure.Quantity<javax.measure.quantity.Time> |
toQuantity()
Converts the
TemporalQuantity to Quantity |
String |
toString()
Returns the
String representation of this measure. |
javax.measure.Unit<javax.measure.quantity.Time> |
toUnit()
converts the
TemporalUnit to Unit |
asType, compareTo, divide, equals, floatValue, getUnit, intValue, inverse, isEquivalentTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, longValue, multiply, parse, to, to, toSI
public static TemporalQuantity of(Integer number, java.time.temporal.TemporalUnit timeUnit)
value
- - value to be usedtimeUnit
- - time to be usedpublic static TemporalQuantity of(javax.measure.Quantity<javax.measure.quantity.Time> quantity)
quantity
- - quantity to be usedTemporalQuantity
converted be quantity in seconds.public java.time.temporal.TemporalAmount getTemporalAmount()
TemporalAmount
public java.time.temporal.TemporalUnit getTemporalUnit()
TemporalUnit
public Integer getValue()
Integer
getValue
in interface javax.measure.Quantity<javax.measure.quantity.Time>
getValue
in interface tec.uom.lib.common.function.ValueSupplier<Number>
getValue
in class AbstractQuantity<javax.measure.quantity.Time>
public javax.measure.Unit<javax.measure.quantity.Time> toUnit()
TemporalUnit
to Unit
getTemporalUnit()
converted to Unitpublic javax.measure.Quantity<javax.measure.quantity.Time> toQuantity()
TemporalQuantity
to Quantity
public TemporalQuantity to(java.time.temporal.TemporalUnit timeUnit)
public int hashCode()
AbstractQuantity
hashCode
in class AbstractQuantity<javax.measure.quantity.Time>
public boolean equals(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 String toString()
AbstractQuantity
String
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(Number that)
Quantity.divide(Number)
public ComparableQuantity<?> multiply(javax.measure.Quantity<?> multiplier)
Quantity.multiply(Quantity)
public ComparableQuantity<javax.measure.quantity.Time> multiply(Number multiplier)
Quantity.multiply(Number)
public ComparableQuantity<?> inverse()
Quantity.inverse()
public boolean isBig()
isBig
in class AbstractQuantity<javax.measure.quantity.Time>
public BigDecimal decimalValue(javax.measure.Unit<javax.measure.quantity.Time> unit, MathContext ctx) throws ArithmeticException
decimalValue
in class AbstractQuantity<javax.measure.quantity.Time>
ArithmeticException
public double doubleValue(javax.measure.Unit<javax.measure.quantity.Time> unit) throws ArithmeticException
doubleValue
in class AbstractQuantity<javax.measure.quantity.Time>
ArithmeticException
Copyright © 2005-2019 Units of Measurement project. All Rights Reserved.