Package de.xima.fc.common.measure
Interface Quantity<Unit extends MeasurementUnit<Unit>>
-
- All Superinterfaces:
Comparable<Quantity<Unit>>
,Serializable
- All Known Implementing Classes:
QuantityBigDecimal
,QuantityDouble
public interface Quantity<Unit extends MeasurementUnit<Unit>> extends Comparable<Quantity<Unit>>, Serializable
A quantity with a numerical value with aMeasurementUnit
.Quantity or amount is a property that can exist as a multitude or magnitude, which illustrate discontinuity and continuity. Quantities can be compared in terms of "more", "less", or "equal", or by assigning a numerical value multiple of a unit of measurement. Mass, time, distance, heat, and angle are among the familiar examples of quantitative properties.
- Since:
- 8.4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BigDecimal
bigDecimalValue()
The numerical value of the quantity, as aBigDecimal
.BigInteger
bigIntegerValue()
The numerical value of the quantity, as aBigInteger
.Quantity<Unit>
convertTo(Unit unit)
Convert this quantity to the given unit.double
doubleValue()
The numerical value of the quantity, as aDouble
.float
floatValue()
The numerical value of the quantity, as aFloat
.int
intValue()
The numerical value of the quantity, as anInteger
.long
longValue()
The numerical value of the quantity, as aLong
.Unit
unit()
The unit of the quantity.Number
value()
The numerical value of the quantity.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
bigDecimalValue
BigDecimal bigDecimalValue()
The numerical value of the quantity, as aBigDecimal
.- Returns:
- The value of the quantity.
-
bigIntegerValue
BigInteger bigIntegerValue()
The numerical value of the quantity, as aBigInteger
.- Returns:
- The value of the quantity.
-
convertTo
Quantity<Unit> convertTo(Unit unit)
Convert this quantity to the given unit.- Parameters:
unit
- The unit to convert to.- Returns:
- The converted quantity.
-
doubleValue
double doubleValue()
The numerical value of the quantity, as aDouble
.- Returns:
- The value of the quantity.
-
floatValue
float floatValue()
The numerical value of the quantity, as aFloat
.- Returns:
- The value of the quantity.
-
intValue
int intValue()
The numerical value of the quantity, as anInteger
.- Returns:
- The value of the quantity.
-
longValue
long longValue()
The numerical value of the quantity, as aLong
.- Returns:
- The value of the quantity.
-
unit
Unit unit()
The unit of the quantity.- Returns:
- The unit of the quantity.
-
value
Number value()
The numerical value of the quantity.- Returns:
- The value of the quantity.
-
-