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 clone(): AnyRef

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

    Permalink

    Implements Ordered.compare

    Implements Ordered.compare

    that

    Quantity

    returns

    Int

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

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

    Permalink

    Divide this quantity by a like quantity

    Divide this quantity by a like quantity

    that

    Quantity

    returns

    Double

  26. def divide(that: Double): A

    Permalink

    Divide this quantity by some number

    Divide this quantity by some number

    that

    Double

    returns

    Quantity

  27. 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)

  28. 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)

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

    Permalink
    Definition Classes
    AnyRef
  30. 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
  31. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. final def getClass(): Class[_]

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

    Permalink

    Override of hashCode

    Override of hashCode

    Definition Classes
    Quantity → AnyRef → Any
  34. 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

  35. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  36. 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

  37. 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

  38. 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

  39. def minus(that: A): A

    Permalink

    Subtract two like quantities

    Subtract two like quantities

    that

    Quantity

    returns

    Quantity

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

    Permalink
    Definition Classes
    AnyRef
  41. def negate: A

    Permalink

    Returns the negative value of this Quantity

    Returns the negative value of this Quantity

    returns

    Quantity

  42. 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

  43. final def notify(): Unit

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

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

    Permalink

    Add two like quantities

    Add two like quantities

    that

    Quantity

    returns

    Quantity

  46. 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

  47. 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

  48. 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

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

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

    Permalink

    Multiply this quantity by some number

    Multiply this quantity by some number

    that

    Double

    returns

    Quantity

  51. 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

  52. 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

  53. 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

  54. 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

  55. 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
  56. 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]

  57. def toTuple: (Double, String)

    Permalink

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

  58. def unary_-(): A

    Permalink
  59. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  62. 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

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

    Permalink

    approx

  64. 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