Package javax.measure.test.quantity
Class TestQuantity<Q extends Quantity<Q>>
Object
TestQuantity<Q>
- All Implemented Interfaces:
Comparable<Quantity<Q>>
,Quantity<Q>
- Direct Known Subclasses:
AreaQuantity
,DistanceQuantity
,TemperatureQuantity
,TimeQuantity
,VolumeQuantity
public abstract class TestQuantity<Q extends Quantity<Q>>
extends Object
implements Quantity<Q>, Comparable<Quantity<Q>>
- Since:
- 1.0
- Version:
- 2.0
- Author:
- Werner Keil
-
Nested Class Summary
Nested classes/interfaces inherited from interface Quantity
Quantity.Scale
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
TestQuantity
(Class<Q> type) protected
TestQuantity
(Class<Q> type, Quantity.Scale scale) -
Method Summary
Modifier and TypeMethodDescriptionadd
(TestQuantity<Q> dn, TestQuantity<Q> d1, TestQuantity<Q> d2, TestUnit<Q> au) int
Compares this quantity to the specified Measurement quantity.boolean
eq
(TestQuantity<Q> d1) boolean
ge
(TestQuantity<Q> d1) getScale()
getType()
getUnit()
getValue()
boolean
gt
(TestQuantity<Q> d1) boolean
isEquivalentTo
(Quantity<Q> that) boolean
le
(TestQuantity<Q> d1) boolean
lt
(TestQuantity<Q> d1) boolean
ne
(TestQuantity<Q> d1) protected String
showInUnits
(TestUnit<?> u, int precision) subtract
(TestQuantity<Q> dn, TestQuantity<Q> d1, TestQuantity<Q> d2, TestUnit<Q> au) toString()
-
Field Details
-
ONE
-
scalar
-
value
-
unit
-
-
Constructor Details
-
TestQuantity
-
TestQuantity
-
-
Method Details
-
getType
-
add
public TestQuantity<Q> add(TestQuantity<Q> dn, TestQuantity<Q> d1, TestQuantity<Q> d2, TestUnit<Q> au) -
subtract
public TestQuantity<Q> subtract(TestQuantity<Q> dn, TestQuantity<Q> d1, TestQuantity<Q> d2, TestUnit<Q> au) -
eq
-
ne
-
gt
-
lt
-
ge
-
le
-
toString
-
compareTo
Compares this quantity to the specified Measurement quantity. The default implementation compares theQuantity.getValue()
of both this quantity and the specified Quantity stated in the same unit (this quantity'sunit
).- Specified by:
compareTo
in interfaceComparable<Q extends Quantity<Q>>
- Returns:
- a negative integer, zero, or a positive integer as this quantity is less than, equal to, or greater than the specified Quantity quantity.
-
showInUnits
-
getValue
-
getUnit
-
getScale
-
isEquivalentTo
- Specified by:
isEquivalentTo
in interfaceQuantity<Q extends Quantity<Q>>
-