sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1768102 [3/3] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-feature/src/test/java/org/apache/sis/feature/builder/ core/sis-referencing/src/main/java/org/apache/sis/geometry/ core/sis-referencin...
Date Fri, 04 Nov 2016 21:16:09 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/package-info.java [UTF-8]
Fri Nov  4 21:16:09 2016
@@ -16,18 +16,44 @@
  */
 
 /**
- * Measures (like {@link org.apache.sis.measure.Angle} and
- * {@link org.apache.sis.measure.Range}) and their formatters.
- * This package defines:
+ * Units of measurements, values related to measurement (like angles and ranges) and their
formatters.
+ * A key class in this package is {@link org.apache.sis.measure.Units}, which provides static
constants
+ * for about 50 units of measurement including all the SI base units
+ * ({@linkplain org.apache.sis.measure.Units#METRE    metre},
+ *  {@linkplain org.apache.sis.measure.Units#KILOGRAM kilogram}
+ *  {@linkplain org.apache.sis.measure.Units#SECOND   second},
+ *  {@linkplain org.apache.sis.measure.Units#AMPERE   ampere},
+ *  {@linkplain org.apache.sis.measure.Units#KELVIN   kelvin},
+ *  {@linkplain org.apache.sis.measure.Units#MOLE     mole} and
+ *  {@linkplain org.apache.sis.measure.Units#CANDELA  candela})
+ * together with some derived units
+ * ({@linkplain org.apache.sis.measure.Units#SQUARE_METRE      square metre},
+ *  {@linkplain org.apache.sis.measure.Units#CUBIC_METRE       cubic metre},
+ *  {@linkplain org.apache.sis.measure.Units#METRES_PER_SECOND metres per second},
+ *  {@linkplain org.apache.sis.measure.Units#HERTZ             hertz},
+ *  {@linkplain org.apache.sis.measure.Units#PASCAL            pascal},
+ *  {@linkplain org.apache.sis.measure.Units#NEWTON            newton},
+ *  {@linkplain org.apache.sis.measure.Units#JOULE             joule},
+ *  {@linkplain org.apache.sis.measure.Units#WATT              watt},
+ *  {@linkplain org.apache.sis.measure.Units#TESLA             tesla},
+ *  <i>etc.</i>)
+ * and some dimensionless units
+ * ({@linkplain org.apache.sis.measure.Units#RADIAN    radian},
+ *  {@linkplain org.apache.sis.measure.Units#STERADIAN steradian},
+ *  {@linkplain org.apache.sis.measure.Units#PIXEL     pixel},
+ *  {@linkplain org.apache.sis.measure.Units#UNITY     unity}).
+ *
+ * In relation to units of measurement, this package also defines:
  *
  * <ul>
  *   <li>{@link org.apache.sis.measure.Angle} and its subclasses
  *      ({@link org.apache.sis.measure.Longitude},
- *       {@link org.apache.sis.measure.Latitude})</li>
+ *       {@link org.apache.sis.measure.Latitude},
+ *       {@link org.apache.sis.measure.ElevationAngle})</li>
  *   <li>{@link org.apache.sis.measure.Range} and its subclasses
  *      ({@link org.apache.sis.measure.NumberRange},
  *       {@link org.apache.sis.measure.MeasurementRange}) or annotation
- *      ({@link org.apache.sis.measure.ValueRange}</li>
+ *      ({@link org.apache.sis.measure.ValueRange})</li>
  *   <li>Formatters
  *      ({@link org.apache.sis.measure.AngleFormat},
  *       {@link org.apache.sis.measure.CoordinateFormat},

Modified: sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties
[UTF-8] Fri Nov  4 21:16:09 2016
@@ -3,6 +3,7 @@
 # "degrees", "metres" and "meters" are handled as special cases.
 arcsec=\u2033
 days=d
+decibars=dbar
 decimal\ degree=�
 degree\ celsius=�C
 degree\ kelvin=\u212a
@@ -17,6 +18,9 @@ gradian=grad
 gradians=grad
 grads=grad
 hours=h
+mbar=hPa
+millibar=hPa
+millibars=hPa
 minutes=min
 radians=rad
 seconds=s

Modified: sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties
[ISO-8859-1] Fri Nov  4 21:16:09 2016
@@ -1,25 +1,34 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 A=ampere
 a=year
+atm=atmosphere
+C=coulomb
 cd=candela
 cm=centimetre
 d=day
+dbar=decibar
+F=farad
 ft=foot
 ft_US=US survey foot
 grad=grad
 h=hour
 ha=hectare
 hPa=hectopascal
+H=henry
 Hz=hertz
 in=inch
 J=joule
 \u212a=kelvin
 kg=kilogram
 km=kilometre
+km\u2215h=kilometres per hour
+lm=lumen
+lx=lux
 M=nautical mile
 m=metre
 m²=square metre
 m³=cubic metre
+m\u2215s=metres per second
 mi=statute mile
 min=minute
 mm=millimetre
@@ -29,15 +38,24 @@ N=newton
 nm=nanometre
 Pa=pascal
 ppm=parts per million
+psu=practical salinity unit
 pt=point
 px=pixel
 rad=radian
 s=second
+S=siemens
+sr=steradian
+T=tesla
 unity=unity
+V=volt
 W=watt
+Wb=weber
 wk=week
+µrad=microradian
+\u03a9=ohm
 %=percentage
 °=degree
 \u2032=arc-minute
 \u2033=arc-second
 °C=Celsius
+°F=Fahrenheit

Modified: sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties
[ISO-8859-1] Fri Nov  4 21:16:09 2016
@@ -1,6 +1,7 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 A=ampère
 a=année
+atm=atmosphère
 cm=centimètre
 d=jour
 ft=pied
@@ -9,20 +10,19 @@ h=heure
 in=pouce
 kg=kilogramme
 km=kilomètre
+km\u2215h=kilomètres par heure
 M=mille marin international
 m=mètre
 m²=mètre carré
 m³=mètre cube
+m\u2215s=mètres par seconde
 mi=mille terrestre international
-min=minute
 mm=millimètre
 ms=milliseconde
 nm=nanomètre
 ppm=parties par million
-pt=point
-px=pixel
-rad=radian
 s=seconde
+sr=stéradian
 unity=unité
 wk=semaine
 %=pourcentage

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ConventionalUnitTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ConventionalUnitTest.java?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ConventionalUnitTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ConventionalUnitTest.java
[UTF-8] Fri Nov  4 21:16:09 2016
@@ -229,6 +229,17 @@ public final strictfp class Conventional
     }
 
     /**
+     * Tests conversion of a temperature value between two conventional units.
+     */
+    @Test
+    public void testConvertTemperature() {
+        final UnitConverter c = Units.FAHRENHEIT.getConverterTo(Units.CELSIUS);
+        assertEquals("50°F",  10, c.convert(50),          STRICT);
+        assertEquals("5°F",  -15, c.convert(5),           STRICT);
+        assertEquals("0°C",   32, c.inverse().convert(0), STRICT);
+    }
+
+    /**
      * Serializes some units, deserializes them and verifies that we get the same instance.
      */
     @Test

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8]
Fri Nov  4 21:16:09 2016
@@ -57,52 +57,67 @@ public final strictfp class UnitFormatTe
                 declared.add(f.getName());
             }
         }
