From 21782a8694f005bdfdb78092d1862dd0ceedb8ac Mon Sep 17 00:00:00 2001 From: Carlos Quiroz Date: Tue, 20 Dec 2016 10:21:00 -0300 Subject: [PATCH] Prepare for release 1.0 --- README.md | 36 ++++++++++++++++++------------------ project/Build.scala | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0ffd9f5a..fd4f02a1 100644 --- a/README.md +++ b/README.md @@ -18,26 +18,26 @@ All types are immutable and thread-safe. [![Join the chat at https://gitter.im/garyKeorkunian/squants](https://badges.gitter.im/garyKeorkunian/squants.svg)](https://gitter.im/garyKeorkunian/squants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ### Current Versions -Current Release: **0.6.2** -([API Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/com/squants/squants_2.11/0.6.2/squants_2.11-0.6.2-javadoc.jar/!/index.html#squants.package)) +Current Release: **1.0.0** +([API Docs](https://oss.sonatype.org/service/local/repositories/releases/archive/org/typelevel/squants_2.11/1.0.0/squants_2.11-1.0.0-javadoc.jar/!/index.html#squants.package)) Development Build: **1.0.0-SNAPSHOT** ([API Docs](https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/typelevel/squants_2.11/1.0.0-SNAPSHOT/squants_2.11-1.0.0-SNAPSHOT-javadoc.jar/!/index.html#squants.package)) [Release History](https://github.com/typelevel/squants/wiki/Release-History) -[![Build Status](https://travis-ci.org/garyKeorkunian/squants.png?branch=master)](https://travis-ci.org/garyKeorkunian/squants) +[![Build Status](https://travis-ci.org/typelevel/squants.png?branch=master)](https://travis-ci.org/typelevel/squants) -Build services provided by [Travis CI](https://travis-ci.com/) +Build services provided by [Travis CI](https://travis-ci.com/) -NOTE - This README reflects the feature set in the branch it can be found. -For more information on feature availability of a specific version see the Release History or the README for a that version +NOTE - This README reflects the feature set in the branch it can be found. +For more information on feature availability of a specific version see the Release History or the README for a that version ## Installation Repository hosting for Squants is provided by [Sonatype](https://oss.sonatype.org/). To use Squants in your SBT project add the following dependency to your build. - "com.squants" %% "squants" % "0.6.2" + "com.squants" %% "squants" % "1.0.0" or "org.typelevel" %% "squants" % "1.0.0-SNAPSHOT" @@ -49,7 +49,7 @@ To use Squants in your Maven project add the following dependency org.typelevel squants_2.11 - 1.0.0-SNAPSHOT + 1.0.0 ``` @@ -101,7 +101,7 @@ val load1: Power = Kilowatts(12) // returns Power(12, Kilowatts) or 12 kW val load2: Power = Megawatts(0.023) // Power: 0.023 MW val sum = load1 + load2 // Power: 35 kW - unit on left side is preserved sum should be(Kilowatts(35)) -sum should be(Megawatts(0.035)) // comparisons automatically convert scale +sum should be(Megawatts(0.035)) // comparisons automatically convert scale ``` works because Kilowatts and Megawatts are both units of Power. Only the scale is @@ -123,7 +123,7 @@ _One may take quantities with different dimensions, and multiply or divide them. Dimensionally correct type conversions are a key feature of Squants. Conversions are implemented by defining relationships between Quantity types using the * and / operators. -The following code demonstrates creating ratio between two quantities of the same dimension, +The following code demonstrates creating ratio between two quantities of the same dimension, resulting in a dimensionless value: ```scala @@ -168,7 +168,7 @@ val loadC = loadA in Gigawatts // Power: 0.0012 GW ``` Sometimes you need to get the numeric value of the quantity in a specific unit -(eg, for submission to an external service that requires a numeric in a specified unit +(eg, for submission to an external service that requires a numeric in a specified unit or to perform analysis beyond Squant's domain) When necessary, the value can be extracted in the desired unit with the `to` method. @@ -216,10 +216,10 @@ that do not use Squants, or require use of more basic types (Double, String) Simple console based conversions (using DSL described below) ```scala -1.kilograms to Pounds // Double: 2.2046226218487757 +1.kilograms to Pounds // Double: 2.2046226218487757 kilogram / pound // Double: 2.2046226218487757 - -2.1.pounds to Kilograms // Double: 0.952543977 + +2.1.pounds to Kilograms // Double: 0.952543977 2.1.pounds / kilogram // Double: 0.952543977 100.C to Fahrenheit // Double: 212.0 @@ -240,7 +240,7 @@ Create an implicit Quantity value to be used as a tolerance in approximations. Then use the `approx` method (or `=~`, `~=`, `≈` operators) like you would use the `equals` method (`==` operator). ```scala -implicit val tolerance = Watts(.1) // implicit Power: 0.1 W +implicit val tolerance = Watts(.1) // implicit Power: 0.1 W val load = Kilowatts(2.0) // Power: 2.0 kW val reading = Kilowatts(1.9999) // Power: 1.9999 kW @@ -302,7 +302,7 @@ val vectorLength = vectorDouble.to(Kilometers) // QuantityVector(1.2 km, 4.3 km ``` Currently dimensional conversions are supported by using the slightly verbose, but flexible map method. - + ```scala val vectorLength = QuantityVector(Kilometers(1.2), Kilometers(4.3), Kilometers(2.3)) val vectorArea = vectorLength.map[Area](_ * Kilometers(2)) // QuantityVector(2.4 km², 8.6 km², 4.6 km²) @@ -319,7 +319,7 @@ val vectorLength = QuantityVector(Kilometers(1.2), Kilometers(4.3), Kilometers(2 val vectorMetersNum = vectorLength.to(Meters) // DoubleVector(1200.0, 4300.0, 2300.0) val vectorMeters = vectorLength.in(Meters) // QuantityVector(1200.0 m, 4300.0 m, 2300.0 m) ``` - + ## Market Package Market Types are similar but not quite the same as other quantities in the library. The primary type, Money, is a Dimensional Quantity, and its Units of Measure are Currencies. @@ -426,7 +426,7 @@ range.foldLeft(10)(0) {(z, r) => ???} ``` NOTE - Because these implementations of foreach, map and fold* take a parameter (the divisor), these methods -are not directly compatible with Scala's for comprehensions. +are not directly compatible with Scala's for comprehensions. To use in a for comprehension, apply the * or / operators as described above to create a Seq from the Range. ```scala diff --git a/project/Build.scala b/project/Build.scala index 69e90181..086950ce 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -5,7 +5,7 @@ import com.typesafe.sbt.osgi.SbtOsgi import com.typesafe.sbt.osgi.SbtOsgi.autoImport._ object Versions { - val Squants = "1.0.0-SNAPSHOT" + val Squants = "1.0.0" val Scala = "2.11.8" val ScalaCross = Seq("2.12.1", "2.11.8", "2.10.6")