DeltaQuantity

coulomb.deltaquantity$package$.DeltaQuantity$

Defines DeltaQuantity constructors and extension methods

Attributes

Source:
deltaquantity.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

class Applier[U, B]

A shim class for DeltaQuantity companion object constructors

A shim class for DeltaQuantity companion object constructors

Attributes

Companion:
object
Source:
deltaquantity.scala
Graph
Supertypes
class Object
trait Matchable
class Any
object Applier

Attributes

Companion:
class
Source:
deltaquantity.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Applier.type

Value members

Concrete methods

def apply[U, B](using a: Applier[U, B]): Applier[U, B]

Lift a raw value of type V into a unit quantity

Lift a raw value of type V into a unit quantity

Attributes

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

extension [VL, UL, B](ql: DeltaQuantity[VL, UL, B])
transparent inline def +[VR, UR](qr: Quantity[VR, UR])(using add: DeltaAddQ[B, VL, UL, VR, UR]): DeltaQuantity[VO, UO, B]

add a quantity to this delta-quantity

add a quantity to this delta-quantity

Attributes

UR

right hand unit type

VR

right hand value type

qr

right hand quantity

Returns:

the result of adding qr to this, as a DeltaQuantity value

Note:

unit types UL and UR must be convertable

result 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
transparent inline def -[VR, UR](qr: DeltaQuantity[VR, UR, B])(using sub: DeltaSub[B, VL, UL, VR, UR]): Quantity[VO, UO]

subtract another delta-quantity from this one

subtract another delta-quantity from this one

Attributes

UR

right hand unit type

VR

right hand value type

qr

right hand delta-quantity

Returns:

the result of subtracting qr from this, as a Quantity value

Note:

unit types UL and UR must be convertable

result 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
transparent inline def -[VR, UR](qr: Quantity[VR, UR])(using sub: DeltaSubQ[B, VL, UL, VR, UR]): DeltaQuantity[VO, UO, B]

subtract quantity from this delta-quantity

subtract quantity from this delta-quantity

Attributes

UR

right hand unit type

VR

right hand value type

qr

right hand quantity

Returns:

the result of subtracting qr from this, as a DeltaQuantity value

Note:

unit types UL and UR must be convertable

result 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
inline def <[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

test if this delta-quantity is less than another

test if this delta-quantity is less than another

Attributes

UR

unit type of the right hand quantity

VR

value type of the right hand quantity

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
inline def <=[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

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

Attributes

UR

unit type of the right hand quantity

VR

value type of the right hand quantity

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
inline def =!=[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

test this delta-quantity for inequality with another

test this delta-quantity for inequality with another

Attributes

UR

unit type of the right hand quantity

VR

value type of the right hand quantity

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
inline def ===[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

test this delta-quantity for equality with another

test this delta-quantity for equality with another

Attributes

UR

unit type of the right hand quantity

VR

value type of the right hand quantity

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
inline def >[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

Attributes

Source:
deltaquantity.scala
inline def >=[VR, UR](qr: DeltaQuantity[VR, UR, B])(using ord: DeltaOrd[B, VL, UL, VR, UR]): Boolean

Attributes

Source:
deltaquantity.scala
inline def show: String

returns a string representing this DeltaQuantity, using unit abbreviations

returns a string representing this DeltaQuantity, using unit abbreviations

Attributes

Example:
val t = (37.0).withTemperature[Celsius]
t.show // => "37.0 °C"
Source:
deltaquantity.scala
inline def showFull: String

returns a string representing this DeltaQuantity, using full unit names

returns a string representing this DeltaQuantity, using full unit names

Attributes

Example:
val t = (37.0).withTemperature[Celsius]
t.showFull // => "37.0 celsius"
Source:
deltaquantity.scala
inline def tToUnit[U](using conv: TruncatingDeltaUnitConversion[VL, B, UL, U]): DeltaQuantity[VL, U, B]

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

Attributes

U

the new unit type

Returns:

a new DeltaQuantity having unit type U

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
inline def tToValue[V](using conv: TruncatingValueConversion[VL, V]): DeltaQuantity[V, UL, B]

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

Attributes

V

the new value type to use

Returns:

a new DeltaQuantity having value type V

Example:
val t = (98.6).withTemperature[Fahrenheit]
t.tToValue[Int] // => Temperature[Int, Fahrenheit](98)
Source:
deltaquantity.scala
inline def toUnit[U](using conv: DeltaUnitConversion[VL, B, UL, U]): DeltaQuantity[VL, U, B]

convert a delta-quantity to a new unit type

convert a delta-quantity to a new unit type

Attributes

U

the new unit type

Returns:

a new DeltaQuantity having unit type U

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
inline def toValue[V](using conv: ValueConversion[VL, V]): DeltaQuantity[V, UL, B]

convert a delta-quantity to a new value type

convert a delta-quantity to a new value type

Attributes

V

the new value type to use

Returns:

a new DeltaQuantity having value type V

Example:
val t = 37.withTemperature[Celsius]
t.toValue[Float] // => Temperature[Float, Celsius](37.0)
Source:
deltaquantity.scala
inline def value: VL

extract the raw value of a delta-unit quantity

extract the raw value of a delta-unit quantity

Attributes

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