-        verify(declared, "NANOMETRE",           "L",        "nm",    Units.NANOMETRE);
-        verify(declared, "MILLIMETRE",          "L",        "mm",    Units.MILLIMETRE);
-        verify(declared, "CENTIMETRE",          "L",        "cm",    Units.CENTIMETRE);
-        verify(declared, "METRE",               "L",        "m",     Units.METRE);
-        verify(declared, "KILOMETRE",           "L",        "km",    Units.KILOMETRE);
-        verify(declared, "NAUTICAL_MILE",       "L",        "M",     Units.NAUTICAL_MILE);
-        verify(declared, "STATUTE_MILE",        "L",        "mi",    Units.STATUTE_MILE);
-        verify(declared, "US_SURVEY_FOOT",      "L",        "ft_US", Units.US_SURVEY_FOOT);
-        verify(declared, "FOOT",                "L",        "ft",    Units.FOOT);
-        verify(declared, "INCH",                "L",        "in",    Units.INCH);
-        verify(declared, "POINT",               "L",        "pt",    Units.POINT);
-        verify(declared, "RADIAN",              "",         "rad",   Units.RADIAN);
-        verify(declared, "GRAD",                "",         "grad",  Units.GRAD);
-        verify(declared, "DEGREE",              "",         "°",     Units.DEGREE);
-        verify(declared, "ARC_MINUTE",          "",         "′",     Units.ARC_MINUTE);
-        verify(declared, "ARC_SECOND",          "",         "″",     Units.ARC_SECOND);
-        verify(declared, "MICRORADIAN",         "",         "µrad",  Units.MICRORADIAN);
-        verify(declared, "MILLISECOND",         "T",        "ms",    Units.MILLISECOND);
-        verify(declared, "SECOND",              "T",        "s",     Units.SECOND);
-        verify(declared, "MINUTE",              "T",        "min",   Units.MINUTE);
-        verify(declared, "HOUR",                "T",        "h",     Units.HOUR);
-        verify(declared, "DAY",                 "T",        "d",     Units.DAY);
-        verify(declared, "WEEK",                "T",        "wk",    Units.WEEK);
-        verify(declared, "TROPICAL_YEAR",       "T",        "a",     Units.TROPICAL_YEAR);
-        verify(declared, "HERTZ",               "∕T",       "Hz",    Units.HERTZ);
-        verify(declared, "PASCAL",              "M∕(L⋅T²)", "Pa",    Units.PASCAL);
-        verify(declared, "HECTOPASCAL",         "M∕(L⋅T²)", "hPa",   Units.HECTOPASCAL);
-        verify(declared, "HECTARE",             "L²",       "ha",    Units.HECTARE);
-        verify(declared, "SQUARE_METRE",        "L²",       "m²",    Units.SQUARE_METRE);
-        verify(declared, "CUBIC_METRE",         "L³",       "m³",    Units.CUBIC_METRE);
-        verify(declared, "METRES_PER_SECOND",   "L∕T",      "m∕s",   Units.METRES_PER_SECOND);
-        verify(declared, "KILOMETRES_PER_HOUR", "L∕T",      "km∕h",  Units.KILOMETRES_PER_HOUR);
-        verify(declared, "KILOGRAM",            "M",        "kg",    Units.KILOGRAM);
-        verify(declared, "AMPERE",              "I",        "A",     Units.AMPERE);
-        verify(declared, "NEWTON",              "M⋅L∕T²",   "N",     Units.NEWTON);
-        verify(declared, "JOULE",               "M⋅L²∕T²",  "J",     Units.JOULE);
-        verify(declared, "WATT",                "M⋅L²∕T³",  "W",     Units.WATT);
-        verify(declared, "KELVIN",              "Θ",        "K",     Units.KELVIN);
-        verify(declared, "CELSIUS",             "Θ",        "°C",    Units.CELSIUS);
-        verify(declared, "CANDELA",             "J",        "cd",    Units.CANDELA);
-        verify(declared, "MOLE",                "N",        "mol",   Units.MOLE);
-        verify(declared, "UNITY",               "",         "",      Units.UNITY);
-        verify(declared, "PERCENT",             "",         "%",     Units.PERCENT);
-        verify(declared, "PPM",                 "",         "ppm",   Units.PPM);
-        verify(declared, "PSU",                 "",         "psu",   Units.PSU);
-        verify(declared, "PIXEL",               "",         "px",    Units.PIXEL);
+        verify(declared, "NANOMETRE",           "L",            "nm",    "nanometre",   
           Units.NANOMETRE);
+        verify(declared, "MILLIMETRE",          "L",            "mm",    "millimetre",  
           Units.MILLIMETRE);
+        verify(declared, "CENTIMETRE",          "L",            "cm",    "centimetre",  
           Units.CENTIMETRE);
+        verify(declared, "METRE",               "L",            "m",     "metre",       
           Units.METRE);
+        verify(declared, "KILOMETRE",           "L",            "km",    "kilometre",   
           Units.KILOMETRE);
+        verify(declared, "NAUTICAL_MILE",       "L",            "M",     "nautical mile",
          Units.NAUTICAL_MILE);
+        verify(declared, "STATUTE_MILE",        "L",            "mi",    "statute mile",
           Units.STATUTE_MILE);
+        verify(declared, "US_SURVEY_FOOT",      "L",            "ft_US", "US survey foot",
         Units.US_SURVEY_FOOT);
+        verify(declared, "FOOT",                "L",            "ft",    "foot",        
           Units.FOOT);
+        verify(declared, "INCH",                "L",            "in",    "inch",        
           Units.INCH);
+        verify(declared, "POINT",               "L",            "pt",    "point",       
           Units.POINT);
+        verify(declared, "SQUARE_METRE",        "L²",           "m²",    "square metre",
           Units.SQUARE_METRE);
