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) |
ComparableQuantity<javax.measure.quantity.Time> |
divide(Number that) |
ComparableQuantity<?> |
divide(javax.measure.Quantity<?> that) |
boolean |
equals(Object obj)
Compares this quantity against the specified object for strict equality (same unit and same amount).
|
TemporalAmount |
getTemporalAmount()
Returns the
TemporalAmount of this TemporalQuantity, which may involve rounding or truncation. |
TemporalUnit |
getTemporalUnit()
get to
TemporalUnit |
Number |
getValue()
get value expressed in
Number |
int |
hashCode()
Returns the hash code for this quantity.
|
ComparableQuantity<javax.measure.quantity.Frequency> |
inverse() |
ComparableQuantity<javax.measure.quantity.Time> |
multiply(Number that) |
ComparableQuantity<?> |
multiply(javax.measure.Quantity<?> that) |
javax.measure.Quantity<javax.measure.quantity.Time> |
negate() |
static TemporalQuantity |
of(Number number,
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(TemporalUnit aTimeUnit) |
javax.measure.Quantity<javax.measure.quantity.Time> |
toQuantity()
Converts the
TemporalQuantity to Quantity |
String |
toString()
Returns the
String representation of this quantity. |
javax.measure.Unit<javax.measure.quantity.Time> |
toUnit()
converts the
TemporalUnit to Unit |
asType, compareTo, divide, getScale, getUnit, hasFraction, hasFraction, inverse, isEquivalentTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, numberSystem, parse, topublic static TemporalQuantity of(Number number, 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 TemporalAmount getTemporalAmount()
TemporalAmount of this TemporalQuantity, which may involve rounding or truncation.ArithmeticException - when the value of this TemporalQuantity cannot be converted to longpublic TemporalUnit getTemporalUnit()
TemporalUnitpublic Number getValue()
NumbergetValue in interface javax.measure.Quantity<javax.measure.quantity.Time>getValue in interface tech.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 UnitgetTemporalUnit() converted to Unitpublic javax.measure.Quantity<javax.measure.quantity.Time> toQuantity()
TemporalQuantity to Quantitypublic TemporalQuantity to(TemporalUnit aTimeUnit)
public int hashCode()
AbstractQuantityhashCode 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 quantities 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.getLevel().equals(obj.getLevel()
&& this.getValue().equals(obj.getValue())public String toString()
AbstractQuantityString representation of this quantity. The string produced for a given quantity is always the same; it is not
affected by locale. This means that it can be used as a canonical string representation for exchanging quantity, or as a key for a Hashtable,
etc. Locale-sensitive quantity formatting and parsing is handled by the QuantityFormat implementations and its subclasses.toString in class AbstractQuantity<javax.measure.quantity.Time>SimpleQuantityFormat.getInstance().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<?> that)
Quantity.multiply(Quantity)public ComparableQuantity<javax.measure.quantity.Time> multiply(Number that)
Quantity.multiply(Number)public ComparableQuantity<javax.measure.quantity.Frequency> inverse()
Quantity.inverse()public javax.measure.Quantity<javax.measure.quantity.Time> negate()
Copyright © 2005–2022 Units of Measurement project. All rights reserved.