Class DoubleQuantity<Q extends javax.measure.Quantity<Q>>
java.lang.Object
tech.units.indriya.AbstractQuantity<Q>
tech.units.indriya.quantity.DoubleQuantity<Q>
- Type Parameters:
Q- The type of the quantity.Q- The type of the quantity.
- All Implemented Interfaces:
Serializable, Comparable<javax.measure.Quantity<Q>>, javax.measure.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>
final class DoubleQuantity<Q extends javax.measure.Quantity<Q>>
extends AbstractQuantity<Q>
implements Serializable
An amount of quantity, implementation of
ComparableQuantity that uses Double as implementation of Number, this object is
immutable. Note: all operations which involves Number, this implementation will convert to Double.- Since:
- 1.0
- Version:
- 0.4, $Date: 2017-05-28 $
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractQuantity
AbstractQuantity.Equalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long(package private) final doubleFields inherited from class AbstractQuantity
NONE, ONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ComparableQuantity<Q> decimalValue(javax.measure.Unit<Q> unit) divide(javax.measure.Quantity<?> that) doubledoubleValue(javax.measure.Unit<Q> unit) booleanCompares this quantity against the specified object for strict equality (same unit and same amount).getValue()Returns the numeric value of the quantity.inverse()booleanisBig()longmultiply(javax.measure.Quantity<?> that) Methods inherited from class AbstractQuantity
asType, compareTo, divide, equals, floatValue, getUnit, hasFraction, hasFraction, hashCode, intValue, inverse, isEquivalentOf, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, multiply, parse, to, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
value
final double value
-
-
Constructor Details
-
DoubleQuantity
-
-
Method Details
-
getValue
Description copied from class:AbstractQuantityReturns the numeric value of the quantity.- Specified by:
getValuein interfacejavax.measure.Quantity<Q extends javax.measure.Quantity<Q>>- Specified by:
getValuein interfacetech.uom.lib.common.function.ValueSupplier<Q extends javax.measure.Quantity<Q>>- Specified by:
getValuein classAbstractQuantity<Q extends javax.measure.Quantity<Q>>- Returns:
- the quantity value.
-
doubleValue
- Specified by:
doubleValuein classAbstractQuantity<Q extends javax.measure.Quantity<Q>>
-
decimalValue
- Specified by:
decimalValuein classAbstractQuantity<Q extends javax.measure.Quantity<Q>>- Throws:
ArithmeticException
-
longValue
- Overrides:
longValuein classAbstractQuantity<Q extends javax.measure.Quantity<Q>>
-
addRaw
-
add
-
subtract
-
multiply
-
multiply
-
divide
-
divide
-
inverse
-
isBig
public boolean isBig()- Specified by:
isBigin classAbstractQuantity<Q extends javax.measure.Quantity<Q>>
-
equals
Description copied from class:AbstractQuantityCompares this quantity against the specified object for strict equality (same unit and same amount).Similarly to the
BigDecimal.equals(Object)method which consider 2.0 and 2.00 as different objects because of different internal scales, quantities such asQuantities.getQuantity(3.0, KILOGRAM)Quantities.getQuantity(3, KILOGRAM)andQuantities.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
compareToormethods should be used.invalid reference
equals(Quantity, epsilon, epsilonUnit)- Overrides:
equalsin classAbstractQuantity<Q extends javax.measure.Quantity<Q>>- Parameters:
obj- the object to compare with.- Returns:
this.getUnit.equals(obj.getUnit()) invalid input: '&'invalid input: '&' this.getValue().equals(obj.getValue())
-