DeltaQuantity
Defines DeltaQuantity constructors and extension methods
- Source:
- deltaquantity.scala
Type members
Classlikes
A shim class for DeltaQuantity companion object constructors
A shim class for DeltaQuantity companion object constructors
- Companion:
- object
- Source:
- deltaquantity.scala
Value members
Concrete methods
Lift a raw value of type V into a unit quantity
Lift a raw value of type V into a unit quantity
- Type parameters:
- B
base unit type of U
- U
the desired unit type
- Returns:
a DeltaQuantity with given value and unit type
val temp = DeltaQuantity[Celsius, Kelvin](100.0)
- Source:
- deltaquantity.scala
Extensions
Extensions
add a quantity to this delta-quantity
add a quantity to this delta-quantity
- Type parameters:
- UR
right hand unit type
- VR
right hand value type
- Value parameters:
- qr
right hand quantity
- Returns:
the result of adding
qr
to this, as a DeltaQuantity value- Note:
unit types
UL
andUR
must be convertableresult may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = 14.withEpochTime[Day] val q = (1.0).withUnit[Week] t1 + q // => EpochTime[Double, Day](21.0)
- Source:
- deltaquantity.scala
subtract another delta-quantity from this one
subtract another delta-quantity from this one
- Type parameters:
- UR
right hand unit type
- VR
right hand value type
- Value parameters:
- qr
right hand delta-quantity
- Returns:
the result of subtracting
qr
from this, as a Quantity value- Note:
unit types
UL
andUR
must be convertableresult may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = 14.withEpochTime[Day] val t2 = (1.0).withEpochTime[Week] t1 - t2 // => Quantity[Double, Day](7.0)
- Source:
- deltaquantity.scala
subtract quantity from this delta-quantity
subtract quantity from this delta-quantity
- Type parameters:
- UR
right hand unit type
- VR
right hand value type
- Value parameters:
- qr
right hand quantity
- Returns:
the result of subtracting
qr
from this, as a DeltaQuantity value- Note:
unit types
UL
andUR
must be convertableresult may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = 14.withEpochTime[Day] val q = (1.0).withUnit[Week] t1 - q // => EpochTime[Double, Day](7.0)
- Source:
- deltaquantity.scala
test if this delta-quantity is less than another
test if this delta-quantity is less than another
- Type parameters:
- UR
unit type of the right hand quantity
- VR
value type of the right hand quantity
- Value parameters:
- qr
the right hand quantity
- Returns:
true if left-hand value is less than the right (after any conversions), false otherwise
- Note:
result may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = (14.0).withEpochTime[Day] val t2 = 3.withEpochTime[Week] t1 < t2 // => true
- Source:
- deltaquantity.scala
test if this delta-quantity is less than or equal to than another
test if this delta-quantity is less than or equal to than another
- Type parameters:
- UR
unit type of the right hand quantity
- VR
value type of the right hand quantity
- Value parameters:
- qr
the right hand quantity
- Returns:
true if left-hand value is less than or equal to the right (after any conversions), false otherwise
- Note:
result may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = (14.0).withEpochTime[Day] val t2 = 3.withEpochTime[Week] t1 <= t2 // => true
- Source:
- deltaquantity.scala
test this delta-quantity for inequality with another
test this delta-quantity for inequality with another
- Type parameters:
- UR
unit type of the right hand quantity
- VR
value type of the right hand quantity
- Value parameters:
- qr
the right hand quantity
- Returns:
true if right hand value does not equal the left (after any conversions), false otherwise
- Note:
result may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = (14.0).withEpochTime[Day] val t2 = 2.withEpochTime[Week] t1 =!= t2 // => false
- Source:
- deltaquantity.scala
test this delta-quantity for equality with another
test this delta-quantity for equality with another
- Type parameters:
- UR
unit type of the right hand quantity
- VR
value type of the right hand quantity
- Value parameters:
- qr
the right hand quantity
- Returns:
true if right hand value equals the left (after any conversions), false otherwise
- Note:
result may depend on what algebras, policies, and other typeclasses are in scope
- Example:
val t1 = (14.0).withEpochTime[Day] val t2 = 2.withEpochTime[Week] t1 === t2 // => true
- Source:
- deltaquantity.scala
- Source:
- deltaquantity.scala
returns a string representing this DeltaQuantity, using unit abbreviations
returns a string representing this DeltaQuantity, using unit abbreviations
- Example:
val t = (37.0).withTemperature[Celsius] t.show // => "37.0 °C"
- Source:
- deltaquantity.scala
returns a string representing this DeltaQuantity, using full unit names
returns a string representing this DeltaQuantity, using full unit names
- Example:
val t = (37.0).withTemperature[Celsius] t.showFull // => "37.0 celsius"
- Source:
- deltaquantity.scala
convert a delta-quantity to a new unit type, using an integer value type
convert a delta-quantity to a new unit type, using an integer value type
- Type parameters:
- U
the new unit type
- Returns:
a new
DeltaQuantity
having unit typeU
- Note:
attempting to convert to an incompatible unit will result in a compile error
- Example:
val t = 37.withTemperature[Celsius] t.tToUnit[Fahrenheit] // => Temperature[Int, Fahrenheit](98)
- Source:
- deltaquantity.scala
convert a delta-quantity from a fractional value type to an integer type
convert a delta-quantity from a fractional value type to an integer type
- Type parameters:
- V
the new value type to use
- Returns:
a new
DeltaQuantity
having value typeV
- Example:
val t = (98.6).withTemperature[Fahrenheit] t.tToValue[Int] // => Temperature[Int, Fahrenheit](98)
- Source:
- deltaquantity.scala
convert a delta-quantity to a new unit type
convert a delta-quantity to a new unit type
- Type parameters:
- U
the new unit type
- Returns:
a new
DeltaQuantity
having unit typeU
- Note:
attempting to convert to an incompatible unit will result in a compile error
- Example:
val t = 37d.withTemperature[Celsius] t.toUnit[Fahrenheit] // => Temperature[Double, Fahrenheit](98.6)
- Source:
- deltaquantity.scala
convert a delta-quantity to a new value type
convert a delta-quantity to a new value type
- Type parameters:
- V
the new value type to use
- Returns:
a new
DeltaQuantity
having value typeV
- Example:
val t = 37.withTemperature[Celsius] t.toValue[Float] // => Temperature[Float, Celsius](37.0)
- Source:
- deltaquantity.scala
extract the raw value of a delta-unit quantity
extract the raw value of a delta-unit quantity
- Returns:
the underlying value, stripped of its unit information
val t = (37.0).withTemperature[Celsius] t.value // => 37.0 val d = (1.0).withEpochTime[Week] d.value // => 1.0
- Source:
- deltaquantity.scala