Packages

final class Quantity[N, U] extends AnyVal with Serializable

A numeric quantity with an associated unit

N

The value type (Double, Int, etc)

U

The unit type (Second, Byte, Byte %/ Second, etc)

Linear Supertypes
Serializable, AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Quantity
  2. Serializable
  3. AnyVal
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Quantity(value: N)

    value

    the raw (unitless) value stored by this quantity

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. def *[N2, U2](rhs: Quantity[N2, U2])(implicit um: UnitMul[N, U, N2, U2]): Quantity[N, RT]

    Compute the product of two quantities

    Compute the product of two quantities

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity.

    rhs

    the right hand quantity in the product.

    returns

    this*rhs, with value type N and unit type U*U2.

  4. def +[N2, U2](rhs: Quantity[N2, U2])(implicit ua: UnitAdd[N, U, N2, U2]): Quantity[N, U]

    Compute the sum of two quantities

    Compute the sum of two quantities

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity in the sum.

    returns

    this+rhs, expressed in units (N,U).

  5. def -[N2, U2](rhs: Quantity[N2, U2])(implicit us: UnitSub[N, U, N2, U2]): Quantity[N, U]

    Compute the difference of two quantities

    Compute the difference of two quantities

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity in the difference.

    returns

    this-rhs, expressed in units (N,U).

  6. def /[N2, U2](rhs: Quantity[N2, U2])(implicit ud: UnitDiv[N, U, N2, U2]): Quantity[N, RT]

    Divide this quantity by another

    Divide this quantity by another

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity.

    rhs

    the right hand quantity.

    returns

    this/rhs, with value type N and unit type U/U2.

  7. def <[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if this quantity is less than another

    Test if this quantity is less than another

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if this quantity is less than the right quantity (after conversion to types N,U), false otherwise

  8. def <=[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if this quantity is less than or equal to another

    Test if this quantity is less than or equal to another

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if this quantity is less than or equal to the right quantity (after conversion to types N,U), false otherwise

  9. def =!=[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if two quantities are not equal

    Test if two quantities are not equal

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if rhs is not equal to this quantity (after conversion to types N,U), false otherwise

  10. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  11. def ===[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if two quantities are equal

    Test if two quantities are equal

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if rhs is equal to this quantity (after conversion to types N,U), false otherwise

  12. def >[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if this quantity is greater than another

    Test if this quantity is greater than another

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if this quantity is greater than the right quantity (after conversion to types N,U), false otherwise

  13. def >=[N2, U2](rhs: Quantity[N2, U2])(implicit uc: UnitOrd[N, U, N2, U2]): Boolean

    Test if this quantity is greater than or equal to another

    Test if this quantity is greater than or equal to another

    N2

    the value type of the rhs quantity

    U2

    the unit type of the rhs quantity. Must be convertable to U, or a compile-time type error will result.

    rhs

    the right hand quantity.

    returns

    true if this quantity is greater than or equal to the right quantity (after conversion to types N,U), false otherwise

  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def pow[P](implicit up: UnitPow[N, U, P]): Quantity[N, RT]

    Raise this quantity to an integer power

    Raise this quantity to an integer power

    P

    the literal type representing the integer exponent

    returns

    this quantity raised to power P, with unit type U^P

  18. def show(implicit ustr: UnitString[U]): String

    A string representation of this quantity, using unit abbreviations

  19. def showFull(implicit ustr: UnitString[U]): String

    A string representation of this quantity, using full unit names

  20. def showUnit(implicit ustr: UnitString[U]): String

    A string representation of this quantity's associated unit, using abbreviations

  21. def showUnitFull(implicit ustr: UnitString[U]): String

    A String representation of this quantity's associated unit, using full names

  22. def to[N2, U2](implicit uc: UnitConverter[N, U, N2, U2]): Quantity[N2, U2]

    Equivalent to this.toUnit[U2].toValue[N2]

    Equivalent to this.toUnit[U2].toValue[N2]

    N2

    the value type to convert to.

    U2

    the new units to convert to. Must be convertable to U, or a compile-time type error will result.

    returns

    a quantity equivalent to this but with value type N2 and units U2

  23. def toString(): String
    Definition Classes
    Quantity → Any
  24. def toUnit[U2](implicit uc: UnitConverter[N, U, N, U2]): Quantity[N, U2]

    Obtain a quantity that is equivalent to this but with different compatible units

    Obtain a quantity that is equivalent to this but with different compatible units

    U2

    the new units to convert to. Must be convertable to U, or a compile-time type error will result.

    returns

    a quantity equivalent to this, but with units U2

  25. def toValue[N2](implicit uc: UnitConverter[N, U, N2, U]): Quantity[N2, U]

    Obtain a quantity equivalent to this but with a different value type

    Obtain a quantity equivalent to this but with a different value type

    N2

    the value type to convert to.

    returns

    a quantity equivalent to this but with value type N2 and units U

  26. def unary_-(implicit n: UnitNeg[N]): Quantity[N, U]

    Obtain a quantity with the same unit but negated numeric value

  27. val value: N

Inherited from Serializable

Inherited from AnyVal

Inherited from Any

Ungrouped