sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1803070 [8/20] - in /sis/branches/JDK9: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/ core/sis-build-helper/src/main/java/org/apache/sis/internal/book/ core/sis-build-helper/src/main/java/org/apach...
Date Wed, 26 Jul 2017 16:14:14 GMT
Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeChildrenTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeChildrenTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeChildrenTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeChildrenTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -16,25 +16,28 @@
  */
 package org.apache.sis.metadata;
 
+import java.util.Date;
 import java.util.Random;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
-import org.opengis.metadata.Metadata;
+import java.util.Collections;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.citation.DateType;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.collection.DefaultTreeTable;
 import org.apache.sis.util.collection.TableColumn;
 import org.apache.sis.util.collection.TreeTable;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static java.util.Collections.singleton;
-import static org.apache.sis.test.TestUtilities.createRandomNumberGenerator;
 
 
 /**
@@ -67,7 +70,7 @@ public final strictfp class TreeNodeChil
     static DefaultCitation metadataWithoutCollections() {
         final DefaultCitation citation = new DefaultCitation("Some title");
         citation.setEdition(new SimpleInternationalString("Some edition"));
-        citation.setOtherCitationDetails(singleton(new SimpleInternationalString("Some other details")));
+        citation.setOtherCitationDetails(Collections.singleton(new SimpleInternationalString("Some other details")));
         return citation;
     }
 
@@ -114,14 +117,42 @@ public final strictfp class TreeNodeChil
     }
 
     /**
+     * Creates a metadata object with a property than can be simplified.
+     * Strictly speaking, the metadata is:
+     *
+     * {@preformat text
+     *   DefaultCitation
+     *     └─Date
+     *        ├─Date………………… 2012-01-01
+     *        └─Date type…… Creation
+     * }
+     *
+     * However the tree view should simplify as:
+     *
+     * {@preformat text
+     *   DefaultCitation
+     *     └─Date………………………… 2012-01-01
+     *        └─Date type…… Creation
+     * }
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
+     */
+    static DefaultCitation metadataSimplifiable() {
+        final DefaultCitation citation = new DefaultCitation();
+        final DefaultCitationDate date = new DefaultCitationDate(TestUtilities.date("2012-01-01 00:00:00"), DateType.CREATION);
+        assertTrue(citation.getDates().add(date));
+        return citation;
+    }
+
+    /**
      * Creates a collection to be tested for the given metadata object and value policy.
      */
-    private static TreeNodeChildren create(final AbstractMetadata metadata, final ValueExistencePolicy valuePolicy) {
+    private static TreeNodeChildren create(final DefaultCitation citation, final ValueExistencePolicy valuePolicy) {
         final MetadataStandard standard = MetadataStandard.ISO_19115;
-        final TreeTableView    table    = new TreeTableView(standard, metadata, Metadata.class, valuePolicy);
+        final TreeTableView    table    = new TreeTableView(standard, citation, Citation.class, valuePolicy);
         final TreeNode         node     = (TreeNode) table.getRoot();
-        final PropertyAccessor accessor = standard.getAccessor(new CacheKey(metadata.getClass()), true);
-        return new TreeNodeChildren(node, metadata, accessor);
+        final PropertyAccessor accessor = standard.getAccessor(new CacheKey(citation.getClass()), true);
+        return new TreeNodeChildren(node, citation, accessor);
     }
 
     /**
@@ -136,6 +167,7 @@ public final strictfp class TreeNodeChil
             "Some edition",
             "Some other details"
         };
+        assertEquals("titleProperty", -1, children.titleProperty);
         assertFalse ("isEmpty()", children.isEmpty());
         assertEquals("size()", expected.length, children.size());
         assertAllNextEqual(expected, children.iterator());
@@ -157,6 +189,7 @@ public final strictfp class TreeNodeChil
             "PresentationForm[MAP_DIGITAL]",
             "Some other details"
         };
+        assertEquals("titleProperty", -1, children.titleProperty);
         assertFalse ("isEmpty()", children.isEmpty());
         assertEquals("size()", expected.length, children.size());
         assertAllNextEqual(expected, children.iterator());
@@ -180,6 +213,35 @@ public final strictfp class TreeNodeChil
             "PresentationForm[MAP_HARDCOPY]",
             "Some other details"
         };
+        assertEquals("titleProperty", -1, children.titleProperty);
+        assertFalse ("isEmpty()", children.isEmpty());
+        assertEquals("size()", expected.length, children.size());
+        assertAllNextEqual(expected, children.iterator());
+    }
+
+    /**
+     * Tests a metadata than can be simplified by displaying a child property value directly as the parent value.
+     */
+    @Test
+    @DependsOnMethod("testReadOnlyWithoutCollections")
+    public void testSimplifiable() {
+        final DefaultCitation  citation = metadataSimplifiable();
+        /*
+         *   DefaultCitation
+         *     └─Date
+         *        ├─Date………………… 2012-01-01
+         *        └─Date type…… Creation
+         *
+         * We need to perform the tests on the "Date" node, not on the "DefaultCitation" node.
+         */
+        final TreeTable.Node node = TestUtilities.getSingleton(create(citation, ValueExistencePolicy.COMPACT));
+        assertEquals("value", 1325376000000L, ((Date) node.getValue(TableColumn.VALUE)).getTime());
+        final TreeNodeChildren children = (TreeNodeChildren) node.getChildren();
+        final String[] expected = {
+            // The "Date" node should be omitted because merged with the parent "Date" node.
+            "DateType[CREATION]"
+        };
+        assertEquals("titleProperty", 0, children.titleProperty);
         assertFalse ("isEmpty()", children.isEmpty());
         assertEquals("size()", expected.length, children.size());
         assertAllNextEqual(expected, children.iterator());
@@ -193,6 +255,8 @@ public final strictfp class TreeNodeChil
     public void testAdd() {
         final DefaultCitation  citation = metadataWithMultiOccurrences();
         final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
+        assertEquals("titleProperty", -1, children.titleProperty);
+
         final DefaultTreeTable.Node toAdd = new DefaultTreeTable.Node(new DefaultTreeTable(
                 TableColumn.IDENTIFIER,
                 TableColumn.VALUE));
@@ -242,7 +306,8 @@ public final strictfp class TreeNodeChil
     public void testRemoveWithoutCollections() {
         final DefaultCitation  citation = metadataWithoutCollections();
         final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
-        testRemove(createRandomNumberGenerator(), children);
+        assertEquals("titleProperty", -1, children.titleProperty);
+        testRemove(TestUtilities.createRandomNumberGenerator(), children);
     }
 
     /**
@@ -257,7 +322,8 @@ public final strictfp class TreeNodeChil
     public void testRemoveWithSingletonInCollections() {
         final DefaultCitation  citation = metadataWithSingletonInCollections();
         final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
-        testRemove(createRandomNumberGenerator(), children);
+        assertEquals("titleProperty", -1, children.titleProperty);
+        testRemove(TestUtilities.createRandomNumberGenerator(), children);
     }
 
     /**
@@ -272,7 +338,8 @@ public final strictfp class TreeNodeChil
     public void testRemoveWithMultiOccurrences() {
         final DefaultCitation  citation = metadataWithSingletonInCollections();
         final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
-        testRemove(createRandomNumberGenerator(), children);
+        assertEquals("titleProperty", -1, children.titleProperty);
+        testRemove(TestUtilities.createRandomNumberGenerator(), children);
     }
 
     /**
@@ -282,9 +349,10 @@ public final strictfp class TreeNodeChil
     public void testClear() {
         final DefaultCitation  citation = metadataWithSingletonInCollections();
         final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
-        assertFalse(children.isEmpty());
+        assertEquals("titleProperty", -1, children.titleProperty);
+        assertFalse("isEmpty()", children.isEmpty());
         children.clear();
-        assertTrue(children.isEmpty());
+        assertTrue("isEmpty()", children.isEmpty());
         assertNull(citation.getTitle());
         assertTrue(citation.getAlternateTitles().isEmpty());
     }
@@ -316,6 +384,7 @@ public final strictfp class TreeNodeChil
             null, // onlineResources (collection)
             null  // graphics (collection)
         };
+        assertEquals("titleProperty", -1, children.titleProperty);
         assertFalse ("isEmpty()", children.isEmpty());
         assertEquals("size()", expected.length, children.size());
         assertAllNextEqual(expected, children.iterator());

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.metadata;
 
+import java.util.Arrays;
 import java.util.Locale;
 import org.opengis.metadata.citation.Address;
 import org.opengis.metadata.citation.Contact;
@@ -65,11 +66,11 @@ public final strictfp class TreeNodeTest
      *     ├─Alternate title (2 of 2)………………………………………… Second alternate title
      *     ├─Edition……………………………………………………………………………………… Some edition
      *     ├─Cited responsible party (1 of 2)
-     *     │   └─Party (Organisation)
+     *     │   └─Organisation
      *     │      ├─Name…………………………………………………………………………… Some organisation
      *     │      └─Role…………………………………………………………………………… Distributor
      *     ├─Cited responsible party (2 of 2)
-     *     │   └─Party (Individual)
+     *     │   └─Individual
      *     │      ├─Name…………………………………………………………………………… Some person of contact
      *     │      ├─Contact info
      *     │      │   └─Address
@@ -98,11 +99,14 @@ public final strictfp class TreeNodeTest
     }
 
     /**
+     * The policy to be given to {@link TreeTableView} constructor.
+     */
+    private ValueExistencePolicy valuePolicy = ValueExistencePolicy.NON_EMPTY;
+
+    /**
      * Creates a node to be tested for the given metadata object and value policy.
      */
-    private static <T extends AbstractMetadata> TreeNode create(final T metadata,
-            final Class<? super T> baseType, final ValueExistencePolicy valuePolicy)
-    {
+    private <T extends AbstractMetadata> TreeNode create(final T metadata, final Class<? super T> baseType) {
         final MetadataStandard  standard = MetadataStandard.ISO_19115;
         final TreeTableView table = new TreeTableView(standard, metadata, baseType, valuePolicy);
         return (TreeNode) table.getRoot();
@@ -114,7 +118,7 @@ public final strictfp class TreeNodeTest
     @Test
     public void testRootNode() {
         final DefaultCitation citation = TreeNodeChildrenTest.metadataWithoutCollections();
-        final TreeNode node = create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY);
+        final TreeNode node = create(citation, Citation.class);
         assertEquals("getName()",        "Citation",     node.getName());
         assertEquals("getIdentifier()",  "CI_Citation",  node.getIdentifier());
         assertEquals("baseType",         Citation.class, node.baseType);
@@ -124,9 +128,10 @@ public final strictfp class TreeNodeTest
         assertFalse ("isLeaf()",                         node.isLeaf());
 
         final TreeNodeChildren children = (TreeNodeChildren) node.getChildren();
-        assertSame ("children.metadata", citation, children.metadata);
-        assertFalse("children.isEmpty()", node.getChildren().isEmpty());
-        assertSame ("children.parent", node, children.iterator().next().getParent());
+        assertEquals("children.titleProperty", -1, children.titleProperty);
+        assertSame  ("children.metadata", citation, children.metadata);
+        assertFalse ("children.isEmpty()", node.getChildren().isEmpty());
+        assertSame  ("children.parent", node, children.iterator().next().getParent());
     }
 
     /**
@@ -137,7 +142,7 @@ public final strictfp class TreeNodeTest
     @DependsOnMethod("testRootNode")            // Because tested more basic methods than 'getValue(TableColumn)'.
     public void testGetNameForSingleton() {
         final DefaultCitation citation = TreeNodeChildrenTest.metadataWithSingletonInCollections();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.NAME,
+        assertColumnContentEquals(create(citation, Citation.class), TableColumn.NAME,
             "Citation",
               "Title",
               "Alternate title",
@@ -154,7 +159,7 @@ public final strictfp class TreeNodeTest
     @DependsOnMethod("testGetNameForSingleton")
     public void testGetNameForMultiOccurrences() {
         final DefaultCitation citation = TreeNodeChildrenTest.metadataWithMultiOccurrences();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.NAME,
+        assertColumnContentEquals(create(citation, Citation.class), TableColumn.NAME,
             "Citation",
               "Title",
               "Alternate title (1 of 2)",
@@ -166,25 +171,50 @@ public final strictfp class TreeNodeTest
     }
 
     /**
+     * Compares the result of the given getter method invoked on all nodes of {@link #metadataWithHierarchy()}.
+     * In the particular case of the {@link TableColumn#NAME}, international strings are replaced by unlocalized
+     * strings before comparisons.
+     *
+     * <p>If {@link #valuePolicy} is {@link ValueExistencePolicy#COMPACT}, then this method removes the elements at
+     * indices 0, 6 and 10 (if {@code offset} = 0) or 1, 7 and 11 (if {@code offset} = 1) from the {@code expected}
+     * array before to perform the comparison.</p>
+     *
+     * @param  offset    0 if compact mode excludes the parent, or 1 if compact mode exclude the first child.
+     * @param  column    the column from which to get a value.
+     * @param  expected  the expected values. The first value is the result of the getter method
+     *                   applied on the given node, and all other values are the result of the
+     *                   getter method applied on the children, in iteration order.
+     */
+    private void assertCitationContentEquals(final int offset, final TableColumn<?> column, final Object... expected) {
+        if (valuePolicy == ValueExistencePolicy.COMPACT) {
+            assertEquals(19, expected.length);
+            System.arraycopy(expected, 11+offset, expected, 10+offset,  8-offset);    // Compact the "Individual" element.
+            System.arraycopy(expected,  7+offset, expected,  6+offset, 11-offset);    // Compact the "Organisation" element.
+            System.arraycopy(expected,  1+offset, expected,    offset, 16-offset);    // Compact the "Title" element.
+            Arrays.fill(expected, 16, 19, null);
+        }
+        assertColumnContentEquals(create(metadataWithHierarchy(), Citation.class), column, expected);
+    }
+
+    /**
      * Tests {@link TreeNode#getName()} on a metadata with a deeper hierarchy.
      */
     @Test
     @DependsOnMethod("testGetNameForMultiOccurrences")
     public void testGetNameForHierarchy() {
-        final DefaultCitation citation = metadataWithHierarchy();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.NAME,
+        assertCitationContentEquals(1, TableColumn.NAME,
             "Citation",
               "Title",
               "Alternate title (1 of 2)",
               "Alternate title (2 of 2)",
               "Edition",
               "Cited responsible party (1 of 2)",
-                "Party",
-                  "Name",
+                "Organisation",                         // A Party subtype
+                  "Name",                               // In COMPACT mode, this value is associated to "Organisation" node.
                 "Role",
               "Cited responsible party (2 of 2)",
-                "Party",
-                  "Name",
+                "Individual",                           // A Party subtype
+                  "Name",                               // In COMPACT mode, this value is associated to "Individual" node.
                   "Contact info",
                     "Address",
                       "Electronic mail address",
@@ -203,8 +233,7 @@ public final strictfp class TreeNodeTest
     @Test
     @DependsOnMethod("testGetNameForMultiOccurrences")     // Because similar to names, which were tested progressively.
     public void testGetIdentifier() {
-        final DefaultCitation citation = metadataWithHierarchy();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.IDENTIFIER,
+        assertCitationContentEquals(1, TableColumn.IDENTIFIER,
             "CI_Citation",
               "title",
               "alternateTitle",
@@ -212,11 +241,11 @@ public final strictfp class TreeNodeTest
               "edition",
               "citedResponsibleParty",
                 "party",
-                  "name",
+                  "name",                               // In COMPACT mode, this value is associated to "party" node.
                 "role",
               "citedResponsibleParty",
                 "party",
-                  "name",
+                  "name",                               // In COMPACT mode, this value is associated to "party" node.
                   "contactInfo",
                     "address",
                       "electronicMailAddress",
@@ -234,8 +263,7 @@ public final strictfp class TreeNodeTest
     public void testGetIndex() {
         final Integer ZERO = 0;
         final Integer ONE  = 1;
-        final DefaultCitation citation = metadataWithHierarchy();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.INDEX,
+        assertCitationContentEquals(1, TableColumn.INDEX,
             null,           // CI_Citation
               null,         // title
               ZERO,         // alternateTitle
@@ -243,11 +271,11 @@ public final strictfp class TreeNodeTest
               null,         // edition
               ZERO,         // citedResponsibleParty
                 ZERO,       // party (organisation)
-                  null,     // name
+                  null,     // name                         — in COMPACT mode, this value is associated to "party" node.
                 null,       // role
               ONE,          // citedResponsibleParty
                 ZERO,       // party (individual)
-                  null,     // name
+                  null,     // name                         — in COMPACT mode, this value is associated to "party" node.
                   ZERO,     // contactInfo
                     ZERO,   // address
                       ZERO, // electronicMailAddress
@@ -263,20 +291,19 @@ public final strictfp class TreeNodeTest
     @Test
     @DependsOnMethod("testGetIdentifier")       // Because if identifiers are wrong, we are looking at wrong properties.
     public void testGetElementType() {
-        final DefaultCitation citation = metadataWithHierarchy();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.TYPE,
+        assertCitationContentEquals(0, TableColumn.TYPE,
             Citation.class,
               InternationalString.class,
               InternationalString.class,
               InternationalString.class,
               InternationalString.class,
               Responsibility.class,
-                Party.class,
-                  InternationalString.class,
+                Party.class,                            // In COMPACT mode, value with be the one of "name" node instead.
+                  InternationalString.class,            // Name
                 Role.class,
               Responsibility.class,
-                Party.class,
-                  InternationalString.class,
+                Party.class,                            // In COMPACT mode, value with be the one of "name" node instead.
+                  InternationalString.class,            // Name
                   Contact.class,
                     Address.class,
                       String.class,
@@ -292,22 +319,21 @@ public final strictfp class TreeNodeTest
     @Test
     @DependsOnMethod("testGetIdentifier")       // Because if identifiers are wrong, we are looking at wrong properties.
     public void testGetValue() {
-        final DefaultCitation citation = metadataWithHierarchy();
-        assertColumnContentEquals(create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY), TableColumn.VALUE,
-            null, // Citation
+        assertCitationContentEquals(0, TableColumn.VALUE,
+            null,                               // Citation
               "Some title",
               "First alternate title",
               "Second alternate title",
               "Some edition",
-              null, // ResponsibleParty
-                null, // Party (organisation)
+              null,                             // ResponsibleParty
+                null,                           // Party (organisation)
                   "Some organisation",
                 Role.DISTRIBUTOR,
-              null, // ResponsibleParty
-                null, // Party (individual)
+              null,                             // ResponsibleParty
+                null,                           // Party (individual)
                   "Some person of contact",
-                  null, // Contact
-                    null, // Address
+                  null,                         // Contact
+                    null,                       // Address
                       "Some email",
                 Role.POINT_OF_CONTACT,
               PresentationForm.MAP_DIGITAL,
@@ -322,7 +348,7 @@ public final strictfp class TreeNodeTest
     @DependsOnMethod("testGetValue")
     public void testNewChild() {
         final DefaultCitation citation = metadataWithHierarchy();
-        final TreeNode node = create(citation, Citation.class, ValueExistencePolicy.NON_EMPTY);
+        final TreeNode node = create(citation, Citation.class);
         /*
          * Ensure that we can not overwrite existing nodes.
          */
@@ -359,35 +385,57 @@ public final strictfp class TreeNodeTest
      * on all children of that given. In the particular case of the {@link TableColumn#NAME},
      * international strings are replaced by unlocalized strings before comparisons.
      *
-     * @param  node     the node for which to test the children.
-     * @param  column   the column from which to get a value.
-     * @param  values   the expected values. The first value is the result of the getter method
-     *                  applied on the given node, and all other values are the result of the
-     *                  getter method applied on the children, in iteration order.
+     * @param  node      the node for which to test the children.
+     * @param  column    the column from which to get a value.
+     * @param  expected  the expected values. The first value is the result of the getter method
+     *                   applied on the given node, and all other values are the result of the
+     *                   getter method applied on the children, in iteration order.
      */
-    private static void assertColumnContentEquals(final TreeNode node,
-            final TableColumn<?> column, final Object... values)
+    private void assertColumnContentEquals(final TreeNode node,
+            final TableColumn<?> column, final Object... expected)
     {
-        assertEquals("Missing values in the tested metadata.", values.length,
-                assertColumnContentEquals(node, column, values, 0));
+        int count = expected.length;
+        if (valuePolicy == ValueExistencePolicy.COMPACT) {
+            while (expected[count-1] == null) count--;
+        }
+        assertEquals("Missing values in the tested metadata.", count,
+                assertColumnContentEquals(node, column, expected, 0));
     }
 
     /**
      * Implementation of the above {@code assertGetterReturns}, to be invoked recursively.
+     *
+     * @return number of nodes found in the given metadata tree.
      */
     private static int assertColumnContentEquals(final TreeTable.Node node, final TableColumn<?> column,
-            final Object[] values, int index)
+            final Object[] expected, int index)
     {
         final Object actual = node.getValue(column);
         Object unlocalized = actual;
         if (unlocalized instanceof InternationalString) {
             unlocalized = ((InternationalString) unlocalized).toString(Locale.ROOT);
         }
-        assertEquals("values[" + index + ']', values[index++], unlocalized);
+        assertEquals("values[" + index + ']', expected[index++], unlocalized);
         for (final TreeTable.Node child : node.getChildren()) {
-            index = assertColumnContentEquals(child, column, values, index);
+            index = assertColumnContentEquals(child, column, expected, index);
         }
         assertSame("Value shall be stable.", actual, node.getValue(column));
         return index;
     }
+
+    /**
+     * Same tests but using {@link ValueExistencePolicy#COMPACT}.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
+     */
+    @Test
+    @DependsOnMethod({"testGetNameForHierarchy", "testGetIdentifier", "testGetIndex", "testGetElementType", "testGetValue"})
+    public void testCompactPolicy() {
+        valuePolicy = ValueExistencePolicy.COMPACT;
+        testGetNameForHierarchy();
+        testGetIdentifier();
+        testGetIndex();
+        testGetElementType();
+        testGetValue();
+    }
 }

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -44,7 +44,7 @@ import static org.apache.sis.test.Assert
  * Tests the {@link TreeTableFormat} applied to the formatting of metadata tree.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -76,31 +76,27 @@ public final strictfp class TreeTableFor
 
     /**
      * Tests the formatting of a {@link DefaultCitation} object.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-298">SIS-298</a>
      */
     @Test
     public void testCitation() {
         final DefaultCitation citation = DefaultCitationTest.create();
         final String text = format.format(citation.asTreeTable());
         assertMultilinesEquals(
-            "Citation\n" +
-            "  ├─Title…………………………………………………………………………… Undercurrent\n" +
+            "Citation……………………………………………………………………………… Undercurrent\n" +
             "  ├─Alternate title………………………………………………… Andākarento\n" +
-            "  ├─Identifier\n" +
-            "  │   ├─Authority\n" +
-            "  │   │   ├─Title……………………………………………………… International Standard Book Number\n" +
+            "  ├─Identifier……………………………………………………………… 9782505004509\n" +
+            "  │   ├─Authority……………………………………………………… International Standard Book Number\n" +
             "  │   │   └─Alternate title…………………………… ISBN\n" +
-            "  │   ├─Code…………………………………………………………………… 9782505004509\n" +
             "  │   └─Code space…………………………………………………… ISBN\n"+
             "  ├─Cited responsible party (1 of 2)\n" +
-            "  │   ├─Party\n" +
-            "  │   │   └─Name………………………………………………………… Testsuya Toyoda\n" +
+            "  │   ├─Individual…………………………………………………… Testsuya Toyoda\n" +
             "  │   └─Role…………………………………………………………………… Author\n" +
             "  ├─Cited responsible party (2 of 2)\n" +
-            "  │   ├─Party\n" +
-            "  │   │   └─Name………………………………………………………… Kōdansha\n" +
+            "  │   ├─Organisation……………………………………………… Kōdansha\n" +
             "  │   ├─Role…………………………………………………………………… Editor\n" +
-            "  │   └─Extent\n" +
-            "  │       ├─Description……………………………………… World\n" +
+            "  │   └─Extent……………………………………………………………… World\n" +
             "  │       └─Geographic element\n" +
             "  │           ├─West bound longitude…… 180°W\n" +
             "  │           ├─East bound longitude…… 180°E\n" +
@@ -128,8 +124,7 @@ public final strictfp class TreeTableFor
         final String text = format.format(processing.asTreeTable());
         assertMultilinesEquals(
             "Processing\n" +
-            "  ├─Documentation (1 of 3)\n" +
-            "  │   ├─Title……………………………………………… Some specification\n" +
+            "  ├─Documentation (1 of 3)…………… Some specification\n" +
             "  │   └─Presentation form……………… Document hardcopy\n" +
             "  ├─Documentation (2 of 3)\n" +
             "  │   └─Presentation form……………… Image hardcopy\n" +

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -54,18 +54,15 @@ public final strictfp class TreeTableVie
      * with {@link ValueExistencePolicy#NON_EMPTY}.
      */
     private static final String EXPECTED =
-            "Citation\n" +
-            "  ├─Title……………………………………………………………………………………………… Some title\n" +
+            "Citation………………………………………………………………………………………………… Some title\n" +
             "  ├─Alternate title (1 of 2)…………………………………………… First alternate title\n" +
             "  ├─Alternate title (2 of 2)…………………………………………… Second alternate title\n" +
             "  ├─Edition………………………………………………………………………………………… Some edition\n" +
             "  ├─Cited responsible party (1 of 2)\n" +
-            "  │   ├─Party\n" +
-            "  │   │   └─Name…………………………………………………………………………… Some organisation\n" +
+            "  │   ├─Organisation………………………………………………………………… Some organisation\n" +
             "  │   └─Role……………………………………………………………………………………… Distributor\n" +
             "  ├─Cited responsible party (2 of 2)\n" +
-            "  │   ├─Party\n" +
-            "  │   │   ├─Name…………………………………………………………………………… Some person of contact\n" +
+            "  │   ├─Individual……………………………………………………………………… Some person of contact\n" +
             "  │   │   └─Contact info\n" +
             "  │   │       └─Address\n" +
             "  │   │           └─Electronic mail address…… Some email\n" +
@@ -81,9 +78,9 @@ public final strictfp class TreeTableVie
      */
     @Test
     public void testToString() {
-        final TreeTableView metadata = create(ValueExistencePolicy.NON_EMPTY);
-        assertMultilinesEquals(EXPECTED, formatNameAndValue(metadata)); // Locale-independent
-        assertArrayEquals(toTreeStructure(EXPECTED), toTreeStructure(metadata.toString())); // Locale-dependent.
+        final TreeTableView metadata = create(ValueExistencePolicy.COMPACT);
+        assertMultilinesEquals(EXPECTED, formatNameAndValue(metadata));                         // Locale-independent
+        assertArrayEquals(toTreeStructure(EXPECTED), toTreeStructure(metadata.toString()));     // Locale-dependent.
     }
 
     /**
@@ -94,7 +91,7 @@ public final strictfp class TreeTableVie
     @Test
     @DependsOnMethod("testToString")
     public void testSerialization() throws Exception {
-        final Object original = create(ValueExistencePolicy.NON_EMPTY);
+        final Object original = create(ValueExistencePolicy.COMPACT);
         final Object deserialized;
         final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         try (ObjectOutputStream out = new ObjectOutputStream(buffer)) {

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -236,8 +236,8 @@ public final strictfp class AllMetadataT
     protected String getExpectedXmlElementName(final Class<?> enclosing, final UML uml) {
         String name = super.getExpectedXmlElementName(enclosing, uml);
         switch (name) {
-            case "MD_Scope": {      // ISO 19115:2014
-                name = "DQ_Scope";  // ISO 19115:2003
+            case "MD_Scope": {                  // ISO 19115:2014
+                name = "DQ_Scope";              // ISO 19115:2003
                 break;
             }
             case "distributedComputingPlatform": {

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -55,7 +55,7 @@ public final strictfp class CitationsTes
         assertSame(IOGP,             fromName("OGP"));
         assertSame(ESRI,             fromName("ESRI"));          // Handled in a way very similar to "OGC".
         assertSame(NETCDF,           fromName("NetCDF"));
-        assertSame(GEOTIFF,          fromName("GeoTIFF"));
+        assertSame(GEOTIFF,          fromName(Constants.GEOTIFF));
         assertSame(PROJ4,            fromName("Proj.4"));
         assertSame(PROJ4,            fromName("Proj4"));
         assertSame(MAP_INFO,         fromName("MapInfo"));

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -135,27 +135,22 @@ public final strictfp class DefaultDataI
     public void testToString() {
         assertMultilinesEquals(
                 "Data identification\n" +
-                "  ├─Citation\n" +
-                "  │   ├─Title……………………………………………………… Sea Surface Temperature Analysis Model\n" +
-                "  │   ├─Date\n" +
-                "  │   │   ├─Date……………………………………………… 2005-09-22 00:00:00\n" +
+                "  ├─Citation………………………………………………………… Sea Surface Temperature Analysis Model\n" +
+                "  │   ├─Date………………………………………………………… 2005-09-22 00:00:00\n" +
                 "  │   │   └─Date type………………………………… Creation\n" +
-                "  │   └─Identifier\n" +
-                "  │       └─Code……………………………………………… SST_Global.nc\n" +
+                "  │   └─Identifier………………………………………… SST_Global.nc\n" +
                 "  ├─Abstract………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data\n" +
                 "  ├─Descriptive keywords\n" +
                 "  │   ├─Keyword………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature\n" +
                 "  │   ├─Type………………………………………………………… Theme\n" +
-                "  │   └─Thesaurus name\n" +
-                "  │       └─Title…………………………………………… GCMD Science Keywords\n" +
+                "  │   └─Thesaurus name……………………………… GCMD Science Keywords\n" +
                 "  ├─Resource constraints\n" +
                 "  │   └─Use limitation……………………………… Freely available\n" +
                 "  ├─Spatial representation type……… Grid\n" +
                 "  ├─Language (1 of 2)………………………………… en_US\n" +
                 "  ├─Language (2 of 2)………………………………… en\n" +
                 "  ├─Character set…………………………………………… US-ASCII\n" +
-                "  └─Extent\n" +
-                "      ├─Description……………………………………… World\n" +
+                "  └─Extent……………………………………………………………… World\n" +
                 "      └─Geographic element\n" +
                 "          ├─West bound longitude…… 180°W\n" +
                 "          ├─East bound longitude…… 180°E\n" +

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -52,8 +52,8 @@ public final strictfp class MetadataSour
      */
     @Test
     public void testOnDerby() throws Exception {
-        final DataSource ds = TestDatabase.create("temporary");
-        try (MetadataSource source = new MetadataSource(MetadataStandard.ISO_19115, ds, "metadata", null, null)) {
+        final DataSource ds = TestDatabase.create("MetadataSource");
+        try (MetadataSource source = new MetadataSource(MetadataStandard.ISO_19115, ds, "metadata", null)) {
             source.install();
             verifyFormats(source);
             testSearch(source);

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -106,7 +106,9 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.metadata.sql.SQLUtilitiesTest.class,
     org.apache.sis.internal.metadata.sql.TypeMapperTest.class,
     org.apache.sis.internal.metadata.sql.ScriptRunnerTest.class,
-    org.apache.sis.metadata.sql.MetadataSourceTest.class
+    org.apache.sis.metadata.sql.IdentifierGeneratorTest.class,
+    org.apache.sis.metadata.sql.MetadataSourceTest.class,
+    org.apache.sis.metadata.sql.MetadataWriterTest.class
 })
 public final strictfp class MetadataTestSuite extends TestSuite {
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -730,6 +730,9 @@ public abstract class AbstractEnvelope i
 
     /**
      * Returns {@code true} if this envelope completely encloses the specified envelope.
+     * The default implementation delegates to:
+     *
+     * <blockquote><pre>{@linkplain #contains(Envelope, boolean) contains}(envelope, <b>true</b>)</pre></blockquote>
      *
      * <div class="section">Pre-conditions</div>
      * This method assumes that the specified envelope uses the same CRS than this envelope.
@@ -764,10 +767,6 @@ public abstract class AbstractEnvelope i
      * <p>This method is subject to the same pre-conditions than {@link #contains(Envelope)},
      * and handles envelopes spanning the anti-meridian in the same way.</p>
      *
-     * <div class="warning"><b>Warning:</b> This method may change or be removed in a future SIS version.
-     * For API stability, use the {@link #contains(Envelope)} method instead.
-     * See <a href="http://issues.apache.org/jira/browse/SIS-172">SIS-172</a> for more information.</div>
-     *
      * @param  envelope        the envelope to test for inclusion.
      * @param  edgesInclusive  {@code true} if this envelope edges are inclusive.
      * @return {@code true} if this envelope completely encloses the specified one.
@@ -848,6 +847,11 @@ public abstract class AbstractEnvelope i
 
     /**
      * Returns {@code true} if this envelope intersects the specified envelope.
+     * This method returns {@code true} if two envelope <em>interiors</em> have at least one point in common
+     * (in other words, their intersection is non-{@linkplain #isEmpty() empty}).
+     * The default implementation delegates to:
+     *
+     * <blockquote><pre>{@linkplain #intersects(Envelope, boolean) intersects}(envelope, <b>false</b>)</pre></blockquote>
      *
      * <div class="section">Pre-conditions</div>
      * This method assumes that the specified envelope uses the same CRS than this envelope.
@@ -867,31 +871,36 @@ public abstract class AbstractEnvelope i
      * @since 0.4
      */
     public boolean intersects(final Envelope envelope) throws MismatchedDimensionException {
-        return intersects(envelope, true);
+        return intersects(envelope, false);
     }
 
     /**
-     * Returns {@code true} if this envelope intersects the specified envelope.
-     * If one or more edges from the specified envelope coincide with an edge from this envelope,
-     * then this method returns {@code true} only if {@code edgesInclusive} is {@code true}.
-     *
-     * <p>This method is subject to the same pre-conditions than {@link #intersects(Envelope)},
-     * and handles envelopes spanning the anti-meridian in the same way.</p>
+     * Returns {@code true} if this envelope intersects or (optionally) touches the specified envelope.
+     * The {@code touch} argument controls the value to return if only the envelope boundaries
+     * (not the interiors) have a point in common:
+     *
+     * <ul>
+     *   <li>If {@code false}, this method returns {@code true} if the intersection between the two envelopes
+     *       is non-{@linkplain #isEmpty() empty} (i.e. the envelope <em>interiors</em> have points in common).
+     *       This is the usual definition of {@code intersects} operation.</li>
+     *   <li>If {@code true}, this method returns {@code true} if the two envelopes intersect each other
+     *       <em>or</em> touch each other.</li>
+     * </ul>
      *
-     * <div class="warning"><b>Warning:</b> This method may change or be removed in a future SIS version.
-     * For API stability, use the {@link #intersects(Envelope)} method instead.
-     * See <a href="http://issues.apache.org/jira/browse/SIS-172">SIS-172</a> for more information.</div>
+     * This method is subject to the same pre-conditions than {@link #intersects(Envelope)},
+     * and handles envelopes spanning the anti-meridian in the same way.
      *
-     * @param  envelope        the envelope to test for intersection.
-     * @param  edgesInclusive  {@code true} if this envelope edges are inclusive.
-     * @return {@code true} if this envelope intersects the specified one.
-     * @throws MismatchedDimensionException if the specified envelope doesn't have the expected dimension.
+     * @param  envelope  the envelope to test for intersection.
+     * @param  touch     the value to return if the two envelopes touch each other.
+     * @return {@code true} if this envelope intersects the specified envelope, or
+     *         {@code touch} if this envelope touches the specified envelope, or {@code false} otherwise.
+     * @throws MismatchedDimensionException if the specified envelope does not have the expected dimension.
      * @throws AssertionError if assertions are enabled and the envelopes have mismatched CRS.
      *
      * @see #contains(Envelope, boolean)
      * @see #equals(Envelope, double, boolean)
      */
-    public boolean intersects(final Envelope envelope, final boolean edgesInclusive) throws MismatchedDimensionException {
+    public boolean intersects(final Envelope envelope, final boolean touch) throws MismatchedDimensionException {
         ensureNonNull("envelope", envelope);
         final int dimension = getDimension();
         ensureDimensionMatches("envelope", dimension, envelope);
@@ -905,7 +914,7 @@ public abstract class AbstractEnvelope i
             final double lower1 = lowerCorner.getOrdinate(i);
             final double upper1 = upperCorner.getOrdinate(i);
             final boolean lowerCondition, upperCondition;
-            if (edgesInclusive) {
+            if (touch) {
                 lowerCondition = (lower1 <= upper0);
                 upperCondition = (upper1 >= lower0);
             } else {
@@ -937,7 +946,7 @@ public abstract class AbstractEnvelope i
             }
             // The check for ArrayEnvelope.class is for avoiding never-ending callbacks.
             assert envelope.getClass() == ArrayEnvelope.class || hasNaN(envelope) ||
-                    !contains(new ArrayEnvelope(envelope), edgesInclusive) : envelope;
+                    !contains(new ArrayEnvelope(envelope), touch) : envelope;
             return false;
         }
         return true;

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -834,9 +834,10 @@ public class Envelope2D extends Rectangl
             }
             /*
              * See AbstractEnvelope.intersects(Envelope) for an illustration of the algorithm applied here.
+             * We use < operator, not <=, for consistency with the standard "intersects" definition.
              */
-            final boolean minCondition = (min1 <= min0 + span0);
-            final boolean maxCondition = (min1 + span1 >= min0);
+            final boolean minCondition = (min1 < min0 + span0);
+            final boolean maxCondition = (min1 + span1 > min0);
             if (maxCondition & minCondition) {
                 continue;
             }

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/package-info.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -81,6 +81,8 @@
  *       than an inclusion area.</li>
  * </ul>
  *
+ * @see org.apache.sis.setup.GeometryLibrary
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @version 0.8
  * @since   0.3

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -24,7 +24,10 @@ import javax.measure.quantity.Angle;
 import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
 import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
 import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
 import org.opengis.referencing.IdentifiedObject;
@@ -36,6 +39,7 @@ import org.apache.sis.internal.system.De
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
@@ -396,4 +400,36 @@ public final class ReferencingUtilities
                 factory.createDefiningConversion(properties,
                         factory.getOperationMethod(parameters.getDescriptor().getName().getCode()), parameters), cs);
     }
+
+    /**
+     * Returns the mapping between parameter identifiers and parameter names as defined by the given authority.
+     * This method assumes that the identifiers of all parameters defined by that authority are numeric.
+     * Examples of authorities defining numeric parameters are EPSG and GeoTIFF.
+     *
+     * <p>The map returned by this method is modifiable. Callers are free to add or remove entries.</p>
+     *
+     * @param  parameters  the parameters for which to get a mapping from identifiers to names.
+     * @param  authority   the authority defining the parameters.
+     * @return mapping from parameter identifiers to parameter names defined by the given authority.
+     * @throws NumberFormatException if a parameter identifier of the given authority is not numeric.
+     * @throws IllegalArgumentException if the same identifier is used for two or more parameters.
+     *
+     * @since 0.8
+     */
+    public static Map<Integer,String> identifierToName(final ParameterDescriptorGroup parameters, final Citation authority) {
+        final Map<Integer,String> mapping = new HashMap<>();
+        for (final GeneralParameterDescriptor descriptor : parameters.descriptors()) {
+            final Identifier id = IdentifiedObjects.getIdentifier(descriptor, authority);
+            if (id != null) {
+                String name = IdentifiedObjects.getName(descriptor, authority);
+                if (name == null) {
+                    name = IdentifiedObjects.getName(descriptor, null);
+                }
+                if (mapping.put(Integer.valueOf(id.getCode()), name) != null) {
+                    throw new IllegalArgumentException(Errors.format(Errors.Keys.DuplicatedIdentifier_1, id));
+                }
+            }
+        }
+        return mapping;
+    }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -83,6 +83,11 @@ public final class Resources extends Ind
         public static final short CanNotCreateObjectAsInstanceOf_2 = 4;
 
         /**
+         * Can not infer a grid size from the given values in {0} range.
+         */
+        public static final short CanNotInferGridSizeFromValues_1 = 75;
+
+        /**
          * Can not instantiate geodetic object for “{0}”.
          */
         public static final short CanNotInstantiateGeodeticObject_1 = 5;
@@ -275,6 +280,11 @@ public final class Resources extends Ind
         public static final short MissingInterpolationOrdinates = 41;
 
         /**
+         * Missing parameter values for “{0}” coordinate operation.
+         */
+        public static final short MissingParameterValues_1 = 74;
+
+        /**
          * No spatial or temporal dimension found in “{0}”
          */
         public static final short MissingSpatioTemporalDimension_1 = 42;
@@ -321,6 +331,19 @@ public final class Resources extends Ind
         public static final short NoSuchOperationMethod_1 = 50;
 
         /**
+         * The coordinate system axes in the given “{0}” description do not conform to the expected
+         * axes according “{1}” authoritative description.
+         */
+        public static final short NonConformAxes_2 = 72;
+
+        /**
+         * The given “{0}” description does not conform to the “{1}” authoritative description.
+         * Differences are found in {2,choice,0#conversion method|1#conversion description|2#coordinate
+         * system|3#datum|4#prime meridian|5#CRS}.
+         */
+        public static final short NonConformCRS_3 = 73;
+
+        /**
          * No horizontal component found in the “{0}” coordinate reference system.
          */
         public static final short NonHorizontalCRS_1 = 71;

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -35,6 +35,9 @@ MismatchedEllipsoidAxisLength_3   = The
 MismatchedOperationFactories_2    = No coordinate operation from \u201c{0}\u201d to \u201c{1}\u201d because of mismatched factories.
 MisnamedParameter_1               = Despite its name, this parameter is effectively \u201c{0}\u201d.
 NotFormalProjectionParameter_1    = This parameter borrowed from the \u201c{0}\u201d projection is not formally a parameter of this projection.
+NonConformAxes_2                  = The coordinate system axes in the given \u201c{0}\u201d description do not conform to the expected axes according \u201c{1}\u201d authoritative description.
+NonConformCRS_3                   = The given \u201c{0}\u201d description does not conform to the \u201c{1}\u201d authoritative description. \
+                                    Differences are found in {2,choice,0#conversion method|1#conversion description|2#coordinate system|3#datum|4#prime meridian|5#CRS}.
 
 #
 # Error messages (to be used in exceptions)
@@ -42,6 +45,7 @@ NotFormalProjectionParameter_1    = This
 CanNotConcatenateTransforms_2     = Can not concatenate transforms \u201c{0}\u201d and \u201c{1}\u201d.
 CanNotComputeDerivative           = Can not compute the coordinate operation derivative.
 CanNotCreateObjectAsInstanceOf_2  = Can not create an object of group \u201c{1}\u201d as an instance of class \u2018{0}\u2019.
+CanNotInferGridSizeFromValues_1   = Can not infer a grid size from the given values in {0} range.
 CanNotInstantiateGeodeticObject_1 = Can not instantiate geodetic object for \u201c{0}\u201d.
 CanNotMapAxisToDirection_1        = Can not map an axis from the specified coordinate system to the \u201c{0}\u201d direction.
 CanNotSeparateTargetDimension_1   = Target dimension {0} depends on excluded source dimensions.
@@ -70,6 +74,7 @@ MissingHorizontalDimension_1      = No h
 MissingVerticalDimension_1        = No vertical dimension found in \u201c{0}\u201d
 MissingTemporalDimension_1        = No temporal dimension found in \u201c{0}\u201d
 MissingSpatioTemporalDimension_1  = No spatial or temporal dimension found in \u201c{0}\u201d
+MissingParameterValues_1          = Missing parameter values for \u201c{0}\u201d coordinate operation.
 MissingValueForParameter_1        = Missing value for \u201c{0}\u201d parameter.
 NoConvergence                     = No convergence.
 NoConvergenceForPoints_2          = No convergence for points {0} and {1}.

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -40,6 +40,9 @@ MismatchedEllipsoidAxisLength_3   = Le p
 MismatchedOperationFactories_2    = Il n\u2019y a pas d\u2019op\u00e9rations allant de \u00ab\u202f{0}\u202f\u00bb vers \u00ab\u202f{1}\u202f\u00bb parce que ces derniers sont associ\u00e9s \u00e0 deux fabriques diff\u00e9rentes.
 MisnamedParameter_1               = Malgr\u00e9 son nom, ce param\u00e8tre produit en r\u00e9alit\u00e9 l\u2019effet d\u2019un \u00ab\u202f{0}\u202f\u00bb.
 NotFormalProjectionParameter_1    = Ce param\u00e8tre emprunt\u00e9 \u00e0 la projection \u00ab\u202f{0}\u202f\u00bb n\u2019est pas formellement un param\u00e8tre de cette projection.
+NonConformAxes_2                  = Les axes du syst\u00e8me de coordonn\u00e9es d\u00e9finis dans \u00ab\u202f{0}\u202f\u00bb ne sont pas conformes aux axes attendus d\u2019apr\u00e8s la description officielle de \u00ab\u202f{1}\u202f\u00bb.
+NonConformCRS_3                   = La description donn\u00e9e pour \u00ab\u202f{0}\u202f\u00bb n\u2019est pas conforme \u00e0 la description officielle de \u00ab\u202f{1}\u202f\u00bb. \
+                                    Des diff\u00e9rences ont \u00e9t\u00e9 trouv\u00e9es dans {2,choice,0#la m\u00e9thode de conversion|1#la description de la conversion|2#le syst\u00e8me de coordonn\u00e9es|3#le r\u00e9f\u00e9rentiel|4#le m\u00e9ridien d\u2019origine|5#le CRS}.
 
 #
 # Error messages (to be used in exceptions)
@@ -47,6 +50,7 @@ NotFormalProjectionParameter_1    = Ce p
 CanNotConcatenateTransforms_2     = Les transformations \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb ne peuvent pas \u00eatre combin\u00e9es.
 CanNotComputeDerivative           = La d\u00e9riv\u00e9 de l\u2019op\u00e9ration sur les coordonn\u00e9es ne peut pas \u00eatre calcul\u00e9e.
 CanNotCreateObjectAsInstanceOf_2  = Ne peut pas cr\u00e9er un objet du groupe \u00ab\u202f{1}\u202f\u00bb comme une instance de la classe \u2018{0}\u2019.
+CanNotInferGridSizeFromValues_1   = Ne peut pas inf\u00e9rer une taille de grille \u00e0 partir des valeurs donn\u00e9es dans la plage {0}.
 CanNotInstantiateGeodeticObject_1 = Ne peut pas cr\u00e9er l\u2019objet g\u00e9od\u00e9tique pour \u00ab\u202f{0}\u202f\u00bb.
 CanNotMapAxisToDirection_1        = Aucun axe du syst\u00e8me de coordonn\u00e9es sp\u00e9cifi\u00e9 n\u2019a pu \u00eatre associ\u00e9 \u00e0 la direction \u00ab\u202f{0}\u202f\u00bb.
 CanNotSeparateTargetDimension_1   = La dimension de destination {0} d\u00e9pend de dimensions sources qui ont \u00e9t\u00e9 exclues.
@@ -75,6 +79,7 @@ MissingHorizontalDimension_1      = Aucu
 MissingVerticalDimension_1        = Aucune dimension verticale n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
 MissingTemporalDimension_1        = Aucune dimension temporelle n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
 MissingSpatioTemporalDimension_1  = Aucune dimension spatiale ou temporelle n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
+MissingParameterValues_1          = Il manque les valeurs des param\u00e8tres pour l\u2019op\u00e9ration \u00ab\u202f{0}\u202f\u00bb.
 MissingValueForParameter_1        = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb.
 NoConvergence                     = Le calcul ne converge pas.
 NoConvergenceForPoints_2          = Le calcul ne converge pas pour les points {0} et {1}.

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -23,7 +23,7 @@ import org.apache.sis.util.iso.AbstractI
 
 
 /**
- * Comments telling whether a parameter value use the same sign or the opposite sign for the inverse operation.
+ * Comments telling whether a parameter value uses the same sign or the opposite sign for the inverse operation.
  * Those comments are used for encoding the {@code PARAM_SIGN_REVERSAL} boolean value in the
  * {@code [Coordinate_Operation Parameter Usage]} table of the EPSG dataset.
  *

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -70,7 +70,6 @@ public final class AbridgedMolodensky ex
     /**
      * Constructs a new provider.
      */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public AbridgedMolodensky() {
         this(3, 3, new AbridgedMolodensky[4]);
         redimensioned[0] = new AbridgedMolodensky(2, 2, redimensioned);

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -34,6 +34,7 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.operation.transform.MathTransformProvider;
+import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Workaround;
@@ -43,7 +44,7 @@ import org.apache.sis.util.Workaround;
  * Base class for all providers defined in this package.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.6
  * @module
  */
@@ -185,6 +186,28 @@ public abstract class AbstractProvider e
     }
 
     /**
+     * If an operation method is ambiguous according Apache SIS, returns the name of the method that SIS should use.
+     * Otherwise returns {@code null}. The ambiguities that need to be resolved are:
+     *
+     * <ul>
+     *   <li>Method <cite>"Geographic/geocentric conversions"</cite> (EPSG:9602) can be either:
+     *     <ul>
+     *       <li>{@code "Ellipsoid_To_Geocentric"} (implemented by {@link GeographicToGeocentric}</li>
+     *       <li>{@code "Geocentric_To_Ellipsoid"} (implemented by {@link GeocentricToGeographic}</li>
+     *     </ul>
+     *   </li>
+     * </ul>
+     *
+     * @param  context   the potentially ambiguous context.
+     * @return name of the provider to use, or {@code null} if there is nothing to change.
+     *
+     * @since 0.8
+     */
+    public String resolveAmbiguity(final DefaultMathTransformFactory.Context context) {
+        return null;
+    }
+
+    /**
      * Flags whether the source and/or target ellipsoid are concerned by this operation. This method is invoked by
      * {@link org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory} for determining if this
      * operation has {@code "semi_major"}, {@code "semi_minor"}, {@code "src_semi_major"}, {@code "src_semi_minor"}

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -122,7 +122,6 @@ public final class Affine extends Abstra
      *
      * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory
      */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public Affine() {
         super(IDENTIFICATION_EPSG, EPSG_DIMENSION, EPSG_DIMENSION, new Descriptor(IDENTIFICATION_EPSG,
                 Arrays.copyOfRange( // Discards param 0 and 1, take only the ones in index range [2…7].

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -56,7 +56,6 @@ public final class CoordinateFrameRotati
     /**
      * Constructs the provider.
      */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public CoordinateFrameRotation3D() {
         this(3, 3, new GeocentricAffineBetweenGeographic[4]);
         redimensioned[0] = new CoordinateFrameRotation2D(      redimensioned);

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -167,7 +167,6 @@ public class FranceGeocentricInterpolati
     /**
      * Constructs a provider.
      */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public FranceGeocentricInterpolation() {
         this(2, 2, PARAMETERS, new FranceGeocentricInterpolation[4]);
         redimensioned[0] = this;

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -62,6 +62,8 @@ public abstract class GeocentricAffineBe
      * Furthermore it would not solve the case where the number of input dimensions is different than the number of
      * output dimensions. We can not afford to have wrong default values since it would confuse our interpretation
      * of user's parameters in {@link #createMathTransform(MathTransformFactory, ParameterValueGroup)}.</p>
+     *
+     * @see GeographicToGeocentric#DIMENSION
      */
     public static final ParameterDescriptor<Integer> DIMENSION;
 

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -24,6 +24,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.opengis.util.FactoryException;
 import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.parameter.Parameters;
 
 
 /**
@@ -31,14 +32,14 @@ import org.apache.sis.metadata.iso.citat
  * This provider creates transforms from geocentric to geographic coordinate reference systems.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.7
+ * @version 0.8
  *
  * @see GeographicToGeocentric
  *
  * @since 0.7
  * @module
  */
-public final class GeocentricToGeographic extends AbstractProvider {
+public final class GeocentricToGeographic extends GeodeticOperation {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -47,7 +48,7 @@ public final class GeocentricToGeographi
     /**
      * The OGC name used for this operation method.
      */
-    static final String NAME = "Geocentric_To_Ellipsoid";
+    public static final String NAME = "Geocentric_To_Ellipsoid";
 
     /**
      * The group of all parameters expected by this coordinate operation.
@@ -56,7 +57,7 @@ public final class GeocentricToGeographi
     static {
         PARAMETERS = builder()
                 .addName(Citations.OGC, NAME)
-                .createGroupForMapProjection();
+                .createGroupForMapProjection(GeographicToGeocentric.DIMENSION);
                 // Not really a map projection, but we leverage the same axis parameters.
     }
 
@@ -64,7 +65,19 @@ public final class GeocentricToGeographi
      * Constructs a provider for the 3-dimensional case.
      */
     public GeocentricToGeographic() {
-        super(3, 3, PARAMETERS);
+        this(3, new GeocentricToGeographic[4]);
+        redimensioned[2] = new GeocentricToGeographic(2, redimensioned);
+        redimensioned[3] = this;
+    }
+
+    /**
+     * Constructs a provider for the given dimensions.
+     *
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases.
+     */
+    private GeocentricToGeographic(int targetDimensions, GeodeticOperation[] redimensioned) {
+        super(3, targetDimensions, PARAMETERS, redimensioned);
     }
 
     /**
@@ -89,6 +102,16 @@ public final class GeocentricToGeographi
     }
 
     /**
+     * Specifies that the inverse of this operation is a different kind of operation.
+     *
+     * @return {@code false}.
+     */
+    @Override
+    public boolean isInvertible() {
+        return false;
+    }
+
+    /**
      * Creates a transform from the specified group of parameter values.
      *
      * @param  factory  the factory to use for creating the transform.
@@ -100,7 +123,7 @@ public final class GeocentricToGeographi
     public MathTransform createMathTransform(final MathTransformFactory factory, final ParameterValueGroup values)
             throws FactoryException
     {
-        MathTransform tr = GeographicToGeocentric.create(factory, values);
+        MathTransform tr = GeographicToGeocentric.create(factory, Parameters.castOrWrap(values));
         try {
             tr = tr.inverse();
         } catch (NoninvertibleTransformException e) {

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -51,7 +51,6 @@ public final class GeocentricTranslation
     /**
      * Constructs the provider.
      */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public GeocentricTranslation3D() {
         this(3, 3, new GeocentricAffineBetweenGeographic[4]);
         redimensioned[0] = new GeocentricTranslation2D(      redimensioned);

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -19,6 +19,7 @@ package org.apache.sis.internal.referenc
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.SingleOperation;
 import org.opengis.referencing.operation.Transformation;
 
 
@@ -86,6 +87,8 @@ abstract class GeodeticOperation extends
      * Returns the three-dimensional variant of this operation method, or {@code null} if none.
      * This method needs to be overridden only if the three-dimensional variant is an instance
      * of a different class than this instance.
+     *
+     * <p>This method is not needed on the JDK9 branch.</p>
      */
     Class<? extends GeodeticOperation> variant3D() {
         return null;
@@ -112,12 +115,12 @@ abstract class GeodeticOperation extends
     }
 
     /**
-     * Returns the interface implemented by all coordinate operations that extends this class.
+     * Returns the interface implemented by most coordinate operations that extends this class.
      *
-     * @return fixed to {@link Transformation}.
+     * @return default to {@link Transformation}.
      */
     @Override
-    public final Class<Transformation> getOperationType() {
+    public Class<? extends SingleOperation> getOperationType() {
         return Transformation.class;
     }
 

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -21,7 +21,6 @@ import org.opengis.util.FactoryException
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.referencing.operation.matrix.Matrices;
@@ -41,12 +40,15 @@ import org.apache.sis.parameter.Paramete
  * format the inverse ({@code "INVERSE_MT"}) of 3D to 2D transform.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
- * @since   0.7
+ * @version 0.8
+ *
+ * @see Geographic3Dto2D
+ *
+ * @since 0.7
  * @module
  */
 @XmlTransient
-public final class Geographic2Dto3D extends AbstractProvider {
+public final class Geographic2Dto3D extends GeographicRedimension {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -71,17 +73,24 @@ public final class Geographic2Dto3D exte
      * Constructs a provider with default parameters.
      */
     public Geographic2Dto3D() {
-        super(2, 3, PARAMETERS);
+        this(null);
+    }
+
+    /**
+     * Constructs a provider that can be resized.
+     */
+    Geographic2Dto3D(GeodeticOperation[] redimensioned) {
+        super(2, 3, PARAMETERS, redimensioned);
     }
 
     /**
-     * Returns the operation type.
-     *
-     * @return interface implemented by all coordinate operations that use this method.
+     * Returns the tree-dimensional variant of this class.
+     * Used for having a unique instance of this provider.
+     * This hack is not needed on the JDK9 branch.
      */
     @Override
-    public Class<Conversion> getOperationType() {
-        return Conversion.class;
+    Class<Geographic3Dto2D> variant3D() {
+        return Geographic3Dto2D.class;
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -20,7 +20,6 @@ import javax.xml.bind.annotation.XmlTran
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
@@ -40,12 +39,15 @@ import org.apache.sis.internal.referenci
  * The inverse operation arbitrarily sets the ellipsoidal height to zero.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
- * @since   0.7
+ * @version 0.8
+ *
+ * @see Geographic2Dto3D
+ *
+ * @since 0.7
  * @module
  */
 @XmlTransient
-public final class Geographic3Dto2D extends AbstractProvider {
+public final class Geographic3Dto2D extends GeographicRedimension {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -66,17 +68,18 @@ public final class Geographic3Dto2D exte
      * Constructs a provider with default parameters.
      */
     public Geographic3Dto2D() {
-        super(3, 2, PARAMETERS);
+        this(new GeodeticOperation[4]);
+        redimensioned[0] = new GeographicRedimension(2, redimensioned);
+        redimensioned[1] = new Geographic2Dto3D(redimensioned);
+        redimensioned[2] = this;
+        redimensioned[3] = new GeographicRedimension(3, redimensioned);
     }
 
     /**
-     * Returns the operation type.
-     *
-     * @return interface implemented by all coordinate operations that use this method.
+     * Constructs a provider that can be resized.
      */
-    @Override
-    public Class<Conversion> getOperationType() {
-        return Conversion.class;
+    private Geographic3Dto2D(GeodeticOperation[] redimensioned) {
+        super(3, 2, PARAMETERS, redimensioned);
     }
 
     /**



Mime
View raw message