Packages

  • package root
    Definition Classes
    root
  • package squants

    The Scala API for Quantities, Units of Measure and Dimensional Analysis

    Squants

    The Scala API for Quantities, Units of Measure and Dimensional Analysis

    Overview

    Squants is a framework of data types and a domain specific language (DSL) for representing Quantities, their Units of Measure, and their Dimensional relationships. The API supports typesafe dimensional analysis, improved domain models and more. All types are immutable and thread-safe.

    Typedefs and implicits for common usages

    Definition Classes
    root
    Version

    0.1

    Since

    0.1

  • package electro

    Definition Classes
    squants
    Since

    0.1

  • package energy

    Definition Classes
    squants
    Since

    0.1

  • package information
    Definition Classes
    squants
  • package market

    Squants Market API

    Squants Market API

    Market Types are similar but not quite the same as other quantities in the library.

    The primary type, squants.market.Money, is derived from Quantity, and its Units of Measure are Currencies. However, because the conversion multipliers between units can not be predefined, many of the behaviors have been overridden and augmented to realize correct behavior.

    squants.market.Prices represent a Ratio between Money and some other Quantity. Prices can be created from ratios of Money and a Quantity

    val money: Money = USD(10)
    val length: Length = Meters(1)
    val price: Price[Length] = money / length

    Multiplying a Price * Quantity will yield Money amount that represents the cost of the quantity

    val cost: Money = price * Meters(3.8)

    and multiplying Price * Money will yield the corresponding Quantity amount

    val budget: Money = USD(250)
    val quote: Length = price * budget

    squants.market.CurrencyExchangeRates represent conversion rates between currencies. Use them to explicitly convert Money values in one currency to values in another.

    squants.market.MoneyContext provide the implicit context necessary to perform cross-currency operations on Money values with conversions automatically applied.

    Some binary math operations will work on Moneys of like Currency with no MoneyContext in scope. Attempts to perform these operations on Moneys of dissimilar currencies will throw an exception at runtime.

    Other operations, including direct conversions to other currencies, require a MoneyContext and will not compile without it. However, there is no compile time check to determine if the correct exchange rates will be available at runtime. Operation requiring conversion without the required rates available will throw a NoSuchExchangeRateException at runtime.

    The defaultMoneyContext uses the USD as the default and provides a list of ~20 common currencies, and NO exchange rates. If your application requires something different you should initialize your own implicit MoneyContext

    Definition Classes
    squants
    Since

    0.1

  • package mass

    Definition Classes
    squants
    Since

    0.1

  • package motion

    Definition Classes
    squants
    Since

    0.1

  • package photo

    Definition Classes
    squants
    Since

    0.1

  • package radio

    Definition Classes
    squants
    Since

    0.1

  • package space

    Definition Classes
    squants
    Since

    0.1

  • package thermal

    Definition Classes
    squants
    Since

    0.1

  • package time

    Definition Classes
    squants
    Since

    0.1

  • AbstractQuantityNumeric
  • BaseDimension
  • BinarySystem
  • Dimension
  • Dimensionless
  • DimensionlessConversions
  • DimensionlessUnit
  • DoubleVector
  • Dozen
  • Each
  • Gross
  • LikeRatio
  • MetricSystem
  • Percent
  • Platform
  • PrimaryUnit
  • Quantity
  • QuantityParseException
  • QuantityRange
  • QuantityVector
  • Ratio
  • SVector
  • Score
  • SiBaseUnit
  • SiUnit
  • SquantifiedBigDecimal
  • SquantifiedDouble
  • SquantifiedInt
  • SquantifiedLong
  • UnitConverter
  • UnitOfMeasure
c

squants

QuantityVector

case class QuantityVector[A <: Quantity[A]](coordinates: A*) extends SVector[A] with Product with Serializable

Quantity Vector

A

QuantityType

coordinates

Variable list of A

Source
SVector.scala
Since

0.3.0

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. QuantityVector
  2. Serializable
  3. Product
  4. Equals
  5. SVector
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new QuantityVector(coordinates: A*)

    coordinates

    Variable list of A

