The Unit of Measure used for the quantity's underlying value
The Unit of Measure used for the quantity's underlying value
UnitOfMeasure[A]
Return boolean result of inequality between this and that
Return boolean result of inequality between this and that
Quantity
Boolean
Returns boolean result of equality between this and that
Returns boolean result of equality between this and that
Quantity
Boolean
Returns the absolute value of this Quantity
Implements Ordered.
Divide this quantity by a like quantity
Divide this quantity by some number
Returns a Pair that includes the result of divideToInteger and remainder
Returns a Pair that includes the result of divideToInteger and remainder
Quantity
(Double, Quantity)
Returns a Pair that includes the result of divideToInteger and remainder
Returns a Pair that includes the result of divideToInteger and remainder
Double
(Quantity, Quantity)
Override of equals method
Override of equals method
must be of matching value and unit
Override of hashCode
Returns an equivalent Quantity boxed with the supplied Unit
Returns an equivalent Quantity boxed with the supplied Unit
This is really only useful for Quantity classes that box at the UOM level e.g. Temperature and currently Time
UnitOfMeasure[A] with UnitConverter
Quantity
Returns the max of this and that Quantity
Returns the min of this and that Quantity
Subtract two like quantities
Returns the negative value of this Quantity
Returns true if this value is not within (contains) the range
Returns true if this value is not within (contains) the range
QuantityRange
Boolean
Add two like quantities
Returns a QuantityRange representing the range for this value +- that
Returns a QuantityRange representing the range for this value +- that
Quantity
QuantityRange
Returns the remainder of a division by a like quantity
Returns the remainder of a division by a like quantity
Quantity
Double
Returns the remainder of a division by a number
Returns the remainder of a division by a number
Quantity
Quantity
Multiply this quantity by some number
Returns a Double representing the quantity in terms of the supplied unit
Returns a Double representing the quantity in terms of the supplied unit
val d = Feet(3) (d to Inches) should be(36)
UnitOfMeasure[A] with UnitConverter
Double
Returns a QuantityRange that goes from this to that
Returns a QuantityRange that goes from this to that
Quantity
QuantityRange
Returns a string representing the quantity's value in valueUnits
Returns a string representing the quantity's value in valueUnits
String
Returns a string representing the quantity's value in the given unit
Returns a string representing the quantity's value in the given unit
UnitOfMeasure[A] with UnitConverter
String
the value of the temperature
the value of the temperature
Returns true if this value is within (contains) the range
Returns true if this value is within (contains) the range
QuantityRange
Boolean
Represents a quantity of temperature
Temperatures are somewhat unique in the world of quantities for a couple of reasons.
First, different units (scales) have different "zero" values. This means that these scales are not simple multiples of the others. There is also an "zero offset" that must be applied to conversions from one scale to another.
Second, temperatures are often quoted as though they were quantities, when in fact they are just points on a scale. Similar to a mile marker on a highway, the quantity represented is the number degrees (miles) from a specific epoch on the scale.
In fact an absolute quantity of thermodynamic temperature should be measured from absolute zero. Thus, kelvinDegrees, is the SI Base unit for temperature.
The other scales supported here, Celsius and Fahrenheit, are known as empirical scales.
Two conversion types are supported: Degrees and Scale. Degrees based conversions DO NOT adjust for the zero point. Thus 5 degrees C|K is the same amount of temperature as 9 degrees F.
Scale based conversions DO adjust for the zero offset. Thus 5 degrees C is the same as 41 degrees F on the thermometer.
When creating a temperature it is not important to consider these differences. It is also irrelevant when performing operation on temperatures in the same scale. However, when performing operations on two temperatures of different scales these factors do become important.
The Quantity.to(unit) and Quantity.in(unit) methods are implemented to use Scale conversions
The Ordered.compare method is implemented to use Scale conversions
The Quantity.plus and Quantity.minus methods are implemented to use Degree conversions. (This supports creating quantity ranges with Fahrenheit(60) +- Celsius(5)
The toDegrees(unit) methods are implemented to use Degree conversions.
0.1