Class

squants

Quantity

Related Doc: package squants

Permalink

abstract class Quantity[A <: Quantity[A]] extends Serializable with Ordered[A]

A base class for measurable quantities, instances of which contain a value and a unit

Self Type
A
Source
Quantity.scala
Since

0.1

Linear Supertypes
Ordered[A], Comparable[A], Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Quantity
  2. Ordered
  3. Comparable
  4. Serializable
  5. Serializable
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Quantity()

    Permalink

Abstract Value Members

  1. abstract def dimension: Dimension[A]

    Permalink

    The Dimension this quantity represents

  2. abstract def unit: UnitOfMeasure[A]

    Permalink

    The Unit of Measure the value represents

    The Unit of Measure the value represents

    returns

    UnitOfMeasure[A]

  3. abstract def value: Double

    Permalink

    The value of the quantity given the unit

    The value of the quantity given the unit

    returns

    Double

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def %(that: A): Double

    Permalink
  4. def %(that: Double): A

    Permalink
  5. def *(that: Double): A

    Permalink
  6. def +(that: A): A

    Permalink
  7. def +-(that: A): QuantityRange[A]

    Permalink
  8. def -(that: A): A

    Permalink
  9. def /(that: A): Double

    Permalink
  10. def /(that: Double): A

    Permalink
  11. def /%(that: A): (Double, A)

    Permalink
  12. def /%(that: Double): (A, A)

    Permalink
  13. def <(that: A): Boolean

    Permalink
    Definition Classes
    Ordered
  14. def <=(that: A): Boolean

    Permalink
    Definition Classes
    Ordered
  15. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def =~(that: A)(implicit tolerance: A): Boolean

    Permalink

    approx

  17. def >(that: A): Boolean

    Permalink
    Definition Classes
    Ordered
  18. def >=(that: A): Boolean

    Permalink
    Definition Classes
    Ordered
  19. def abs: A

    Permalink

    Returns the absolute value of this Quantity

    Returns the absolute value of this Quantity

    returns

    Quantity

  20. def approx(that: A)(implicit tolerance: A): Boolean

    Permalink

    Returns boolean result of approximate equality comparison

    Returns boolean result of approximate equality comparison

    that

    Quantity

    tolerance

    Quantity

  21. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  22. def ceil: A

    Permalink

    Returns the smallest (closest to negative infinity) Quantity value that is greater than or equal to the argument and is equal to a mathematical integer.

    Returns the smallest (closest to negative infinity) Quantity value that is greater than or equal to the argument and is equal to a mathematical integer.

    returns

    Quantity

    See also

    java.lang.Math#ceil(double)

  23. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. def compare(that: A): Int

    Permalink

    Implements Ordered.compare

    Implements Ordered.compare

    that

    Quantity

    returns

    Int

    Definition Classes
    Quantity → Ordered
  25. def compareTo(that: A): Int

    Permalink
    Definition Classes
    Ordered → Comparable
  26. def divide(that: A): Double

    Permalink

    Divide this quantity by a like quantity

    Divide this quantity by a like quantity

    that

    Quantity

    returns

    Double

  27. def divide(that: Double): A

    Permalink

    Divide this quantity by some number

    Divide this quantity by some number

    that

    Double

    returns

    Quantity

  28. def divideAndRemainder(that: A): (Double, A)

    Permalink

    Returns a Pair that includes the result of divideToInteger and remainder

    Returns a Pair that includes the result of divideToInteger and remainder

    that

    Quantity

    returns

    (Double, Quantity)

  29. def divideAndRemainder(that: Double): (A, A)

    Permalink

    Returns a Pair that includes the result of divideToInteger and remainder

    Returns a Pair that includes the result of divideToInteger and remainder

    that

    Double

    returns

    (Quantity, Quantity)

  30. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. def equals(that: Any): Boolean

    Permalink

    Override of equals method

    Override of equals method

    that

    must be of matching value and unit

    Definition Classes
    Quantity → AnyRef → Any
  32. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. def floor: A

    Permalink

    Returns the largest (closest to positive infinity) Quantity value that is less than or equal to the argument and is equal to a mathematical integer

    Returns the largest (closest to positive infinity) Quantity value that is less than or equal to the argument and is equal to a mathematical integer

    returns

    Quantity

    See also

    java.lang.Math#floor(double)

  34. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  35. def hashCode(): Int

    Permalink

    Override of hashCode

    Override of hashCode

    Definition Classes
    Quantity → AnyRef → Any
  36. def in(uom: UnitOfMeasure[A]): A

    Permalink

    Returns an equivalent Quantity boxed with the supplied Unit

    Returns an equivalent Quantity boxed with the supplied Unit

    uom

    UnitOfMeasure[A]

    returns

    Quantity

  37. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  38. def map(f: (Double) ⇒ Double): A

    Permalink

    Applies a function to the underlying value of the Quantity, returning a new Quantity in the same unit

    Applies a function to the underlying value of the Quantity, returning a new Quantity in the same unit

    f

    Double => Double function

  39. def max(that: A): A

    Permalink

    Returns the max of this and that Quantity

    Returns the max of this and that Quantity

    that

    Quantity

    returns

    Quantity

  40. def min(that: A): A

    Permalink

    Returns the min of this and that Quantity

    Returns the min of this and that Quantity

    that

    Quantity

    returns

    Quantity

  41. def minus(that: A): A

    Permalink

    Subtract two like quantities

    Subtract two like quantities

    that

    Quantity

    returns

    Quantity

  42. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. def negate: A

    Permalink

    Returns the negative value of this Quantity

    Returns the negative value of this Quantity

    returns

    Quantity

  44. def notWithin(range: QuantityRange[A]): Boolean

    Permalink

    Returns true if this value is not within (contains) the range

    Returns true if this value is not within (contains) the range

    range

    QuantityRange

    returns

    Boolean

  45. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  46. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. def plus(that: A): A

    Permalink

    Add two like quantities

    Add two like quantities

    that

    Quantity

    returns

    Quantity

  48. def plusOrMinus(that: A): QuantityRange[A]

    Permalink

    Returns a QuantityRange representing the range for this value +- that

    Returns a QuantityRange representing the range for this value +- that

    that

    Quantity

    returns

    QuantityRange

  49. def remainder(that: A): Double

    Permalink

    Returns the remainder of a division by a like quantity

    Returns the remainder of a division by a like quantity

    that

    Quantity

    returns

    Double

  50. def remainder(that: Double): A

    Permalink

    Returns the remainder of a division by a number

    Returns the remainder of a division by a number

    that

    Quantity

    returns

    Quantity

  51. def rint: A

    Permalink

    Returns the Quantity value that is closest in value to the argument and is equal to a mathematical integer.

    Returns the Quantity value that is closest in value to the argument and is equal to a mathematical integer.

    returns

    Quantity

    See also

    java.lang.Math#rint(double)

  52. def rounded(scale: Int, mode: RoundingMode = RoundingMode.HALF_EVEN): A

    Permalink

    Returns the Quantity with its coefficient value rounded using scale and mode.

    Returns the Quantity with its coefficient value rounded using scale and mode. The unit is maintained.

    scale

    Int - scale of the value to be returned

    mode

    RoundingMode - defaults to HALF_EVEN

    returns

    Quantity

  53. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  54. def times(that: Double): A

    Permalink

    Multiply this quantity by some number

    Multiply this quantity by some number

    that

    Double

    returns

    Quantity

  55. def to(uom: UnitOfMeasure[A]): Double

    Permalink

    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)
    uom

    UnitOfMeasure[A]

    returns

    Double

  56. def to(that: A): QuantityRange[A]

    Permalink

    Returns a QuantityRange that goes from this to that

    Returns a QuantityRange that goes from this to that

    that

    Quantity

    returns

    QuantityRange

  57. def toString(uom: UnitOfMeasure[A], format: String): String

    Permalink

    Returns a string representing the quantity's value in the given unit in the given format

    Returns a string representing the quantity's value in the given unit in the given format

    uom

    UnitOfMeasure[A] with UnitConverter

    format

    String containing the format for the value (ie "%.3f")

    returns

    String

  58. def toString(uom: UnitOfMeasure[A]): String

    Permalink

    Returns a string representing the quantity's value in the given unit

    Returns a string representing the quantity's value in the given unit

    uom

    UnitOfMeasure[A] with UnitConverter

    returns

    String

  59. def toString(): String

    Permalink

    Returns a string representing the quantity's value in unit

    Returns a string representing the quantity's value in unit

    returns

    String

    Definition Classes
    Quantity → AnyRef → Any
  60. def toTuple(uom: UnitOfMeasure[A]): (Double, String)

    Permalink

    Returns a pair representing the numeric value and the uom's symbol

    Returns a pair representing the numeric value and the uom's symbol

    uom

    UnitOfMeasure[A]

  61. def toTuple: (Double, String)

    Permalink

    Returns a tuple representing the numeric value and the unit's symbol

  62. def unary_-(): A

    Permalink
  63. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. def within(range: QuantityRange[A]): Boolean

    Permalink

    Returns true if this value is within (contains) the range

    Returns true if this value is within (contains) the range

    range

    QuantityRange

    returns

    Boolean

  67. def ~=(that: A)(implicit tolerance: A): Boolean

    Permalink

    approx

  68. def (that: A)(implicit tolerance: A): Boolean

    Permalink

    approx

Inherited from Ordered[A]

Inherited from Comparable[A]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped