From 2b3883266f1061b15888d588f6a8cd7534d0f307 Mon Sep 17 00:00:00 2001 From: Werner Keil Date: Sun, 12 May 2019 23:47:54 +0200 Subject: [PATCH] 192: Public Review delivery Task-Url: https://github.com/unitsofmeasurement/unit-api/issues/issues/192 --- src/main/java/javax/measure/Unit.java | 22 +++++++++---------- .../java/javax/measure/UnitConverter.java | 18 ++++++--------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/main/java/javax/measure/Unit.java b/src/main/java/javax/measure/Unit.java index f4482398..4a15bd4e 100644 --- a/src/main/java/javax/measure/Unit.java +++ b/src/main/java/javax/measure/Unit.java @@ -67,7 +67,7 @@ * @author Steve Emmerson * @author Martin Desruisseaux * @author Werner Keil - * @version 2.0, April 24, 2019 + * @version 2.1, May 12, 2019 * @since 1.0 * * @see Wikipedia: Units of measurement @@ -136,7 +136,7 @@ public interface Unit> { /** * Indicates if this unit is compatible with the unit specified. Units don't need to be equals to be compatible. For example (assuming {@code ONE} - * is a dimensionless unit): + * is a dimensionless unit):
* * * RADIAN.equals(ONE) == false
@@ -153,7 +153,7 @@ public interface Unit> { /** * Casts this unit to a parameterized unit of specified nature or throw a {@code ClassCastException} if the dimension of the specified quantity and - * this unit's dimension do not match. For example: + * this unit's dimension do not match. For example:
* * * {@literal Unit} C = METRE.multiply(299792458).divide(SECOND).asType(Speed.class); @@ -234,7 +234,7 @@ public interface Unit> { /** * Returns the result of setting the origin of the scale of measurement to the given value. The returned unit is convertible with all units that are - * convertible with this unit. For example the following code: + * convertible with this unit. For example the following code:
* * * CELSIUS = KELVIN.shift(273.15); @@ -252,7 +252,7 @@ public interface Unit> { /** * Returns the result of setting the origin of the scale of measurement to the given value. The returned unit is convertible with all units that are - * convertible with this unit. For example the following code: + * convertible with this unit. For example the following code:
* * * CELSIUS = KELVIN.shift(273.15); @@ -269,10 +269,10 @@ public interface Unit> { /** * Returns the result of multiplying this unit by the specified factor. If the factor is an integer value, the multiplication is exact - * (recommended). For example: + * (recommended). For example:
* * - * FOOT = METRE.multiply(3048).divide(10000); // Exact definition. + * FOOT = METRE.multiply(3048).divide(10000); // Exact definition.
* ELECTRON_MASS = KILOGRAM.multiply(9.10938188e-31); // Approximation. *
* @@ -284,10 +284,10 @@ public interface Unit> { Unit multiply(Number multiplier); /** - * Returns the result of multiplying this unit by the specified factor. For example: + * Returns the result of multiplying this unit by the specified factor. For example:
* * - * FOOT = METRE.multiply(3048).divide(10000); // Exact definition. + * FOOT = METRE.multiply(3048).divide(10000); // Exact definition.
* ELECTRON_MASS = KILOGRAM.multiply(9.10938188e-31); // Approximation. *
* @@ -315,7 +315,7 @@ public interface Unit> { Unit inverse(); /** - * Returns the result of dividing this unit by a divisor. If the factor is an integer value, the division is exact. For example: + * Returns the result of dividing this unit by a divisor. If the factor is an integer value, the division is exact. For example:
* * * GRAM = KILOGRAM.divide(1000); // Exact definition. @@ -329,7 +329,7 @@ public interface Unit> { Unit divide(Number divisor); /** - * Returns the result of dividing this unit by an approximate divisor. For example: + * Returns the result of dividing this unit by an approximate divisor. For example:
* * * GRAM = KILOGRAM.divide(1000d); diff --git a/src/main/java/javax/measure/UnitConverter.java b/src/main/java/javax/measure/UnitConverter.java index 486549aa..9a6876cd 100644 --- a/src/main/java/javax/measure/UnitConverter.java +++ b/src/main/java/javax/measure/UnitConverter.java @@ -44,7 +44,7 @@ * Desruisseaux * @author Thodoris Bais * @author Andi Huber - * @version 1.3, March 11, 2019 + * @version 1.4, May 12, 2019 * @since 1.0 * * @see Unit @@ -68,7 +68,6 @@ public interface UnitConverter { * vector space (a scalar) to a one-dimensional vector space. Typically from 'R' to 'R', with 'R' the * real numbers. * - *

* Given such a 'linear' converter 'A', let 'u', 'v' and 'r' be arbitrary numbers, then the following * must hold by definition: * @@ -76,9 +75,7 @@ public interface UnitConverter { *

  • {@code A(u + v) == A(u) + A(v)}
  • *
  • {@code A(r * u) == r * A(u)}
  • * - *

    * - *

    * Given a second 'linear' converter 'B', commutativity of composition follows by above definition: * *

      @@ -86,14 +83,13 @@ public interface UnitConverter { *
    * * In other words, two 'linear' converters do have the property that {@code A(B(u)) == B(A(u))}, meaning - * for 'A' and 'B' the order of their composition does not matter. Expressed as Java code: - *

    - *

    - *{@code A.concatenate(B).convert(u) == B.concatenate(A).convert(u)} - *

    - *

    + * for 'A' and 'B' the order of their composition does not matter. Expressed as Java code:
    + *
    + * + *{@code A.concatenate(B).convert(u) == B.concatenate(A).convert(u)}
    + *
    + * * Note: For composing UnitConverters see also {@link UnitConverter#concatenate(UnitConverter)}. - *

    * * @return {@code true} if this converter represents a linear transformation; * {@code false} otherwise.