sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1826327 [4/5] - in /sis/branches/JDK9: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/resources/org/apache/sis/ core/sis-metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/jax...
Date Fri, 09 Mar 2018 11:00:28 GMT
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -97,7 +97,7 @@ final class LinearInterpolator1D extends
                 return;
             }
         }
-        inverse = new Inverse();
+        inverse = new Inverse(this);
     }
 
     /**
@@ -303,16 +303,30 @@ final class LinearInterpolator1D extends
      * a bilinear search for locating the lower and upper <var>x</var> values as integers, then interpolates the
      * <var>x</var> real value.
      */
-    private final class Inverse extends AbstractMathTransform1D.Inverse implements MathTransform1D {
+    private static final class Inverse extends AbstractMathTransform1D.Inverse implements MathTransform1D, Serializable {
         /**
          * For cross-version compatibility.
          */
-        private static final long serialVersionUID = 3179638888992528901L;
+        private static final long serialVersionUID = -5112948223332095009L;
+
+        /**
+         * The enclosing transform.
+         */
+        private final LinearInterpolator1D forward;
 
         /**
          * Creates a new inverse transform.
          */
-        Inverse() {
+        Inverse(final LinearInterpolator1D forward) {
+            this.forward = forward;
+        }
+
+        /**
+         * Returns the inverse of this math transform.
+         */
+        @Override
+        public MathTransform1D inverse() {
+            return forward;
         }
 
         /**
@@ -326,7 +340,7 @@ final class LinearInterpolator1D extends
                                 final boolean derivate) throws TransformException
         {
             final double d, x, y = srcPts[srcOff];
-            final double[] values = LinearInterpolator1D.this.values;
+            final double[] values = forward.values;
             int i = Arrays.binarySearch(values, y);
             if (i >= 0) {
                 x = i;
@@ -361,7 +375,7 @@ final class LinearInterpolator1D extends
          */
         @Override
         public double transform(final double y) {
-            final double[] values = LinearInterpolator1D.this.values;
+            final double[] values = forward.values;
             int i = Arrays.binarySearch(values, y);
             if (i >= 0) {
                 return i;
@@ -390,7 +404,7 @@ final class LinearInterpolator1D extends
          */
         @Override
         public double derivative(final double y) {
-            final double[] values = LinearInterpolator1D.this.values;
+            final double[] values = forward.values;
             int i = Arrays.binarySearch(values, y);
             if (i < 0) {
                 i = ~i;

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -16,10 +16,12 @@
  */
 package org.apache.sis.referencing.operation.transform;
 
+import java.util.Map;
 import java.util.List;
 import java.util.Collections;
 import java.awt.geom.AffineTransform;
 import org.opengis.util.FactoryException;
+import org.opengis.geometry.Envelope;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
@@ -51,7 +53,7 @@ import org.apache.sis.util.Static;
  * GeoAPI factory interfaces instead.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 1.0
  *
  * @see MathTransformFactory
  *
@@ -179,6 +181,45 @@ public final class MathTransforms extend
     }
 
     /**
+     * Creates a transform defined as one transform applied globally except in sub-areas where more accurate
+     * transforms are available. Such constructs appear in some datum shift files. The result of transforming
+     * a point by the returned {@code MathTransform} is as if iterating over all given {@link Envelope}s in
+     * no particular order, find the smallest one containing the point to transform (envelope border considered
+     * inclusive), then use the associated {@link MathTransform} for transforming the point.
+     * If the point is not found in any envelope, then the global transform is applied.
+     *
+     * <p>The following constraints apply:</p>
+     * <ul>
+     *   <li>The global transform must be a reasonable approximation of the specialized transforms
+     *       (this is required for calculating the inverse transform).</li>
+     *   <li>All transforms in the {@code specializations} map must have the same number of source and target
+     *       dimensions than the {@code global} transform.</li>
+     *   <li>All envelopes in the {@code specializations} map must have the same number of dimensions
+     *       than the global transform <em>source</em> dimensions.</li>
+     *   <li>In current implementation, each envelope must either be fully included in another envelope,
+     *       or not overlap any other envelope.</li>
+     * </ul>
+     *
+     * @param  global  the transform to use globally where there is no suitable specialization.
+     * @param  specializations  more accurate transforms available in some sub-areas.
+     * @return a transform applying the given global transform except in sub-areas where specializations are available.
+     * @throws IllegalArgumentException if a constraint is not meet.
+     *
+     * @since 1.0
+     */
+    public static MathTransform specialize(final MathTransform global, final Map<Envelope,MathTransform> specializations) {
+        ArgumentChecks.ensureNonNull("generic", global);
+        ArgumentChecks.ensureNonNull("specializations", specializations);
+        if (specializations.isEmpty()) {
+            return global;
+        } else if (global.getSourceDimensions() == 2 && global.getTargetDimensions() == 2) {
+            return new SpecializableTransform2D(global, specializations);
+        } else {
+            return new SpecializableTransform(global, specializations);
+        }
+    }
+
+    /**
      * Puts together a list of independent math transforms, each of them operating on a subset of ordinate values.
      * This method is often used for defining 4-dimensional (<var>x</var>,<var>y</var>,<var>z</var>,<var>t</var>)
      * transform as an aggregation of 3 simpler transforms operating on (<var>x</var>,<var>y</var>), (<var>z</var>)
@@ -445,7 +486,8 @@ public final class MathTransforms extend
             return ((AbstractMathTransform) transform).transform(srcPts, srcOff, dstPts, dstOff, true);
         }
         // Must be calculated before to transform the coordinate.
-        final Matrix derivative = transform.derivative(new DirectPositionView(srcPts, srcOff, transform.getSourceDimensions()));
+        final Matrix derivative = transform.derivative(
+                new DirectPositionView.Double(srcPts, srcOff, transform.getSourceDimensions()));
         if (dstPts != null) {
             transform.transform(srcPts, srcOff, dstPts, dstOff, 1);
         }

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -318,7 +318,7 @@ public class PassThroughTransform extend
     {
         Matrix derivative = null;
         if (derivate) {
-            derivative = derivative(new DirectPositionView(srcPts, srcOff, getSourceDimensions()));
+            derivative = derivative(new DirectPositionView.Double(srcPts, srcOff, getSourceDimensions()));
         }
         if (dstPts != null) {
             transform(srcPts, srcOff, dstPts, dstOff, 1);

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -61,7 +61,7 @@
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Adrian Custer (Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.5
  * @module
  */

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -26,17 +26,52 @@ import static org.apache.sis.test.Assert
  * Tests the static methods provided in {@link AbstractDirectPosition}.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
 public final strictfp class AbstractDirectPositionTest extends TestCase {
     /**
-     * Tests {@link AbstractDirectPosition#isSimplePrecision(double[])}.
+     * Tests {@link AbstractDirectPosition#parse(CharSequence)}.
      */
     @Test
-    public void testIsSimplePrecision() {
-        assertTrue (AbstractDirectPosition.isSimplePrecision(2, 0.5, 0.25, Double.NaN, Double.POSITIVE_INFINITY));
-        assertFalse(AbstractDirectPosition.isSimplePrecision(2, 0.5, 1.0 / 3));
+    public void testParse() {
+        assertArrayEquals(new double[] {6, 10, 2}, AbstractDirectPosition.parse("POINT(6 10 2)"),       STRICT);
+        assertArrayEquals(new double[] {3, 14, 2}, AbstractDirectPosition.parse("POINT M [ 3 14 2 ] "), STRICT);
+        assertArrayEquals(new double[] {2, 10, 8}, AbstractDirectPosition.parse("POINT Z 2 10 8"),      STRICT);
+        assertArrayEquals(new double[] {},         AbstractDirectPosition.parse("POINT()"),             STRICT);
+        assertArrayEquals(new double[] {},         AbstractDirectPosition.parse("POINT ( ) "),          STRICT);
+    }
+
+    /**
+     * Tests {@link AbstractDirectPosition#parse(CharSequence)} with invalid input strings.
+     */
+    @Test
+    public void testParsingFailures() {
+        try {
+            AbstractDirectPosition.parse("POINT(6 10 2");
+            fail("Parsing should fails because of missing parenthesis.");
+        } catch (IllegalArgumentException e) {
+            // This is the expected exception.
+            final String message = e.getMessage();
+            assertTrue(message, message.contains("POINT(6 10 2"));
+            assertTrue(message, message.contains("‘)’"));
+        }
+        try {
+            AbstractDirectPosition.parse("POINT 6 10 2)");
+            fail("Parsing should fails because of missing parenthesis.");
+        } catch (IllegalArgumentException e) {
+            // This is the expected exception.
+        }
+        try {
+            AbstractDirectPosition.parse("POINT(6 10 2) x");
+            fail("Parsing should fails because of extra characters.");
+        } catch (IllegalArgumentException e) {
+            // This is the expected exception.
+            final String message = e.getMessage();
+            assertTrue(message, message.contains("POINT(6 10 2) x"));
+            assertTrue(message, message.contains("“x”") ||                  // English locale
+                                message.contains("« x »"));                 // French locale
+        }
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/ArrayEnvelopeTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -16,11 +16,12 @@
  */
 package org.apache.sis.geometry;
 
+import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.apache.sis.test.Assert.*;
 
 
 /**
@@ -28,7 +29,7 @@ import static org.junit.Assert.*;
  * This is the base class of {@link GeneralEnvelope} and {@link ImmutableEnvelope}.
  *
  * @author  Michael Hausegger
- * @version 0.8
+ * @version 1.0
  * @since   0.8
  * @module
  */
@@ -64,6 +65,21 @@ public final strictfp class ArrayEnvelop
     }
 
     /**
+     * Tests the {@link ArrayEnvelope#formatTo(Formatter)} method.
+     * Contrarily to {@code toString()}, the precision depends on the CRS.
+     */
+    @Test
+    public void testFormatWKT() {
+        ArrayEnvelope envelope = new ArrayEnvelope(new double[] {4, -10, 50, 2});
+        assertMultilinesEquals("BOX[ 4 -10,\n" +
+                               "    50   2]", envelope.toWKT());
+        envelope.crs = AbstractEnvelopeTest.WGS84;
+        assertMultilinesEquals("BOX[ 4.00000000 -10.00000000,\n" +
+                               "    50.00000000   2.00000000]", envelope.toWKT());
+
+    }
+
+    /**
      * Tests envelope construction from a the pseudo-Well Known Text (WKT) representation of a Bounding Box (BBOX).
      */
     @Test

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -17,6 +17,7 @@
 package org.apache.sis.geometry;
 
 import java.util.Arrays;
+import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -30,7 +31,7 @@ import static org.apache.sis.geometry.Ab
  * Tests the {@link GeneralDirectPosition} class.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -49,10 +50,23 @@ public final strictfp class GeneralDirec
     }
 
     /**
+     * Tests the {@link GeneralDirectPosition#formatTo(Formatter)} method.
+     * Contrarily to {@code toString()}, the precision depends on the CRS.
+     */
+    @Test
+    public void testFormatWKT() {
+        final GeneralDirectPosition position = new GeneralDirectPosition(6, 10);
+        assertEquals("POINT[6 10]", position.toWKT());
+        position.setCoordinateReferenceSystem(WGS84);
+        assertEquals("POINT[6.00000000 10.00000000]", position.toWKT());        // 1 cm precision on Earth.
+        validate(position);
+    }
+
+    /**
      * Tests the {@link GeneralDirectPosition#toString()} method.
      */
     @Test
-    public void testWktFormatting() {
+    public void testToString() {
         final GeneralDirectPosition position = new GeneralDirectPosition(6, 10, 2);
         assertEquals("POINT(6 10 2)", position.toString());
         validate(position);
@@ -62,7 +76,7 @@ public final strictfp class GeneralDirec
      * Tests the {@link GeneralDirectPosition#GeneralDirectPosition(CharSequence)} constructor.
      */
     @Test
-    public void testWktParsing() {
+    public void testConstructor() {
         assertEquals("POINT(6 10 2)", new GeneralDirectPosition("POINT(6 10 2)").toString());
         assertEquals("POINT(3 14 2)", new GeneralDirectPosition("POINT M [ 3 14 2 ] ").toString());
         assertEquals("POINT(2 10 8)", new GeneralDirectPosition("POINT Z 2 10 8").toString());
@@ -71,40 +85,6 @@ public final strictfp class GeneralDirec
     }
 
     /**
-     * Tests the {@link GeneralDirectPosition#GeneralDirectPosition(CharSequence)} constructor
-     * with invalid input strings.
-     */
-    @Test
-    @SuppressWarnings("ResultOfObjectAllocationIgnored")
-    public void testWktParsingFailures() {
-        try {
-            new GeneralDirectPosition("POINT(6 10 2");
-            fail("Parsing should fails because of missing parenthesis.");
-        } catch (IllegalArgumentException e) {
-            // This is the expected exception.
-            final String message = e.getMessage();
-            assertTrue(message, message.contains("POINT(6 10 2"));
-            assertTrue(message, message.contains("‘)’"));
-        }
-        try {
-            new GeneralDirectPosition("POINT 6 10 2)");
-            fail("Parsing should fails because of missing parenthesis.");
-        } catch (IllegalArgumentException e) {
-            // This is the expected exception.
-        }
-        try {
-            new GeneralDirectPosition("POINT(6 10 2) x");
-            fail("Parsing should fails because of extra characters.");
-        } catch (IllegalArgumentException e) {
-            // This is the expected exception.
-            final String message = e.getMessage();
-            assertTrue(message, message.contains("POINT(6 10 2) x"));
-            assertTrue(message, message.contains("“x”") ||  // English locale
-                                message.contains("« x »")); // French locale
-        }
-    }
-
-    /**
      * Tests {@link GeneralDirectPosition#clone()}.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/SecondDefiningParameterTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -23,7 +23,7 @@ import org.apache.sis.referencing.datum.
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/FormulasTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -18,6 +18,7 @@ package org.apache.sis.internal.referenc
 
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.measure.Longitude;
+import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -28,7 +29,7 @@ import static org.junit.Assert.*;
  * Tests {@link Formulas}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -90,6 +91,14 @@ public final strictfp class FormulasTest
     }
 
     /**
+     * Tests {@link Formulas#scaleComparedToEarth(Ellipsoid)}.
+     */
+    @Test
+    public void testScaleComparedToEarth() {
+        assertEquals(1, Formulas.scaleComparedToEarth(HardCodedDatum.WGS84.getEllipsoid()), 1E-14);
+    }
+
+    /**
      * Tests {@link Formulas#getSemiMinor(double, double)}.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -39,7 +39,7 @@ import static org.apache.sis.internal.re
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
- * @since   0.5 (derived from 0.4)
+ * @since   0.4
  * @module
  */
 public final strictfp class ReferencingUtilitiesTest extends TestCase {

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/WKTUtilitiesTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.referencing;
 
 import org.opengis.referencing.cs.*;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -30,7 +31,7 @@ import static org.apache.sis.internal.re
  * Tests {@link WKTUtilities}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.7
  * @module
  */
@@ -49,10 +50,21 @@ public final strictfp class WKTUtilities
         assertEquals(WKTKeywords.cylindrical, toType(CoordinateSystem.class, CylindricalCS   .class));
         assertEquals(WKTKeywords.ellipsoidal, toType(CoordinateSystem.class, EllipsoidalCS   .class));
         assertEquals(WKTKeywords.linear,      toType(CoordinateSystem.class, LinearCS        .class));
-//      assertEquals(WKTKeywords.parametric,  toType(CoordinateSystem.class, ParametricCS    .class));
+        assertEquals(WKTKeywords.parametric,  toType(CoordinateSystem.class, ParametricCS    .class));
         assertEquals(WKTKeywords.polar,       toType(CoordinateSystem.class, PolarCS         .class));
         assertEquals(WKTKeywords.spherical,   toType(CoordinateSystem.class, SphericalCS     .class));
         assertEquals(WKTKeywords.temporal,    toType(CoordinateSystem.class, TimeCS          .class));
         assertEquals(WKTKeywords.vertical,    toType(CoordinateSystem.class, VerticalCS      .class));
     }
+
+    /**
+     * Tests {@link WKTUtilities#suggestFractionDigits(CoordinateReferenceSystem, double[]...)}.
+     */
+    @Test
+    public void testSuggestFractionDigits() {
+        assertArrayEquals(new int[] {8, 9}, WKTUtilities.suggestFractionDigits(HardCodedCRS.WGS84, new double[][] {
+            {40, -10},
+            {50, -10.000000001}
+        }));
+    }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -32,7 +32,7 @@ import org.apache.sis.referencing.datum.
  * This class can generate random number suitable for their domain.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -215,6 +215,14 @@ public strictfp class CoordinateDomain {
             -10, 10);
 
     /**
+     * Values in the -100 to 100 range in all dimensions.
+     */
+    public static final CoordinateDomain RANGE_100 = new CoordinateDomain(
+            -100, 100,
+            -100, 100,
+            -100, 100);
+
+    /**
      * The domain of the coordinates to test.
      */
     final double xmin, xmax, ymin, ymax, zmin, zmax;

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PseudoTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PseudoTransform.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PseudoTransform.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PseudoTransform.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -96,7 +96,7 @@ strictfp class PseudoTransform extends A
                             final boolean derivate) throws TransformException
     {
         final Matrix derivative = derivate ? derivative(
-                new DirectPositionView(srcPts, srcOff, getSourceDimensions())) : null;
+                new DirectPositionView.Double(srcPts, srcOff, getSourceDimensions())) : null;
         System.arraycopy(srcPts, srcOff, buffer, 0, sourceDimension);
         for (int i=0; i<targetDimension; i++) {
             double v = buffer[i % sourceDimension];

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/MetadataTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -61,7 +61,7 @@ import org.apache.sis.referencing.cs.Def
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.internal.jaxb.metadata.replace.ReferenceSystemMetadata;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
-import org.apache.sis.internal.jaxb.gmx.Anchor;
+import org.apache.sis.internal.jaxb.gcx.Anchor;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.util.iso.SimpleInternationalString;

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -25,7 +25,7 @@ import org.junit.BeforeClass;
  * All tests from the {@code sis-referencing} module, in approximative dependency order.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -131,6 +131,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.transform.PolarToCartesianTest.class,
     org.apache.sis.referencing.operation.transform.CartesianToPolarTest.class,
     org.apache.sis.referencing.operation.transform.CoordinateSystemTransformTest.class,
+    org.apache.sis.referencing.operation.transform.SpecializableTransformTest.class,
     org.apache.sis.referencing.operation.DefaultFormulaTest.class,
     org.apache.sis.referencing.operation.DefaultOperationMethodTest.class,
     org.apache.sis.referencing.operation.AbstractSingleOperationTest.class,

Modified: sis/branches/JDK9/core/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/pom.xml?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/pom.xml (original)
+++ sis/branches/JDK9/core/sis-utility/pom.xml Fri Mar  9 11:00:27 2018
@@ -160,14 +160,6 @@ Miscellaneous utilities.
       <groupId>javax</groupId>
       <artifactId>javaee-api</artifactId>
     </dependency>
-
-    <!-- Allows compiler to use a JAXB class which should exist on the JVM. -->
-    <dependency>
-      <groupId>com.googlecode.jaxb-namespaceprefixmapper-interfaces</groupId>
-      <artifactId>JAXBNamespacePrefixMapper</artifactId>
-      <version>2.2.4</version>
-      <scope>provided</scope>
-    </dependency>
   </dependencies>
 
 </project>

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -31,7 +31,7 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.ObjectConverter;
 import org.apache.sis.util.UnconvertibleObjectException;
 import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.util.iso.Types;
+import org.apache.sis.internal.util.CodeLists;
 import org.apache.sis.measure.Units;
 
 
@@ -354,7 +354,7 @@ abstract class StringConverter<T> extend
 
         /** Converts the given string to the target type of this converter. */
         @Override T doConvert(final String source) {
-            final T code = Types.forCodeName(targetClass, source, false);
+            final T code = CodeLists.forName(targetClass, source, false);
             if (code == null) {
                 throw new UnconvertibleObjectException(formatErrorMessage(source));
             }
@@ -386,7 +386,7 @@ abstract class StringConverter<T> extend
 
         /** Converts the given string to the target type of this converter. */
         @Override T doConvert(final String source) {
-            final T code = Types.forEnumName(targetClass, source);
+            final T code = CodeLists.forName(targetClass, source);
             if (code == null) {
                 throw new UnconvertibleObjectException(formatErrorMessage(source));
             }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -21,7 +21,6 @@ import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.NullArgumentException;
@@ -47,7 +46,7 @@ import static org.apache.sis.util.Argume
  * holes are known to exist in use cases like {@code sublist(…).set(…)} or when using the list iterator.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  *
  * @param <E>  the type of elements in the list.
  *
@@ -149,6 +148,14 @@ public final class CheckedArrayList<E> e
      * @see <a href="https://issues.apache.org/jira/browse/SIS-157">SIS-157</a>
      */
     public static String illegalElement(final Collection<?> collection, final Object element, final Class<?> expectedType) {
+        /*
+         * Ignore if the current thread is in process of unmarshalling a XML document.
+         * This happen when an XML element is empty (e.g. "<cit:contact/>"), in which
+         * case JAXB tries to add a null element.
+         */
+        if (MetadataServices.getInstance().isUnmarshalling()) {
+            return null;
+        }
         final short key;
         final Object[] arguments;
         if (element == null) {
@@ -160,13 +167,7 @@ public final class CheckedArrayList<E> e
             key = Errors.Keys.IllegalArgumentClass_3;
             arguments = new Object[] {"element", expectedType, element.getClass()};
         }
-        final Context context = Context.current();
-        if (context != null) {
-            Context.warningOccured(context, collection.getClass(), "add", Errors.class, key, arguments);
-            return null;
-        } else {
-            return Errors.format(key, arguments);
-        }
+        return Errors.format(key, arguments);
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -23,14 +23,11 @@ import java.util.Objects;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.util.InternationalString;
-import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.Static;
 
-import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR;
-
 
 /**
  * Utility methods working on {@link Citation} objects. The public facade of those methods is
@@ -50,6 +47,14 @@ public final class Citations extends Sta
     }
 
     /**
+     * The default separator, which is {@code ':'}. The separator is inserted between
+     * the code space and the code in identifiers.
+     *
+     * @see org.apache.sis.util.iso.DefaultNameSpace#DEFAULT_SEPARATOR
+     */
+    public static final char DEFAULT_SEPARATOR = ':';
+
+    /**
      * Returns {@code true} if the given code is {@code "EPSG"} while the codespace is {@code "IOGP"} or {@code "OGP"}
      * (ignoring case). This particular combination of code and codespace is handled in a special way.
      *
@@ -373,6 +378,13 @@ public final class Citations extends Sta
      *       {@link org.apache.sis.metadata.iso.citation.Citations#getUnicodeIdentifier(Citation)}.</li>
      * </ul>
      *
+     * Use {@code getUnicodeIdentifier(…)} method when assigning values to be returned by methods like
+     * {@link Identifier#getCodeSpace()}, since those values are likely to be compared without special
+     * care about ignorable identifier characters. But if the intent is to format a more complex string
+     * like WKT or {@code toString()}, then we suggest to use {@code getIdentifier(citation, true)} instead,
+     * which will produce the same result but preserving the ignorable characters, which can be useful
+     * for formatting purpose.
+     *
      * @param  citation  the citation for which to get the identifier, or {@code null}.
      * @param  strict    {@code true} for returning a non-null value only if the identifier is a valid Unicode identifier.
      * @return a non-empty identifier for the given citation without leading or trailing whitespaces,
@@ -475,32 +487,6 @@ public final class Citations extends Sta
     }
 
     /**
-     * Infers a valid Unicode identifier from the given citation, or returns {@code null} if none.
-     * This method removes {@linkplain Character#isIdentifierIgnorable(int) ignorable characters}.
-     * See {@link org.apache.sis.metadata.iso.citation.Citations#getUnicodeIdentifier(Citation)}
-     * for the public documentation of this method.
-     *
-     * <div class="section">When to use</div>
-     * Use this method when assigning values to be returned by methods like {@link Identifier#getCodeSpace()},
-     * since those values are likely to be compared without special care about ignorable identifier characters.
-     * But if the intent is to format a more complex string like WKT or {@code toString()}, then we suggest to
-     * use {@code getIdentifier(citation, true)} instead, which will produce the same result but preserving the
-     * ignorable characters, which can be useful for formatting purpose.
-     *
-     * @param  citation  the citation for which to get the Unicode identifier, or {@code null}.
-     * @return a non-empty Unicode identifier for the given citation without leading or trailing whitespaces,
-     *         or {@code null} if the given citation is null or does not have any Unicode identifier or title.
-     *
-     * @since 0.6
-     *
-     * @deprecated Implementation will be moved to {@link org.apache.sis.metadata.iso.citation.Citations}
-     *             after we moved the {@code sis-utility} code that use this method.
-     */
-    public static String getUnicodeIdentifier(final Citation citation) {
-        return removeIgnorableCharacters(getIdentifier(citation, true));
-    }
-
-    /**
      * Removes characters that are ignorable according Unicode specification.
      *
      * @param  identifier  the character sequence from which to remove ignorable characters, or {@code null}.
@@ -547,34 +533,4 @@ public final class Citations extends Sta
         }
         return identifier;
     }
-
-    /**
-     * Infers a code space from the given citation, or returns {@code null} if none.
-     * This method is very close to {@link #getUnicodeIdentifier(Citation)}, except that it looks for
-     * {@link IdentifierSpace#getName()} before to scan the identifiers and titles. The result should
-     * be the same in most cases, except some cases like the {@link org.apache.sis.metadata.iso.citation.Citations}
-     * constant for {@code "Proj.4"} in which case this method returns {@code "Proj4"} instead of {@code null}.
-     * As a side effect, using this method also avoid constructing {@code DefaultCitation} objects which were deferred.
-     *
-     * <p>We do not put this method in public API for now because the actions performed by this method could be
-     * revisited in any future SIS version depending on the experience gained. However we should try to keep the
-     * behavior of this method close to the behavior of {@link #getUnicodeIdentifier(Citation)}, which is the
-     * method having a public facade.</p>
-     *
-     * @param  citation  the citation for which to infer the code space, or {@code null}.
-     * @return a non-empty code space for the given citation without leading or trailing whitespaces,
-     *         or {@code null} if the given citation is null or does not have any Unicode identifier or title.
-     *
-     * @since 0.6
-     *
-     * @deprecated Implementation will be moved to {@link org.apache.sis.metadata.iso.citation.Citations}
-     *             after we moved the {@code sis-utility} code that use this method.
-     */
-    public static String getCodeSpace(final Citation citation) {
-        if (citation instanceof IdentifierSpace<?>) {
-            return ((IdentifierSpace<?>) citation).getName();
-        } else {
-            return getUnicodeIdentifier(citation);
-        }
-    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -19,10 +19,15 @@ package org.apache.sis.internal.util;
 import java.text.Format;
 import java.util.Locale;
 import java.util.TimeZone;
-import org.opengis.metadata.citation.Citation;
-import org.apache.sis.internal.simple.CitationConstant;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import org.opengis.annotation.UML;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.OptionalDependency;
+import org.apache.sis.util.CharSequences;
+
+// Branch-dependent imports
+import org.opengis.util.ControlledVocabulary;
 
 
 /**
@@ -31,7 +36,7 @@ import org.apache.sis.internal.system.Op
  * implementation using Java reflection.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.6
  * @module
  */
@@ -92,28 +97,41 @@ public class MetadataServices extends Op
     }
 
     /**
-     * Returns the constant defined in the {@link org.apache.sis.metadata.iso.citation.Citations} class for the
-     * given name. This is used at {@link org.apache.sis.internal.simple.CitationConstant} deserialization time,
-     * for which the two citations of interest are {@code "ISBN"} (International Standard Book Number) and
-     * {@code "ISSN"} (International Standard Serial Number) citation.
+     * {@code true} if this thread is in the process of reading a XML document with JAXB.
      *
-     * @param  name  the name of one of the citation constants defined in the {@code Citations} class.
-     * @return the requested citation, or {@code null} if the {@code sis-metadata} module is not available.
+     * @return if XML unmarshalling is in progress in current thread.
      */
-    public CitationConstant getCitationConstant(final String name) {
-        return null;
+    public boolean isUnmarshalling() {
+        return false;
     }
 
     /**
-     * Returns the build-in citation for the given primary key, or {@code null} if none.
-     * The metadata module will search in a database for information like a descriptive
-     * title, abbreviations, identifiers, URL to a web site, <i>etc</i>.
-     *
-     * @param  key  the primary key of the desired citation.
-     * @return the requested citation, or {@code null} if the {@code sis-metadata} module is not available.
-     */
-    public Citation createCitation(final String key) {
-        return null;
+     * Returns the title of the given enumeration or code list value.
+     *
+     * @param  code    the code for which to get the title.
+     * @param  locale  desired locale for the title.
+     * @return the title.
+     *
+     * @see org.apache.sis.util.iso.Types#getCodeTitle(ControlledVocabulary)
+     */
+    public String getCodeTitle(final ControlledVocabulary code, final Locale locale) {
+        /*
+         * Following code reproduces the work done by org.apache.sis.util.iso.Types.getCodeList(…)
+         * with less handling of special cases. It is executed only if the sis-metadata module is
+         * not on the classpath, otherwise the sis-metadata implementation will be used.
+         */
+        final UML uml = code.getClass().getAnnotation(UML.class);
+        if (uml != null) try {
+            return ResourceBundle.getBundle(CodeLists.RESOURCES, locale, UML.class.getClassLoader())
+                                 .getString(uml.identifier() + '.' + code.identifier());
+        } catch (MissingResourceException e) {
+            /*
+             * Ignore. The reason for not finding the resource may because of above code not covering enough cases.
+             * Usually the sis-metadata module will be present on the classpath, in which case this implementation
+             * will not be used. We need just enough code for allowing sis-utility tests to pass.
+             */
+        }
+        return CharSequences.camelCaseToSentence(code.identifier()).toString();
     }
 
     /**
@@ -142,8 +160,6 @@ public class MetadataServices extends Op
      * @param  locale    the locale for the new {@code Format}, or {@code null} for {@code Locale.ROOT}.
      * @param  timezone  the timezone, or {@code null} for UTC.
      * @return a {@link org.apache.sis.geometry.CoordinateFormat}.
-     *
-     * @since 0.8
      */
     public Format createCoordinateFormat(final Locale locale, final TimeZone timezone) {
         throw moduleNotFound();

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -21,6 +21,8 @@ import java.util.HashMap;
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.math.DecimalFunctions;
+import org.opengis.referencing.operation.Matrix;    // For javadoc
 
 import static java.lang.Math.max;
 import static java.lang.Math.abs;
@@ -30,7 +32,7 @@ import static java.lang.Math.abs;
  * Miscellaneous utilities methods working on floating point numbers.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -156,6 +158,22 @@ public final class Numerics extends Stat
     }
 
     /**
+     * Returns {@code true} if every values in the given {@code double} array could be casted to the
+     * {@code float} type without precision lost. This method treats all {@code NaN} values as equal.
+     *
+     * @param  values  the value to test for their precision.
+     * @return {@code true} if every values can be casted to the {@code float} type without precision lost.
+     */
+    public static boolean isSimplePrecision(final double... values) {
+        for (final double value : values) {
+            if (Double.doubleToLongBits(value) != Double.doubleToLongBits((float) value)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
      * Returns a copy of the given array where each value has been casted to the {@code float} type.
      *
      * @param  data  the array to copy, or {@code null}.
@@ -428,4 +446,51 @@ public final class Numerics extends Stat
         }
         return bits;
     }
+
+    /**
+     * Suggests an amount of fraction digits to use for formatting numbers in each column of the given matrix.
+     * The number of fraction digits may be negative if we could round the numbers to 10, 100, <i>etc</i>.
+     *
+     * @param  rows  the matrix rows. It is not required that each row has the same length.
+     * @return suggested amount of fraction digits as an array as long as the longest row.
+     *
+     * @see org.apache.sis.referencing.operation.matrix.Matrices#toString(Matrix)
+     */
+    public static int[] suggestFractionDigits(final double[][] rows) {
+        int length = 0;
+        final int n = rows.length - 1;
+        for (int j=0; j <= n; j++) {
+            final int rl = rows[j].length;
+            if (rl > length) length = rl;
+        }
+        final int[] fractionDigits = new int[length];
+        for (int i=0; i<length; i++) {
+            double min = Double.POSITIVE_INFINITY;
+            double max = Double.NEGATIVE_INFINITY;
+            boolean isInteger = true;
+            for (final double[] row : rows) {
+                if (row.length > i) {
+                    final double value = row[i];
+                    if (value < min) min = value;
+                    if (value > max) max = value;
+                    if (isInteger && Math.floor(value) != value && !Double.isNaN(value)) {
+                        isInteger = false;
+                    }
+                }
+            }
+            if (!isInteger) {
+                final double  delta;
+                final boolean strict;
+                if (min < max) {
+                    delta  = (max - min) / n;
+                    strict = (n == 1);
+                } else {
+                    delta  = Math.max(Math.abs(min), Math.abs(max)) * 1E-6;     // The 1E-6 factor is arbitrary.
+                    strict = false;
+                }
+                fractionDigits[i] = DecimalFunctions.fractionDigitsForDelta(delta, strict);
+            }
+        }
+        return fractionDigits;
+    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/util/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -30,7 +30,7 @@
  * so some serialized classes still exist in this package.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/io/IdentifiedObjectFormat.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -24,7 +24,6 @@ import org.opengis.util.GenericName;
 import org.opengis.metadata.Identifier;
 import org.opengis.referencing.IdentifiedObject;
 import org.apache.sis.internal.util.Citations;
-import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.resources.Vocabulary;
 
 
@@ -74,7 +73,7 @@ final class IdentifiedObjectFormat exten
             cs = Citations.getIdentifier(identifier.getAuthority(), true);
         }
         if (cs != null) {
-            toAppendTo.append(cs).append(DefaultNameSpace.DEFAULT_SEPARATOR);
+            toAppendTo.append(cs).append(Citations.DEFAULT_SEPARATOR);
         }
         return toAppendTo.append(code);
     }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/math/Statistics.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/math/Statistics.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/math/Statistics.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/math/Statistics.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -21,8 +21,8 @@ import java.io.Serializable;
 import java.util.function.LongConsumer;
 import java.util.function.DoubleConsumer;
 import org.opengis.util.InternationalString;
+import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.iso.Types;
 
 import static java.lang.Math.*;
 import static java.lang.Double.NaN;
@@ -84,7 +84,7 @@ import static java.lang.Double.doubleToL
  * }
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -160,7 +160,11 @@ public class Statistics implements Doubl
      *               formatted by {@link StatisticsFormat}.
      */
     public Statistics(final CharSequence name) {
-        this.name = Types.toInternationalString(name);
+        if (name == null || name instanceof InternationalString) {
+            this.name = (InternationalString) name;
+        } else {
+            this.name = new SimpleInternationalString(name.toString());
+        }
     }
 
     /**
@@ -192,8 +196,6 @@ public class Statistics implements Doubl
      *   <li><i>etc</i>.</li>
      * </ul>
      *
-     *
-     *
      * @param  name  the phenomenon for which this object is collecting statistics, or {@code null}
      *               if none. If non-null, then this name will be shown as column header in the table
      *               formatted by {@link StatisticsFormat}.
@@ -548,12 +550,12 @@ public class Statistics implements Doubl
     public boolean equals(final Object object) {
         if (object != null && getClass() == object.getClass()) {
             final Statistics cast = (Statistics) object;
-            return Objects.equals(name, cast.name)
-                    && count == cast.count && countNaN == cast.countNaN
+            return count == cast.count && countNaN == cast.countNaN
                     && doubleToLongBits(minimum)   == doubleToLongBits(cast.minimum)
                     && doubleToLongBits(maximum)   == doubleToLongBits(cast.maximum)
                     && doubleToLongBits(sum)       == doubleToLongBits(cast.sum)
-                    && doubleToLongBits(squareSum) == doubleToLongBits(cast.squareSum);
+                    && doubleToLongBits(squareSum) == doubleToLongBits(cast.squareSum)
+                    && Objects.equals(name, cast.name);
         }
         return false;
     }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -32,6 +32,7 @@ import java.io.IOException;
 import javax.measure.Dimension;
 import javax.measure.Unit;
 import javax.measure.format.ParserException;
+import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.internal.util.XPaths;
@@ -43,7 +44,6 @@ import org.apache.sis.util.Localized;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.CorruptedObjectException;
 import org.apache.sis.util.collection.WeakValueHashMap;
-import org.apache.sis.util.iso.DefaultNameSpace;
 
 
 /**
@@ -966,7 +966,7 @@ public class UnitFormat extends Format i
                     failure = e;
                 }
                 throw (ParserException) new ParserException(Errors.format(Errors.Keys.UnknownUnit_1,
-                        Constants.EPSG + DefaultNameSpace.DEFAULT_SEPARATOR + code),
+                        Constants.EPSG + Citations.DEFAULT_SEPARATOR + code),
                         symbols, start + Math.max(0, uom.lastIndexOf(code))).initCause(failure);
             }
             /*

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -24,7 +24,7 @@ import java.util.NoSuchElementException;
 import java.io.Serializable;
 import java.lang.reflect.Modifier;
 import org.opengis.util.CodeList;
-import org.apache.sis.util.iso.Types;
+import org.apache.sis.internal.util.CodeLists;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.internal.util.CheckedArrayList;
@@ -138,7 +138,7 @@ public class CodeListSet<E extends CodeL
     public CodeListSet(final Class<E> elementType, final boolean fill) throws IllegalArgumentException {
         this(elementType);
         if (fill) {
-            codes = POOL.unique(Types.getCodeValues(elementType));
+            codes = POOL.unique(CodeLists.values(elementType));
             int n = codes.length;
             if (n < Long.SIZE) {
                 values = (1L << n) - 1;
@@ -169,7 +169,7 @@ public class CodeListSet<E extends CodeL
     final E valueOf(final int ordinal) {
         E[] array = codes;
         if (array == null || ordinal >= array.length) {
-            codes = array = POOL.unique(Types.getCodeValues(elementType));
+            codes = array = POOL.unique(CodeLists.values(elementType));
         }
         return array[ordinal];
     }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -22,9 +22,9 @@ import java.io.Serializable;
 import java.io.ObjectStreamException;
 import java.io.InvalidObjectException;
 import org.opengis.util.InternationalString;
-import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.iso.SimpleInternationalString;
 
 
 /**
@@ -92,7 +92,7 @@ import org.apache.sis.util.resources.Voc
  * The constants defined in this class use a similar approach for providing serialization support.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  *
  * @param <V>  base type of all values in the column identified by this instance.
  *
@@ -277,7 +277,11 @@ public class TableColumn<V> implements C
      * @return the text to display as column header.
      */
     public synchronized InternationalString getHeader() {
-        final InternationalString i18n = Types.toInternationalString(header);
+        CharSequence t = header;
+        if (t == null || t instanceof InternationalString) {
+            return (InternationalString) t;
+        }
+        final InternationalString i18n = new SimpleInternationalString(t.toString());
         header = i18n;
         return i18n;
     }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -41,13 +41,13 @@ import org.apache.sis.io.LineAppender;
 import org.apache.sis.io.TableAppender;
 import org.apache.sis.io.TabularFormat;
 import org.apache.sis.io.CompoundFormat;
-import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.internal.util.Acyclic;
+import org.apache.sis.internal.util.MetadataServices;
 import org.apache.sis.internal.util.LocalizedParseException;
 
 import static org.apache.sis.util.Characters.NO_BREAK_SPACE;
@@ -680,7 +680,7 @@ public class TreeTableFormat extends Tab
             } else if (value instanceof CharSequence) {
                 text = value.toString();
             } else if (value instanceof ControlledVocabulary) {
-                text = Types.getCodeTitle((ControlledVocabulary) value).toString(getDisplayLocale());
+                text = MetadataServices.getInstance().getCodeTitle((ControlledVocabulary) value, getDisplayLocale());
             } else if (value instanceof Enum<?>) {
                 text = CharSequences.upperCaseToSentence(((Enum<?>) value).name());
             } else if (value instanceof Type) {

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -42,6 +42,7 @@ import java.util.logging.LogRecord;
  *
  * @see WarningListeners
  * @see org.apache.sis.storage.DataStore#addWarningListener(WarningListener)
+ * @see org.apache.sis.storage.event.ChangeListener
  *
  * @since 0.3
  * @module

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -38,9 +38,11 @@ import org.apache.sis.util.Classes;
 import org.apache.sis.util.Localized;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.MetadataServices;
+import org.apache.sis.measure.RangeFormat;
+import org.apache.sis.measure.Range;
 
 
 /**
@@ -69,7 +71,7 @@ import org.apache.sis.internal.system.Lo
  * multiple threads.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -418,7 +420,10 @@ public class IndexedResourceBundle exten
             } else if (element instanceof Class<?>) {
                 replacement = Classes.getShortName(getPublicType((Class<?>) element));
             } else if (element instanceof ControlledVocabulary) {
-                replacement = Types.getCodeTitle((ControlledVocabulary) element).toString(getLocale());
+                replacement = MetadataServices.getInstance().getCodeTitle((ControlledVocabulary) element, getLocale());
+            } else if (element instanceof Range<?>) {
+                final Range<?> range = (Range<?>) element;
+                replacement = new RangeFormat(getLocale(), range.getElementType()).format(range);
             }
             /*
              * No need to check for Numbers or Dates instances, since they are

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -21,8 +21,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
-import org.apache.sis.internal.simple.SimpleCitation;
-import org.apache.sis.internal.simple.SimpleIdentifier;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -41,25 +39,17 @@ public final strictfp class CitationsTes
     /**
      * Creates a citation with the given title and the given identifiers.
      */
-     @SuppressWarnings("serial")
-     private static SimpleCitation citation(final String title, final Identifier... identifiers) {
-        return new SimpleCitation(title) {
-            @Override public List<Identifier> getIdentifiers() {
-                return Arrays.asList(identifiers);
-            }
-        };
+     private static CitationMock citation(final String title, final Identifier... identifiers) {
+        CitationMock cit =  new CitationMock(title, null, null);
+        cit.identifiers = Arrays.asList(identifiers);
+        return cit;
     }
 
     /**
      * Creates an identifier with a code space.
      */
-     @SuppressWarnings("serial")
      private static Identifier identifier(final String codeSpace, final String code) {
-        return new SimpleIdentifier(null, code, false) {
-            @Override public String getCodeSpace() {
-                return codeSpace;
-            }
-        };
+        return new CitationMock(null, codeSpace, code);
     }
 
     /**
@@ -97,11 +87,11 @@ public final strictfp class CitationsTes
      */
     @Test
     public void testGetIdentifier() {
-        SimpleCitation citation = new SimpleCitation(" Not an identifier ");
+        CitationMock citation = new CitationMock(" Not an identifier ", null, null);
         assertEquals("Not an identifier", Citations.getIdentifier(citation, false));
         assertNull(Citations.getIdentifier(citation, true));
 
-        citation = new SimpleCitation(" ValidIdentifier ");
+        citation = new CitationMock(" ValidIdentifier ", null, null);
         assertEquals("ValidIdentifier", Citations.getIdentifier(citation, false));
         assertEquals("ValidIdentifier", Citations.getIdentifier(citation, true));
         /*

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/LocalizedParseExceptionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/LocalizedParseExceptionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/LocalizedParseExceptionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/LocalizedParseExceptionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -22,7 +22,6 @@ import java.text.ParsePosition;
 import org.apache.sis.measure.Angle;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.Exceptions;
-import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -37,7 +36,6 @@ import static org.junit.Assert.*;
  * @since   0.3
  * @module
  */
-@DependsOn(org.apache.sis.util.resources.IndexedResourceBundleTest.class)
 public final strictfp class LocalizedParseExceptionTest extends TestCase {
     /**
      * Tests the {@link LocalizedParseException} constructor using the default string.

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -34,7 +34,7 @@ import static org.junit.Assert.*;
  * Tests the {@link Numerics} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -69,6 +69,15 @@ public final strictfp class NumericsTest
     }
 
     /**
+     * Tests {@link Numerics#isSimplePrecision(double[])}.
+     */
+    @Test
+    public void testIsSimplePrecision() {
+        assertTrue (Numerics.isSimplePrecision(2, 0.5, 0.25, Double.NaN, Double.POSITIVE_INFINITY));
+        assertFalse(Numerics.isSimplePrecision(2, 0.5, 1.0 / 3));
+    }
+
+    /**
      * Tests the {@link Numerics#epsilonEqual(double, double, ComparisonMode)} method.
      */
     @Test
@@ -162,4 +171,17 @@ public final strictfp class NumericsTest
         final float recomposed = StrictMath.scalb((float) expected, e);
         assertEquals(value, StrictMath.copySign(recomposed, value), 0f);
     }
+
+    /**
+     * Tests {@link Numerics#suggestFractionDigits(double[][])}.
+     */
+    @Test
+    public void testSuggestFractionDigits() {
+        final int[] f = Numerics.suggestFractionDigits(new double[][] {
+            {10, 100,   0.1, 1000.1},
+            {15, 140.1, 0.4, Double.NaN},
+            {20, 400,   0.5, Double.NaN}
+        });
+        assertArrayEquals(new int[] {0, -2, 1, 3}, f);
+    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -34,8 +34,6 @@ import java.io.ObjectOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import javax.swing.tree.TreeNode;
-import javax.xml.parsers.ParserConfigurationException;
-import org.xml.sax.SAXException;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ComparisonMode;
@@ -48,7 +46,7 @@ import org.apache.sis.util.Classes;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -354,102 +352,6 @@ public strictfp class Assert extends org
     }
 
     /**
-     * Parses two XML trees as DOM documents, and compares the nodes.
-     * The inputs given to this method can be any of the following types:
-     *
-     * <ul>
-     *   <li>{@link org.w3c.dom.Node}: used directly without further processing.</li>
-     *   <li>{@link java.io.File}, {@link java.net.URL} or {@link java.net.URI}: the
-     *       stream is opened and parsed as a XML document.</li>
-     *   <li>{@link String}: The string content is parsed directly as a XML document.</li>
-     * </ul>
-     *
-     * The comparison will ignore comments and the optional attributes given in arguments.
-     *
-     * <div class="section">Ignored attributes substitution</div>
-     * For convenience, this method replaces some well known prefixes in the {@code ignoredAttributes}
-     * array by their full namespace URLs. For example this method replaces{@code "xsi:schemaLocation"}
-     * by {@code "http://www.w3.org/2001/XMLSchema-instance:schemaLocation"}.
-     * If such substitution is not desired, consider using {@link XMLComparator} directly instead.
-     *
-     * <p>The current substitution map is as below (may be expanded in any future SIS version):</p>
-     *
-     * <table class="sis">
-     *   <caption>Predefined prefix mapping</caption>
-     *   <tr><th>Prefix</th> <th>URL</th></tr>
-     *   <tr><td>xmlns</td>  <td>{@code "http://www.w3.org/2000/xmlns"}</td></tr>
-     *   <tr><td>xlink</td>  <td>{@value org.apache.sis.xml.Namespaces#XLINK}</td></tr>
-     *   <tr><td>xsi</td>    <td>{@value org.apache.sis.xml.Namespaces#XSI}</td></tr>
-     *   <tr><td>gml</td>    <td>{@value org.apache.sis.xml.Namespaces#GML}</td></tr>
-     *   <tr><td>gmd</td>    <td>{@value org.apache.sis.xml.Namespaces#GMD}</td></tr>
-     *   <tr><td>gmx</td>    <td>{@value org.apache.sis.xml.Namespaces#GMX}</td></tr>
-     *   <tr><td>gmi</td>    <td>{@value org.apache.sis.xml.Namespaces#GMI}</td></tr>
-     *   <tr><td>gco</td>    <td>{@value org.apache.sis.xml.Namespaces#GCO}</td></tr>
-     * </table>
-     *
-     * <p>For example in order to ignore the namespace, type and schema location declaration,
-     * the following strings can be given to the {@code ignoredAttributes} argument:</p>
-     *
-     * {@preformat text
-     *   "xmlns:*", "xsi:schemaLocation", "xsi:type"
-     * }
-     *
-     * @param  expected           the expected XML document.
-     * @param  actual             the XML document to compare.
-     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
-     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
-     *
-     * @see XMLComparator
-     */
-    public static void assertXmlEquals(final Object expected, final Object actual, final String... ignoredAttributes) {
-        assertXmlEquals(expected, actual, TestCase.STRICT, null, ignoredAttributes);
-    }
-
-    /**
-     * Parses two XML trees as DOM documents, and compares the nodes with the given tolerance
-     * threshold for numerical values. The inputs given to this method can be any of the types
-     * documented {@linkplain #assertXmlEquals(Object, Object, String[]) above}. This method
-     * will ignore comments and the optional attributes given in arguments as documented in the
-     * above method.
-     *
-     * @param  expected           the expected XML document.
-     * @param  actual             the XML document to compare.
-     * @param  tolerance          the tolerance threshold for comparison of numerical values.
-     * @param  ignoredNodes       the fully-qualified names of the nodes to ignore, or {@code null} if none.
-     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
-     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
-     *
-     * @see XMLComparator
-     */
-    public static void assertXmlEquals(final Object expected, final Object actual,
-            final double tolerance, final String[] ignoredNodes, final String[] ignoredAttributes)
-    {
-        final XMLComparator comparator;
-        try {
-            comparator = new XMLComparator(expected, actual);
-        } catch (IOException | ParserConfigurationException | SAXException e) {
-            // We don't throw directly those exceptions since failing to parse the XML file can
-            // be considered as part of test failures and the JUnit exception for such failures
-            // is AssertionError. Having no checked exception in "assert" methods allow us to
-            // declare the checked exceptions only for the library code being tested.
-            throw new AssertionError(e);
-        }
-        comparator.tolerance = tolerance;
-        comparator.ignoreComments = true;
-        if (ignoredNodes != null) {
-            for (final String node : ignoredNodes) {
-                comparator.ignoredNodes.add(XMLComparator.substitutePrefix(node));
-            }
-        }
-        if (ignoredAttributes != null) {
-            for (final String attribute : ignoredAttributes) {
-                comparator.ignoredAttributes.add(XMLComparator.substitutePrefix(attribute));
-            }
-        }
-        comparator.compare();
-    }
-
-    /**
      * Serializes the given object in memory, deserializes it and ensures that the deserialized
      * object is equals to the original one. This method does not write anything to the disk.
      *

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -25,7 +25,7 @@ import org.junit.BeforeClass;
  * All tests from the {@code sis-utility} module, in approximative dependency order.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -33,7 +33,6 @@ import org.junit.BeforeClass;
     // Following are testing the test tools.
     org.apache.sis.internal.test.AssertTest.class,
     org.apache.sis.internal.test.TestUtilitiesTest.class,
-    org.apache.sis.internal.test.XMLComparatorTest.class,
 
     // Most basic functions of SIS library.
     org.apache.sis.internal.system.LoggersTest.class,
@@ -88,19 +87,9 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.util.DefinitionURITest.class,
     org.apache.sis.internal.util.XPathsTest.class,
     org.apache.sis.internal.util.CitationsTest.class,
-    org.apache.sis.util.iso.TypesTest.class,
     org.apache.sis.util.iso.SimpleInternationalStringTest.class,
     org.apache.sis.util.iso.DefaultInternationalStringTest.class,
     org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
-    org.apache.sis.util.iso.DefaultLocalNameTest.class,
-    org.apache.sis.util.iso.DefaultScopedNameTest.class,
-    org.apache.sis.util.iso.DefaultNameFactoryTest.class,
-    org.apache.sis.util.iso.NamesTest.class,
-    org.apache.sis.util.iso.TypeNamesTest.class,
-    org.apache.sis.internal.simple.SimpleIdentifierTest.class,
-    org.apache.sis.util.iso.DefaultRecordTypeTest.class,
-    org.apache.sis.util.iso.DefaultRecordSchemaTest.class,
-    org.apache.sis.util.iso.DefaultRecordTest.class,
 
     // Measurements and formatting.
     org.apache.sis.measure.SexagesimalConverterTest.class,
@@ -140,27 +129,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.converter.ArrayConverterTest.class,
     org.apache.sis.internal.converter.ConverterRegistryTest.class,
     org.apache.sis.internal.converter.SystemRegistryTest.class,
-    org.apache.sis.internal.converter.NumberConverterTest.class,        // Shall be after SystemRegistryTest.
-
-    // XML most basic types.
-    org.apache.sis.xml.NamespacesTest.class,
-    org.apache.sis.xml.XLinkTest.class,
-    org.apache.sis.xml.NilReasonTest.class,
-    org.apache.sis.xml.LegacyCodesTest.class,
-    org.apache.sis.xml.ValueConverterTest.class,
-    org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
-    org.apache.sis.xml.MarshallerPoolTest.class,
-    org.apache.sis.xml.TransformingNamespacesTest.class,
-    org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
-    org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class,
-    org.apache.sis.internal.jaxb.ModifiableIdentifierMapTest.class,
-    org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
-    org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class,
-    org.apache.sis.internal.jaxb.gmd.EnumAdapterTest.class,
-    org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class,
-    org.apache.sis.internal.jaxb.gml.TimePeriodTest.class,
-    org.apache.sis.internal.jaxb.gml.MeasureTest.class,
-    org.apache.sis.util.iso.NameMarshallingTest.class
+    org.apache.sis.internal.converter.NumberConverterTest.class         // Shall be after SystemRegistryTest.
 })
 public final strictfp class UtilityTestSuite extends TestSuite {
     /**

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.util;
 
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -76,14 +75,18 @@ public final strictfp class VersionTest
      */
     @Test
     public void testGML() {
-        assertTrue(LegacyNamespaces.VERSION_3_2.compareTo(LegacyNamespaces.VERSION_3_2_1, 2) == 0);
-        assertTrue(LegacyNamespaces.VERSION_3_2.compareTo(LegacyNamespaces.VERSION_3_2_1   )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1   )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1, 2)  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1, 1) == 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2     )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2,   2)  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2,   1) == 0);
+        final Version V3_0   = new Version("3.0"),
+                      V3_2   = new Version("3.2"),
+                      V3_2_1 = new Version("3.2.1");
+
+        assertTrue(V3_2.compareTo(V3_2_1, 2) == 0);
+        assertTrue(V3_2.compareTo(V3_2_1   )  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1   )  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1, 2)  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1, 1) == 0);
+        assertTrue(V3_0.compareTo(V3_2     )  < 0);
+        assertTrue(V3_0.compareTo(V3_2,   2)  < 0);
+        assertTrue(V3_0.compareTo(V3_2,   1) == 0);
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -26,7 +26,6 @@ import org.opengis.referencing.cs.AxisDi
 import org.opengis.metadata.citation.OnLineFunction;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.util.iso.LargeCodeList;
 import org.junit.Test;
 
 import static org.junit.Assert.*;

Modified: sis/branches/JDK9/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/build.xml?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/build.xml Fri Mar  9 11:00:27 2018
@@ -69,10 +69,10 @@
       <!-- Other resources (properties files, SQL scripts, native libraries). -->
       <fileset dir="${project.root}/core/sis-utility/src/main/resources">
         <include name="**/*.properties"/>
-        <include name="**/*.lst"/>
       </fileset>
       <fileset dir="${project.root}/core/sis-metadata/src/main/resources">
         <include name="**/*.sql"/>
+        <include name="**/*.lst"/>
       </fileset>
       <fileset dir="${project.root}/core/sis-referencing/src/main/resources">
         <include name="**/*.sql"/>



Mime
View raw message