+        verify(declared, "HECTARE",             "L²",           "ha",    "hectare",    
            Units.HECTARE);
+        verify(declared, "CUBIC_METRE",         "L³",           "m³",    "cubic metre",
            Units.CUBIC_METRE);
+        verify(declared, "STERADIAN",           "",             "sr",    "steradian",   
           Units.STERADIAN);
+        verify(declared, "MICRORADIAN",         "",             "µrad",  "microradian",
            Units.MICRORADIAN);
+        verify(declared, "RADIAN",              "",             "rad",   "radian",      
           Units.RADIAN);
+        verify(declared, "DEGREE",              "",             "°",     "degree",     
            Units.DEGREE);
+        verify(declared, "ARC_MINUTE",          "",             "′",     "arc-minute",
             Units.ARC_MINUTE);
+        verify(declared, "ARC_SECOND",          "",             "″",     "arc-second",
             Units.ARC_SECOND);
+        verify(declared, "GRAD",                "",             "grad",  "grad",        
           Units.GRAD);
+        verify(declared, "MILLISECOND",         "T",            "ms",    "millisecond", 
           Units.MILLISECOND);
+        verify(declared, "SECOND",              "T",            "s",     "second",      
           Units.SECOND);
+        verify(declared, "MINUTE",              "T",            "min",   "minute",      
           Units.MINUTE);
+        verify(declared, "HOUR",                "T",            "h",     "hour",        
           Units.HOUR);
+        verify(declared, "DAY",                 "T",            "d",     "day",         
           Units.DAY);
+        verify(declared, "WEEK",                "T",            "wk",    "week",        
           Units.WEEK);
+        verify(declared, "TROPICAL_YEAR",       "T",            "a",     "year",        
           Units.TROPICAL_YEAR);
+        verify(declared, "HERTZ",               "∕T",           "Hz",    "hertz",     
             Units.HERTZ);