Type Members

  1. type SVectorType = QuantityVector[A]
    Definition Classes
    QuantityVectorSVector

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def #*: (DoubleVector) => SVector[A]
    Definition Classes
    SVector
  4. def *(that: DoubleVector): A
    Definition Classes
    SVector
  5. def *(that: Double): SVectorType
    Definition Classes
    SVector
  6. def +: (SVectorType) => SVectorType
    Definition Classes
    SVector
  7. def -: (SVectorType) => SVectorType
    Definition Classes
    SVector
  8. def /(that: A): DoubleVector
  9. def /(that: Double): SVectorType
    Definition Classes
    SVector
  10. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def angle(coordinateX: Int = 0, coordinateY: Int = 1, unit: AngleUnit = Radians): Angle

    The angle between the two Cartesian coordinates at the supplied indices

    The angle between the two Cartesian coordinates at the supplied indices

    coordinateX

    index of the abscissa coordinate (defaults to 0)

    coordinateY

    index of the ordinate coordinate (defaults to 1)

    unit

    unit for the angle (theta) component (defaults to Radians)

    returns

    Angle

    Definition Classes
    QuantityVectorSVector
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  14. val coordinates: A*

    The list of values that makeup the Vector's Cartesian coordinates

    The list of values that makeup the Vector's Cartesian coordinates

    Definition Classes
    QuantityVectorSVector
  15. def crossProduct[B <: Quantity[B], C <: Quantity[C]](that: SVector[B], quantTimes: (A, B) => C): QuantityVector[C]
  16. def crossProduct(that: DoubleVector): SVectorType

    Create the Cross Product of two Vectors

    Create the Cross Product of two Vectors

    that

    Vector[A]

    Definition Classes
    QuantityVectorSVector
  17. def divide[B <: Quantity[B], C <: Quantity[C]](quantDiv: (A) => C): QuantityVector[C]
  18. def divide(that: A): DoubleVector
  19. def divide(that: Double): SVectorType

    Reduce a Vector

    Reduce a Vector

    that

    Double

    Definition Classes
    QuantityVectorSVector
  20. def dotProduct[B <: Quantity[B], C <: Quantity[C]](that: SVector[B], quantTimes: (A, B) => C)(implicit num: Numeric[C]): C
  21. def dotProduct(that: DoubleVector): A

    Create the Dot Product of two Vectors

    Create the Dot Product of two Vectors

    that

    Double

    Definition Classes
    QuantityVectorSVector
  22. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def in(uom: UnitOfMeasure[A]): QuantityVector[A]

    Returns a QuantityVector with all coordinates set to the supplied unit

    Returns a QuantityVector with all coordinates set to the supplied unit

    uom

    UnitOfMeasure[A]

  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. def magnitude: A

    The scalar value of the Vector

    The scalar value of the Vector

    Definition Classes
    QuantityVectorSVector
  28. def map[B <: Quantity[B]](f: (A) => B): QuantityVector[B]

    Creates a QuantityVector by mapping over each coordinate with the supplied function

    Creates a QuantityVector by mapping over each coordinate with the supplied function

    B

    <: Quantity

    f

    A => B

  29. def map[B <: Double](f: (A) => Double): DoubleVector

    Creates a DoubleVector by mapping over each coordinate with the supplied function

    Creates a DoubleVector by mapping over each coordinate with the supplied function

    f

    A => Double map function

  30. def minus(that: SVectorType): SVectorType

    Subtract two Vectors

    Subtract two Vectors

    that

    Vector[A]

    Definition Classes
    QuantityVectorSVector
  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. def normalize(unit: UnitOfMeasure[A]): SVectorType

    Creates the Unit Vector which corresponds to this vector using the given unit

  33. def normalize: SVectorType

    Creates the Unit Vector which corresponds to this vector

    Creates the Unit Vector which corresponds to this vector

    Definition Classes
    QuantityVectorSVector
  34. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  35. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. def plus(that: SVectorType): SVectorType

    Add two Vectors

    Add two Vectors

    that

    Vector[A]

    Definition Classes
    QuantityVectorSVector
  37. def polar(coordinateX: Int = 0, coordinateY: Int = 1, unit: AngleUnit = Radians): (A, Angle)

    The polar coordinates (r, theta) of the two Cartesian coordinates at the supplied indices

    The polar coordinates (r, theta) of the two Cartesian coordinates at the supplied indices

    coordinateX

    index of the abscissa coordinate (defaults to 0)

    coordinateY

    index of the ordinate coordinate (defaults to 1)

    unit

    unit for the angle (theta) component (defaults to Radians)

    returns

    (A, Angle)

    Definition Classes
    SVector
  38. def productElementNames: Iterator[String]
    Definition Classes
    Product
  39. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  40. def times[B <: Quantity[B], C <: Quantity[C]](quantTimes: (A) => C): QuantityVector[C]
  41. def times(that: Double): SVectorType

    Scale a Vector

    Scale a Vector

    that

    Double

    Definition Classes
    QuantityVectorSVector
  42. def to(uom: UnitOfMeasure[A]): DoubleVector

    Returns a DoubleVector representing the quantity values in terms of the supplied unit

    Returns a DoubleVector representing the quantity values in terms of the supplied unit

    uom

    UnitOfMeasure[A]

  43. def valueUnit: UnitOfMeasure[A]
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from SVector[A]

Inherited from AnyRef

Inherited from Any

Ungrouped