sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1677850 [4/4] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/test/suite/ core/sis-metadata/src/main/java/org/a...
Date Tue, 05 May 2015 16:09:07 GMT
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8]
Tue May  5 16:09:05 2015
@@ -194,8 +194,8 @@ public final class StringBuilders extend
      * Replaces some Unicode characters by ASCII characters on a "best effort basis".
      * For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
      *
-     * <p>The current implementation replaces only the characters in the range {@code
00C0}
-     * to {@code 00FF}, inclusive. Other characters are left unchanged.</p>
+     * <p>The current implementation replaces the characters in the range {@code 00C0}
+     * to {@code 00FF} (inclusive) and some space and punctuation characters.</p>
      *
      * @param  buffer The text to scan for Unicode characters to replace by ASCII characters.
      * @throws NullArgumentException If the given {@code buffer} is null.
@@ -227,9 +227,19 @@ public final class StringBuilders extend
                         cr = ASCII.charAt(r);
                     } else {
                         switch (getType(c)) {
-                            case SPACE_SEPARATOR: cr = ' '; break;
-                            case PARAGRAPH_SEPARATOR: // Fall through
-                            case LINE_SEPARATOR: cr = '\n'; break;
+                            case PARAGRAPH_SEPARATOR:       // Fall through
+                            case LINE_SEPARATOR:            cr = '\n'; break;
+                            case SPACE_SEPARATOR:           cr = ' '; break;
+                            case INITIAL_QUOTE_PUNCTUATION: cr = (c == '‘') ? '\'' : '"';
break;
+                            case FINAL_QUOTE_PUNCTUATION:   cr = (c == '’') ? '\'' : '"';
break;
+                            case OTHER_PUNCTUATION: {
+                                switch (c) {
+                                    case '′': cr = '\''; break;
+                                    case '″': cr = '"';  break;
+                                    default:  continue;
+                                }
+                                break;
+                            }
                             default: continue;
                         }
                     }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8]
Tue May  5 16:09:05 2015
@@ -525,6 +525,12 @@ public final class Errors extends Indexe
         public static final short MissingHorizontalDimension_1 = 169;
 
         /**
+         * Not enough dimension in ‘MathTransform’ input or output coordinates for the
interpolation
+         * points.
+         */
+        public static final short MissingInterpolationOrdinates = 184;
+
+        /**
          * “{0}” has no namespace.
          */
         public static final short MissingNamespace_1 = 163;

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Tue May  5 16:09:05 2015
@@ -114,6 +114,7 @@ MismatchedPropertyType_1          = Mism
 MismatchedTransformDimension_3    = The transform has {2} {0,choice,0#source|1#target} dimension{2,choice,1#|2#s},
while {1} was expected.
 MismatchedValueClass_3            = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but
the requested type is \u2018{1}\u2019.
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d.
The expected syntax is \u201cAUTHORITY:CODE\u201d.
+MissingInterpolationOrdinates     = Not enough dimension in \u2018MathTransform\u2019 input
or output coordinates for the interpolation points.
 MissingNamespace_1                = \u201c{0}\u201d has no namespace.
 MissingRequiredModule_1           = This operation requires the \u201c{0}\u201d module.
 MissingSchemeInURI                = Missing scheme in URI.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Tue May  5 16:09:05 2015
@@ -104,6 +104,7 @@ MismatchedPropertyType_1          = Le t
 MismatchedTransformDimension_3    = La {0,choice,0#source|1#destination} de la transformation
a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
 MismatchedValueClass_3            = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la
classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
 MissingAuthority_1                = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e
pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.
+MissingInterpolationOrdinates     = La dimension des coordonn\u00e9es en entr\u00e9 ou en
sortie du \u2018MathTransform\u2019 n\u2019est pas suffisante pour contenir les points d\u2019interpolation.
 MissingNamespace_1                = \u201c{0}\u201d est d\u00e9fini sans espace de noms.
 MissingRequiredModule_1           = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
 MissingSchemeInURI                = Il manque le sch\u00e9ma d\u2019URI.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Tue May  5 16:09:05 2015
@@ -101,6 +101,11 @@ public final class Vocabulary extends In
         public static final short CharacterEncoding = 6;
 
         /**
+         * Characteristics
+         */
+        public static final short Characteristics = 85;
+
+        /**
          * Classpath
          */
         public static final short Classpath = 7;

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Tue May  5 16:09:05 2015
@@ -23,6 +23,7 @@ Attributes              = Attributes
 BarometricAltitude      = Barometric altitude
 Cardinality             = Cardinality
 CharacterEncoding       = Character encoding
+Characteristics         = Characteristics
 Classpath               = Classpath
 Code_1                  = {0} code
 Commands                = Commands

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Tue May  5 16:09:05 2015
@@ -23,6 +23,7 @@ Attributes              = Attributs
 BarometricAltitude      = Altitude barom\u00e9trique
 Cardinality             = Cardinalit\u00e9
 CharacterEncoding       = Encodage des caract\u00e8res
+Characteristics         = Caract\u00e9ristiques
 Classpath               = Chemin de classes
 Code_1                  = Code {0}
 Commands                = Commandes

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
[UTF-8] Tue May  5 16:09:05 2015
@@ -16,8 +16,12 @@
  */
 package org.apache.sis.internal.util;
 
+import java.util.List;
+import java.util.ArrayList;
+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.xml.IdentifierSpace;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -37,6 +41,48 @@ import static org.junit.Assume.assumeTru
  */
 public final strictfp class CitationsTest extends TestCase {
     /**
+     * Creates an identifier with a code space.
+     */
+     @SuppressWarnings("serial")
+     private static Identifier identifier(final String codeSpace, final String code) {
+        return new SimpleIdentifier(null, code) {
+            @Override public String getCodeSpace() {
+                return codeSpace;
+            }
+        };
+    }
+
+    /**
+     * Tests {@link Citations#hasCommonIdentifier(Iterable, Iterable)}.
+     */
+    @Test
+    public void testHasCommonIdentifier() {
+        final List<Identifier> id1 = new ArrayList<Identifier>(3);
+        final List<Identifier> id2 = new ArrayList<Identifier>(2);
+        assertNull(Citations.hasCommonIdentifier(id1, id2));
+        /*
+         * Add codes for two Operation Methods which are implemented in Apache SIS by the
same class:
+         *
+         *  - EPSG:9804  —  "Mercator (variant A)" (formerly known as "Mercator (1SP)").
+         *  - EPSG:1026  —  "Mercator (Spherical)"
+         *  - GeoTIFF:7  —  "CT_Mercator"
+         */
+        id1.add(identifier("EPSG", "9804"));
+        id1.add(identifier("EPSG", "1026"));
+        id1.add(identifier("GeoTIFF", "7"));
+        assertNull(Citations.hasCommonIdentifier(id1, id2));
+        /*
+         * EPSG:9841 is a legacy (now deprecated) code for "Mercator (1SP)".
+         * We could have declared it as a deprecated code in the above list,
+         * but for the sake of this test we do not.
+         */
+        id2.add(identifier("EPSG", "9841"));
+        assertEquals(Boolean.FALSE, Citations.hasCommonIdentifier(id1, id2));
+        id2.add(identifier("EPSG", "9804"));
+        assertEquals(Boolean.TRUE, Citations.hasCommonIdentifier(id1, id2));
+    }
+
+    /**
      * Tests {@link Citations#getIdentifier(Citation, boolean)}.
      */
     @Test

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8]
Tue May  5 16:09:05 2015
@@ -97,8 +97,10 @@ public final strictfp class StringBuilde
      */
     @Test
     public void testToASCII() {
-        final StringBuilder metre = new StringBuilder("mètres" + Characters.PARAGRAPH_SEPARATOR);
+        final StringBuilder metre = new StringBuilder(
+                "mètres" + Characters.PARAGRAPH_SEPARATOR +
+                " ‘single’, “double”, \"ascii' 30°20′10″.");
         toASCII(metre);
-        assertEquals("metres\n", metre.toString());
+        assertEquals("metres\n 'single', \"double\", \"ascii' 30°20'10\".", metre.toString());
     }
 }



Mime
View raw message