+        verify(declared, "METRES_PER_SECOND",   "L∕T",          "m∕s",   "metres per
second",       Units.METRES_PER_SECOND);
+        verify(declared, "KILOMETRES_PER_HOUR", "L∕T",          "km∕h",  "kilometres
per hour",     Units.KILOMETRES_PER_HOUR);
+        verify(declared, "PASCAL",              "M∕(L⋅T²)",     "Pa",    "pascal", 
                Units.PASCAL);
+        verify(declared, "HECTOPASCAL",         "M∕(L⋅T²)",     "hPa",   "hectopascal",
            Units.HECTOPASCAL);
+        verify(declared, "DECIBAR",             "M∕(L⋅T²)",     "dbar",  "decibar",
                Units.DECIBAR);
+        verify(declared, "BAR",                 "M∕(L⋅T²)",     "bar",    null,    
                Units.BAR);
+        verify(declared, "ATMOSPHERE",          "M∕(L⋅T²)",     "atm",   "atmosphere",
             Units.ATMOSPHERE);
+        verify(declared, "NEWTON",              "M⋅L∕T²",       "N",     "newton", 
                Units.NEWTON);
+        verify(declared, "JOULE",               "M⋅L²∕T²",      "J",     "joule", 
                 Units.JOULE);
+        verify(declared, "WATT",                "M⋅L²∕T³",      "W",     "watt",  
                 Units.WATT);
+        verify(declared, "VOLT",                "M⋅L²∕(T³⋅I)",  "V",     "volt",
                   Units.VOLT);
+        verify(declared, "AMPERE",              "I",            "A",     "ampere",      
           Units.AMPERE);
+        verify(declared, "COULOMB",             "I⋅T",          "C",     "coulomb",   
             Units.COULOMB);
+        verify(declared, "FARAD",               "I²⋅T⁴∕(M⋅L²)", "F",     "farad",
                  Units.FARAD);
+        verify(declared, "OHM",                 "M⋅L²∕(T³⋅I²)", "Ω",     "ohm",
                    Units.OHM);
+        verify(declared, "SIEMENS",             "I²⋅T³∕(M⋅L²)", "S",     "siemens",
                Units.SIEMENS);
+        verify(declared, "WEBER",               "M⋅L²∕(T²⋅I)",  "Wb",    "weber",
                  Units.WEBER);
+        verify(declared, "TESLA",               "M∕(T²⋅I)",     "T",     "tesla",  
                Units.TESLA);
+        verify(declared, "HENRY",               "M⋅L²∕(T²⋅I²)", "H",     "henry",
                  Units.HENRY);
+        verify(declared, "KELVIN",              "Θ",            "K",     "kelvin",   
              Units.KELVIN);
+        verify(declared, "CELSIUS",             "Θ",            "°C",    "Celsius",   
             Units.CELSIUS);
+        verify(declared, "FAHRENHEIT",          "Θ",            "°F",    "Fahrenheit",
             Units.FAHRENHEIT);
+        verify(declared, "CANDELA",             "J",            "cd",    "candela",     
           Units.CANDELA);
+        verify(declared, "LUMEN",               "J",            "lm",    "lumen",       
           Units.LUMEN);
+        verify(declared, "LUX",                 "J∕L²",         "lx",    "lux",      
              Units.LUX);
+        verify(declared, "KILOGRAM",            "M",            "kg",    "kilogram",    
           Units.KILOGRAM);
+        verify(declared, "MOLE",                "N",            "mol",   "mole",        
           Units.MOLE);
+        verify(declared, "UNITY",               "",             "",       null,         
           Units.UNITY);
+        verify(declared, "PERCENT",             "",             "%",     "percentage",  
           Units.PERCENT);
+        verify(declared, "PPM",                 "",             "ppm",   "parts per million",
      Units.PPM);
+        verify(declared, "PSU",                 "",             "psu",   "practical salinity
unit", Units.PSU);
+        verify(declared, "PIXEL",               "",             "px",    "pixel",       
           Units.PIXEL);
         assertTrue("Missing units in test:" + declared, declared.isEmpty());
     }
 
@@ -113,11 +128,15 @@ public final strictfp class UnitFormatTe
      * @param field      the name of the constant to be verified.
      * @param dimension  the expected string representation of the unit dimension.
      * @param symbol     the expected string representation of the unit.
+     * @param name       the expected name, or {@code null} for skipping this test.
      * @param unit       the unit to verify.
      */
-    private static void verify(final Set<String> declared, final String field, final
String dimension, final String symbol, final Unit<?> unit) {
+    private static void verify(final Set<String> declared, final String field, final
String dimension, final String symbol, final String name, final Unit<?> unit) {
         assertEquals(field, dimension, String.valueOf(unit.getDimension()));
         assertEquals(field, symbol,    UnitFormat.INSTANCE.format(unit));
+        if (name != null) {
+            assertEquals(field, name, UnitFormat.getBundle(Locale.UK).getString(symbol));
+        }
         declared.remove(field);
     }
 
@@ -233,11 +252,16 @@ public final strictfp class UnitFormatTe
         assertSame(Units.DEGREE,        f.parse("degree"));
         assertSame(Units.DEGREE,        f.parse("degrees"));
         assertSame(Units.DEGREE,        f.parse("decimal degrees"));
+        assertSame(Units.DEGREE,        f.parse("degrees north"));
         assertSame(Units.DEGREE,        f.parse("degree north"));
+        assertSame(Units.DEGREE,        f.parse("degrees_east"));
         assertSame(Units.DEGREE,        f.parse("degree_east"));
         assertSame(Units.DEGREE,        f.parse("Degree West"));
         assertSame(Units.KELVIN,        f.parse("degree Kelvin"));
         assertSame(Units.CELSIUS,       f.parse("degree Celsius"));
+        assertSame(Units.KELVIN,        f.parse("degK"));
+        assertSame(Units.CELSIUS,       f.parse("degC"));
+        assertSame(Units.CELSIUS,       f.parse("deg C"));
         assertSame(Units.WATT,          f.parse("watt"));
         try {
             f.parse("degree foo");

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8]
Fri Nov  4 21:16:09 2016
@@ -21,7 +21,10 @@ import javax.measure.quantity.Angle;
 import javax.measure.quantity.Area;
 import javax.measure.quantity.Dimensionless;
 import javax.measure.quantity.Length;
+import javax.measure.quantity.LuminousFlux;
+import javax.measure.quantity.LuminousIntensity;
 import javax.measure.quantity.Mass;
+import javax.measure.quantity.SolidAngle;
 import javax.measure.quantity.Speed;
 import javax.measure.quantity.Temperature;
 import javax.measure.quantity.Time;
@@ -188,15 +191,37 @@ public final strictfp class UnitsTest ex
      */
     @Test
     public void testGetForQuantity() {
-        assertSame("Length",        Units.METRE,             Units.get(Length.class));
-        assertSame("Mass",          Units.KILOGRAM,          Units.get(Mass.class));
-        assertSame("Time",          Units.SECOND,            Units.get(Time.class));
-        assertSame("Temperature",   Units.KELVIN,            Units.get(Temperature.class));
-        assertSame("Area",          Units.SQUARE_METRE,      Units.get(Area.class));
-        assertSame("Volume",        Units.CUBIC_METRE,       Units.get(Volume.class));
-        assertSame("Speed",         Units.METRES_PER_SECOND, Units.get(Speed.class));
-        assertSame("Angle",         Units.RADIAN,            Units.get(Angle.class));
-        assertSame("Dimensionless", Units.UNITY,             Units.get(Dimensionless.class));
+        assertSame("Length",            Units.METRE,             Units.get(Length.class));
+        assertSame("Mass",              Units.KILOGRAM,          Units.get(Mass.class));
+        assertSame("Time",              Units.SECOND,            Units.get(Time.class));
+        assertSame("Temperature",       Units.KELVIN,            Units.get(Temperature.class));
+        assertSame("Area",              Units.SQUARE_METRE,      Units.get(Area.class));
+        assertSame("Volume",            Units.CUBIC_METRE,       Units.get(Volume.class));
+        assertSame("Speed",             Units.METRES_PER_SECOND, Units.get(Speed.class));
+        assertSame("LuminousIntensity", Units.CANDELA,           Units.get(LuminousIntensity.class));
+        assertSame("LuminousFlux",      Units.LUMEN,             Units.get(LuminousFlux.class));
+        assertSame("SolidAngle",        Units.STERADIAN,         Units.get(SolidAngle.class));
+        assertSame("Angle",             Units.RADIAN,            Units.get(Angle.class));
+        assertSame("Dimensionless",     Units.UNITY,             Units.get(Dimensionless.class));
+    }
+
+    /**
+     * Tests getting a unit for a given dimension.
+     */
+    @Test
+    public void testGetForDimension() {
+        assertSame("Length",            Units.METRE,             Units.get(Units.METRE  
         .getDimension()));
+        assertSame("Mass",              Units.KILOGRAM,          Units.get(Units.KILOGRAM
        .getDimension()));
+        assertSame("Time",              Units.SECOND,            Units.get(Units.SECOND 
         .getDimension()));
+        assertSame("Temperature",       Units.KELVIN,            Units.get(Units.KELVIN 
         .getDimension()));
+        assertSame("Area",              Units.SQUARE_METRE,      Units.get(Units.SQUARE_METRE
    .getDimension()));
+        assertSame("Volume",            Units.CUBIC_METRE,       Units.get(Units.CUBIC_METRE
     .getDimension()));
+        assertSame("Speed",             Units.METRES_PER_SECOND, Units.get(Units.METRES_PER_SECOND.getDimension()));
+        assertSame("LuminousIntensity", Units.CANDELA,           Units.get(Units.CANDELA
         .getDimension()));
+        assertSame("LuminousFlux",      Units.CANDELA,           Units.get(Units.LUMEN  
         .getDimension()));    // Because lumen is candela divided by a dimensionless unit.
+        assertSame("SolidAngle",        Units.UNITY,             Units.get(Units.STERADIAN
       .getDimension()));
+        assertSame("Angle",             Units.UNITY,             Units.get(Units.RADIAN 
         .getDimension()));
+        assertSame("Dimensionless",     Units.UNITY,             Units.get(Units.UNITY  
         .getDimension()));
     }
 
     /**

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1768102&r1=1768101&r2=1768102&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Fri Nov  4 21:16:09 2016
@@ -693,6 +693,7 @@ Apache SIS is a free software, Java lang
           <breakiterator>true</breakiterator>                   <!-- Better
boundary detection when determining the end of the first sentence. -->
           <validateLinks>true</validateLinks>                   <!-- Validates
content of package-list resources. -->
           <links>
+            <link>http://static.javadoc.io/javax.measure/unit-api/1.0</link>
             <link>http://www.geoapi.org/3.0/javadoc</link>
           </links>
 



Mime
View raw message