Serializable
, Comparable<javax.measure.quantity.Time>
, javax.measure.Quantity<javax.measure.quantity.Time>
, ComparableQuantity<javax.measure.quantity.Time>
, tech.uom.lib.common.function.QuantityConverter<javax.measure.quantity.Time>
public final class TimeUnitQuantity extends AbstractQuantity<javax.measure.quantity.Time>
TimeUnit
in Unit-APINONE, ONE
Modifier and Type | Method | 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).
|
TimeUnit |
getTimeUnit() |
get to
TimeUnit |
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 TimeUnitQuantity |
of(Number number,
TimeUnit timeUnit) |
|
static TimeUnitQuantity |
of(TimeUnit timeUnit,
Integer number) |
Deprecated.
use #of(Integer, TimeUnit)
|
static TimeUnitQuantity |
of(javax.measure.Quantity<javax.measure.quantity.Time> quantity) |
|
ComparableQuantity<javax.measure.quantity.Time> |
subtract(javax.measure.Quantity<javax.measure.quantity.Time> that) |
|
TimeUnitQuantity |
to(TimeUnit aTimeUnit) |
|
javax.measure.Quantity<javax.measure.quantity.Time> |
toQuantity() |
Converts the
TimeUnitQuantity to Quantity |
String |
toString() |
Returns the
String representation of this quantity. |
javax.measure.Unit<javax.measure.quantity.Time> |
toUnit() |
converts the
TimeUnit to Unit |
asType, compareTo, divide, getScale, getUnit, hasFraction, hasFraction, inverse, isEquivalentTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, numberSystem, parse, to
public static TimeUnitQuantity of(Number number, TimeUnit timeUnit)
timeUnit
- - time to be usedvalue
- - value to be used@Deprecated public static TimeUnitQuantity of(TimeUnit timeUnit, 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 TimeUnit getTimeUnit()
TimeUnit
public Number getValue()
Number
getValue
in interface javax.measure.Quantity<javax.measure.quantity.Time>
getValue
in class AbstractQuantity<javax.measure.quantity.Time>
public javax.measure.Unit<javax.measure.quantity.Time> toUnit()
TimeUnit
to Unit
getTimeUnit()
converted to Unitpublic javax.measure.Quantity<javax.measure.quantity.Time> toQuantity()
TimeUnitQuantity
to Quantity
public TimeUnitQuantity to(TimeUnit aTimeUnit)
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 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()
AbstractQuantity
String
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–2020 Units of Measurement project. All rights reserved.