Package tech.units.indriya.quantity
Class NumberQuantity<Q extends Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.AbstractQuantity<Q>
-
- tech.units.indriya.quantity.NumberQuantity<Q>
-
- Type Parameters:
Q- The type of the quantity.
- All Implemented Interfaces:
Serializable,Comparable<Quantity<Q>>,Quantity<Q>,ComparableQuantity<Q>,tech.uom.lib.common.function.QuantityConverter<Q>,tech.uom.lib.common.function.UnitSupplier<Q>,tech.uom.lib.common.function.ValueSupplier<Number>
@API(status=MAINTAINED) public final class NumberQuantity<Q extends Quantity<Q>> extends AbstractQuantity<Q>
Implementation ofComparableQuantitythat holds a JavaNumber, which represented this quantity's amount.This object is immutable.
- Since:
- 1.0
- Version:
- 2.3, May 14, 2021
- Author:
- Andi Huber, Werner Keil
- See Also:
AbstractQuantity,Quantity,ComparableQuantity, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.measure.Quantity
Quantity.Scale
-
-
Field Summary
-
Fields inherited from class tech.units.indriya.AbstractQuantity
NONE, ONE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNumberQuantity(Number number, Unit<Q> unit)protectedNumberQuantity(Number number, Unit<Q> unit, Quantity.Scale sc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComparableQuantity<Q>add(Quantity<Q> that)ComparableQuantity<Q>divide(Number divisor)ComparableQuantity<?>divide(Quantity<?> that)NumbergetValue()Returns the numeric value of the quantity.ComparableQuantity<?>inverse()ComparableQuantity<Q>multiply(Number factor)ComparableQuantity<?>multiply(Quantity<?> that)Quantity<Q>negate()ComparableQuantity<Q>subtract(Quantity<Q> that)-
Methods inherited from class tech.units.indriya.AbstractQuantity
asType, compareTo, divide, equals, getScale, getUnit, hasFraction, hasFraction, hashCode, inverse, isEquivalentTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, parse, to, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.measure.Quantity
toSystemUnit
-
-
-
-
Constructor Detail
-
NumberQuantity
protected NumberQuantity(Number number, Unit<Q> unit, Quantity.Scale sc)
- Since:
- 2.0
-
NumberQuantity
protected NumberQuantity(Number number, Unit<Q> unit)
-
-
Method Detail
-
add
public ComparableQuantity<Q> add(Quantity<Q> that)
- See Also:
Quantity.add(Quantity)
-
subtract
public ComparableQuantity<Q> subtract(Quantity<Q> that)
- See Also:
Quantity.subtract(Quantity)
-
divide
public ComparableQuantity<?> divide(Quantity<?> that)
- See Also:
Quantity.divide(Quantity)
-
divide
public ComparableQuantity<Q> divide(Number divisor)
- See Also:
Quantity.divide(Number)
-
multiply
public ComparableQuantity<?> multiply(Quantity<?> that)
- See Also:
Quantity.multiply(Quantity)
-
multiply
public ComparableQuantity<Q> multiply(Number factor)
- See Also:
Quantity.multiply(Number)
-
inverse
public ComparableQuantity<?> inverse()
- See Also:
Quantity.inverse()
-
getValue
public Number getValue()
Description copied from class:AbstractQuantityReturns the numeric value of the quantity.
-
-