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 experimental
    Definition Classes
    squants
  • 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

  • Days
  • Frequency
  • FrequencyConversions
  • FrequencyUnit
  • Gigahertz
  • Hertz
  • Hours
  • HoursSquared
  • Kilohertz
  • Megahertz
  • Microseconds
  • Milliseconds
  • Minutes
  • MinutesSquared
  • Nanoseconds
  • RevolutionsPerMinute
  • SecondTimeDerivative
  • SecondTimeIntegral
  • Seconds
  • SecondsSquared
  • Terahertz
  • Time
  • TimeConversions
  • TimeDerivative
  • TimeIntegral
  • TimeSquared
  • TimeSquaredUnit
  • TimeUnit

package time

Source
package.scala
Since

0.1

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. time
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final class Frequency extends Quantity[Frequency] with TimeDerivative[Dimensionless]

    Represents a quantity of frequency, which is the number cycles (count) over time

    Represents a quantity of frequency, which is the number cycles (count) over time

    Since

    0.1

  2. trait FrequencyUnit extends UnitOfMeasure[Frequency] with UnitConverter
  3. trait SecondTimeDerivative[A <: SecondTimeIntegral[_]] extends AnyRef
  4. trait SecondTimeIntegral[A <: SecondTimeDerivative[_]] extends AnyRef
  5. final class Time extends Quantity[Time]

    Represents a quantity of Time

    Represents a quantity of Time

    Since

    0.1

  6. trait TimeDerivative[A <: Quantity[A] with TimeIntegral[_]] extends AnyRef

    Represents a rate of change over time of the integral quantity

    Represents a rate of change over time of the integral quantity

    A

    The type of quantity changing

    Since

    0.1

  7. trait TimeIntegral[A <: Quantity[A] with TimeDerivative[_]] extends AnyRef

    Represents a Quantity type used as the integral of a time derivative

    Represents a Quantity type used as the integral of a time derivative

    A

    The Quantity type for the TimeDerivative for which this is the base

    Since

    0.1

  8. case class TimeSquared(time1: Time, time2: Time) extends Product with Serializable

    Represents an intermediate value used in 2nd derivative time calculations

    Represents an intermediate value used in 2nd derivative time calculations

    Create objects by calling the Time.squared method.

    q1 / TimeSquared(t1, t2) == q1 / t1 / t2 == q1 / (t1 * t2)

    q2 * TimeSquared(t1, t2) == q2 * t1 * t2

    q1 / t1.squared == q1 / t1 / t1

    q2 * t1.squared == q2 * t1 * t1

    where q1 is a second degree time integral and q2 is a second degree time derivative

    time1

    Time

    time2

    Time

    Since

    0.5.1

  9. trait TimeSquaredUnit extends AnyRef
  10. trait TimeUnit extends UnitOfMeasure[Time] with UnitConverter

Value Members

  1. object Days extends TimeUnit
  2. object Frequency extends Dimension[Frequency] with Serializable
  3. object FrequencyConversions
  4. object Gigahertz extends FrequencyUnit with SiUnit
  5. object Hertz extends FrequencyUnit with PrimaryUnit with SiUnit
  6. object Hours extends TimeUnit
  7. object HoursSquared extends TimeSquaredUnit
  8. object Kilohertz extends FrequencyUnit with SiUnit
  9. object Megahertz extends FrequencyUnit with SiUnit
  10. object Microseconds extends TimeUnit with SiUnit
  11. object Milliseconds extends TimeUnit with PrimaryUnit with SiUnit
  12. object Minutes extends TimeUnit
  13. object MinutesSquared extends TimeSquaredUnit
  14. object Nanoseconds extends TimeUnit with SiUnit
  15. object RevolutionsPerMinute extends FrequencyUnit
  16. object Seconds extends TimeUnit with SiBaseUnit
  17. object SecondsSquared extends TimeSquaredUnit
  18. object Terahertz extends FrequencyUnit with SiUnit
  19. object Time extends Dimension[Time] with BaseDimension with Serializable
  20. object TimeConversions
  21. object TimeSquared extends Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped