sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1524084 - in /sis/branches/JDK7/core: sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/ sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/ sis-utility/src/test/java/org/apache/sis/internal/t...
Date Tue, 17 Sep 2013 15:00:30 GMT
Author: desruisseaux
Date: Tue Sep 17 15:00:29 2013
New Revision: 1524084

URL: http://svn.apache.org/r1524084
Log:
Minor tunings:
* Renamed Matrices.create(int,int) as createDiagonal.
* Removed dependency to java.awt.geom.AffineTransform in Matrices (the method will still work
using the more generic checks).
* Added a test case.
* Trivial javadoc.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix1.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix2.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix3.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix4.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -31,7 +31,7 @@ import org.apache.sis.math.MathFunctions
  * @version 0.4
  * @module
  *
- * @see Matrices#create(int, int)
+ * @see Matrices#createDiagonal(int, int)
  */
 class GeneralMatrix extends MatrixSIS {
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.referencing.operation.matrix;
 
-import java.awt.geom.AffineTransform;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.apache.sis.util.Static;
@@ -88,7 +87,7 @@ public final class Matrices extends Stat
      * @param numCol For an affine transform, this is the number of {@linkplain MathTransform#getSourceDimensions()
source dimensions} + 1.
      * @return An identity matrix of the given size.
      */
-    public static MatrixSIS create(final int numRow, final int numCol) {
+    public static MatrixSIS createDiagonal(final int numRow, final int numCol) {
         if (numRow == numCol) {
             return createIdentity(numRow);
         } else {
@@ -195,10 +194,12 @@ public final class Matrices extends Stat
     }
 
     /**
-     * Returns {@code true} if the given matrix is affine.
+     * Returns {@code true} if the given matrix represents an affine transform.
+     * A transform is affine if the matrix is square and its last row contains
+     * only zeros, except in the last column which contains 1.
      *
      * @param matrix The matrix to test.
-     * @return {@code true} if the matrix is affine.
+     * @return {@code true} if the matrix represents an affine transform.
      *
      * @see MatrixSIS#isAffine()
      * @see AffineTransforms2D#castOrCopy(Matrix)
@@ -207,9 +208,6 @@ public final class Matrices extends Stat
         if (matrix instanceof MatrixSIS) {
             return ((MatrixSIS) matrix).isAffine();
         }
-        if (matrix instanceof AffineTransform) {
-            return true;
-        }
         // Following is executed only if the given matrix is not a SIS implementation.
         int j = matrix.getNumRow();
         int i = matrix.getNumCol();

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix1.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix1.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix1.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix1.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -21,16 +21,14 @@ import org.apache.sis.internal.util.Nume
 
 
 /**
- * A matrix of fixed {@value #SIZE}×{@value #SIZE} size.
+ * A matrix of fixed {@value #SIZE}×{@value #SIZE} size,
+ * typically resulting from {@linkplain org.opengis.referencing.operation.MathTransform1D}
derivative computation.
  * The matrix member is:
  *
  * <blockquote><pre> ┌     ┐
  * │ {@link #m00} │
  * └     ┘</pre></blockquote>
  *
- * This trivial matrix can be returned as a result of
- * {@linkplain org.opengis.referencing.operation.MathTransform1D} derivative computation.
- *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
  * @version 0.4

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix2.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix2.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix2.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix2.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -21,7 +21,8 @@ import org.apache.sis.internal.util.Nume
 
 
 /**
- * A matrix of fixed {@value #SIZE}×{@value #SIZE} size.
+ * A matrix of fixed {@value #SIZE}×{@value #SIZE} size,
+ * typically resulting from {@linkplain org.opengis.referencing.operation.MathTransform2D}
derivative computation.
  * The matrix members are:
  *
  * <blockquote><pre> ┌         ┐
@@ -29,9 +30,6 @@ import org.apache.sis.internal.util.Nume
  * │ {@link #m10} {@link #m11} │
  * └         ┘</pre></blockquote>
  *
- * This simple matrix is returned as a result of {@linkplain org.opengis.referencing.operation.MathTransform2D}
- * derivative computation.
- *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
  * @version 0.4

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix3.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix3.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix3.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix3.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -32,9 +32,6 @@ import org.apache.sis.math.MathFunctions
  * │ {@link #m20} {@link #m21} {@link #m22} │
  * └             ┘</pre></blockquote>
  *
- * In some situations, this specialized matrix implementation may provide better accuracy
than the
- * generic implementation for matrix inversions.
- *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
  * @version 0.4

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix4.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix4.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrix4.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -33,9 +33,6 @@ import org.apache.sis.math.MathFunctions
  * │ {@link #m30} {@link #m31} {@link #m32} {@link #m33} │
  * └                 ┘</pre></blockquote>
  *
- * In some situations, this specialized matrix implementation may provide better accuracy
than the
- * generic implementation for matrix inversions.
- *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
  * @version 0.4

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
Tue Sep 17 15:00:29 2013
@@ -131,7 +131,7 @@ public abstract class MatrixSIS implemen
      * A transform is affine if the matrix is square and its last row contains
      * only zeros, except in the last column which contains 1.
      *
-     * @return {@code true} if this matrix is affine.
+     * @return {@code true} if this matrix represents an affine transform.
      *
      * @see Matrices#isAffine(Matrix)
      */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -22,7 +22,7 @@ import org.opengis.referencing.operation
 /**
  * A matrix which is not square.
  *
- * @author  Martin Desruisseaux
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
  * @version 0.4
  * @module

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -31,7 +31,7 @@ import static org.junit.Assert.*;
  * This class uses the following {@code Matrices} factory methods:
  *
  * <ul>
- *   <li>{@link Matrices#create(int, int)} (sometime delegates to {@link Matrices#createIdentity(int)})</li>
+ *   <li>{@link Matrices#createDiagonal(int, int)} (sometime delegates to {@link Matrices#createIdentity(int)})</li>
  *   <li>{@link Matrices#create(int, int, double[])}</li>
  *   <li>{@link Matrices#createZero(int, int)}</li>
  * </ul>
@@ -175,7 +175,7 @@ public abstract strictfp class MatrixTes
     }
 
     /**
-     * Tests {@link MatrixSIS#isIdentity()}. This method will first invoke {@link Matrices#create(int,
int)}
+     * Tests {@link MatrixSIS#isIdentity()}. This method will first invoke {@link Matrices#createDiagonal(int,
int)}
      * and ensure that the result contains 1 on the diagonal and 0 elsewhere.
      *
      * <p>This method will opportunistically tests {@link MatrixSIS#isAffine()}. The
two methods are related
@@ -186,7 +186,7 @@ public abstract strictfp class MatrixTes
     public void testIsIdentity() {
         final int numRow = getNumRow();
         final int numCol = getNumCol();
-        final MatrixSIS matrix = Matrices.create(numRow, numCol);
+        final MatrixSIS matrix = Matrices.createDiagonal(numRow, numCol);
         validate(matrix);
         /*
          * End of initialization - now perform the actual test.

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java?rev=1524084&r1=1524083&r2=1524084&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
[UTF-8] Tue Sep 17 15:00:29 2013
@@ -28,7 +28,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.17)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final strictfp class XMLComparatorTest extends TestCase {
@@ -47,6 +47,7 @@ public final strictfp class XMLComparato
             "    </table>\n" +
             "  </form>\n" +
             "</body>",
+
             "<body>\n" +
             "  <form id=\"MyForm\">\n" +
             "    <table cellpading=\"2\">\n" +
@@ -76,6 +77,29 @@ public final strictfp class XMLComparato
     }
 
     /**
+     * Verifies that comparisons of XML documents compare the namespace URIs, not the prefixes.
+     *
+     * @see javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean)
+     *
+     * @throws Exception Should never happen.
+     */
+    @Test
+    public void testNamespaceAware() throws Exception {
+        final XMLComparator cmp = new XMLComparator(
+            "<ns1:body xmlns:ns1=\"http://myns1\" xmlns:ns2=\"http://myns2\">\n" +
+            "  <ns1:table ns2:cellpading=\"1\"/>\n" +
+            "</ns1:body>",
+
+            "<ns4:body xmlns:ns4=\"http://myns1\" xmlns:ns3=\"http://myns2\">\n" +
+            "  <ns4:table ns3:cellpading=\"1\"/>\n" +
+            "</ns4:body>");
+
+        // Following comparison should not fail anymore.
+        cmp.ignoredAttributes.add("http://www.w3.org/2000/xmlns:*");
+        cmp.compare();
+    }
+
+    /**
      * Ensures that the call to {@link XMLComparator#compare()} fails. This method is
      * invoked in order to test that the comparator rightly detected an error that we
      * were expected to detect.



Mime
View raw message