sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1766508 [2/6] - in /sis/branches/JDK7: ./ application/ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-openoffice/ application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ core/ core/sis-metadata/sr...
Date Tue, 25 Oct 2016 10:45:15 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -254,7 +254,7 @@ final class MapProjectionParameters exte
          */
         static final ParameterDescriptor<Double> DESCRIPTOR = new DefaultParameterDescriptor<>(
                 toMap(Constants.INVERSE_FLATTENING), 0, 1, Double.class,
-                MeasurementRange.createGreaterThan(0.0, Units.ONE), null, null);
+                MeasurementRange.createGreaterThan(0.0, Units.UNITY), null, null);
 
         /**
          * Helper method for {@link #DESCRIPTOR} constructions.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -82,7 +82,7 @@ import static org.apache.sis.util.Argume
  *              .createBounded(-180, +180, 0, Units.DEGREE),  // Projection is valid on all the longitude range (±180°).
  *
  *       builder.addName("Scale factor at natural origin")
- *              .createStrictlyPositive(1, Units.ONE),
+ *              .createStrictlyPositive(1, Units.UNITY),
  *
  *       builder.addName("False easting")
  *              .create(0, Units.METRE),

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -17,9 +17,9 @@
 package org.apache.sis.referencing.cs;
 
 import java.util.Arrays;
+import java.util.Objects;
 import javax.measure.Unit;
 import javax.measure.quantity.Length;
-import javax.measure.UnitConverter;
 import javax.measure.IncommensurableException;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
@@ -31,6 +31,7 @@ import org.apache.sis.measure.Units;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.Resources;
 import org.apache.sis.referencing.operation.matrix.Matrices;
@@ -38,9 +39,6 @@ import org.apache.sis.referencing.operat
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
-// Branch-dependent imports
-import java.util.Objects;
-
 
 /**
  * Utility methods working on {@link CoordinateSystem} objects and their axes.
@@ -73,8 +71,8 @@ public final class CoordinateSystems ext
      *       to Greenwich (see {@link #directionAlongMeridian directionAlongMeridian(…)} for more information).</li>
      * </ul>
      *
-     * @param  name The direction name (e.g. "north", "north-east", <i>etc.</i>).
-     * @return The axis direction for the given name.
+     * @param  name  the direction name (e.g. "north", "north-east", <i>etc.</i>).
+     * @return the axis direction for the given name.
      * @throws IllegalArgumentException if the given name is not a known axis direction.
      */
     public static AxisDirection parseAxisDirection(String name) throws IllegalArgumentException {
@@ -118,10 +116,10 @@ public final class CoordinateSystems ext
      * This policy is consistent with
      * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#40">WKT 2 specification §7.5.4(iv)</a>.
      *
-     * @param  baseDirection The base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
-     * @param  meridian The meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
+     * @param  baseDirection  the base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
+     * @param  meridian       the meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
      *         Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
-     * @return The axis direction along the given meridian.
+     * @return the axis direction along the given meridian.
      *
      * @since 0.6
      */
@@ -165,9 +163,9 @@ public final class CoordinateSystems ext
      *   <li>{@code angle(A, B) = -angle(B, A)}</li>
      * </ul>
      *
-     * @param  source The source axis direction.
-     * @param  target The target axis direction.
-     * @return The arithmetic angle (in degrees) of the rotation to apply on a line pointing toward
+     * @param  source  the source axis direction.
+     * @param  target  the target axis direction.
+     * @return the arithmetic angle (in degrees) of the rotation to apply on a line pointing toward
      *         the source direction in order to make it point toward the target direction, or
      *         {@code null} if this value can not be computed.
      */
@@ -233,8 +231,8 @@ public final class CoordinateSystems ext
     /**
      * Returns the axis direction for the specified coordinate system.
      *
-     * @param  cs The coordinate system.
-     * @return The axis directions for the specified coordinate system.
+     * @param  cs  the coordinate system.
+     * @return the axis directions for the specified coordinate system.
      */
     private static AxisDirection[] getAxisDirections(final CoordinateSystem cs) {
         final AxisDirection[] directions = new AxisDirection[cs.getDimension()];
@@ -279,6 +277,7 @@ public final class CoordinateSystems ext
      *
      * @see Matrices#createTransform(AxisDirection[], AxisDirection[])
      */
+    @SuppressWarnings("fallthrough")
     public static Matrix swapAndScaleAxes(final CoordinateSystem sourceCS,
                                           final CoordinateSystem targetCS)
             throws IllegalArgumentException, IncommensurableException
@@ -312,8 +311,7 @@ public final class CoordinateSystems ext
         for (int j=0; j<targetDim; j++) {
             final Unit<?> targetUnit = targetCS.getAxis(j).getUnit();
             for (int i=0; i<sourceDim; i++) {
-                final double element = matrix.getElement(j,i);
-                if (element == 0) {
+                if (matrix.getElement(j,i) == 0) {
                     // There is no dependency between source[i] and target[j]
                     // (i.e. axes are orthogonal).
                     continue;
@@ -324,15 +322,24 @@ public final class CoordinateSystems ext
                     // between source[i] and target[j].
                     continue;
                 }
-                final UnitConverter converter = sourceUnit.getConverterToAny(targetUnit);
-                if (!converter.isLinear()) {
-                    throw new IncommensurableException(Resources.format(
-                              Resources.Keys.NonLinearUnitConversion_2, sourceUnit, targetUnit));
+                Number scale  = 1;
+                Number offset = 0;
+                final Number[] coefficients = Units.coefficients(sourceUnit.getConverterToAny(targetUnit));
+                switch (coefficients != null ? coefficients.length : -1) {
+                    case 2:  scale  = coefficients[1];       // Fall through
+                    case 1:  offset = coefficients[0];       // Fall through
+                    case 0:  break;
+                    default: throw new IncommensurableException(Resources.format(
+                                Resources.Keys.NonLinearUnitConversion_2, sourceUnit, targetUnit));
                 }
-                final double offset = converter.convert(0);
-                final double scale  = Units.derivative(converter, 0);
-                matrix.setElement(j, i, element*scale);
-                matrix.setElement(j, sourceDim, matrix.getElement(j, sourceDim) + element*offset);
+                final DoubleDouble element = DoubleDouble.castOrCopy(matrix.getNumber(j,i));
+                final DoubleDouble r = new DoubleDouble(element);
+                r.multiply(scale);
+                matrix.setNumber(j, i, r);
+                r.setFrom(element);
+                r.multiply(offset);
+                r.add(matrix.getNumber(j, sourceDim));
+                matrix.setNumber(j, sourceDim, r);
             }
         }
         return matrix;
@@ -376,9 +383,9 @@ public final class CoordinateSystems ext
      * A rational for normalized axis order and units is explained in the <cite>Axis units and direction</cite> section
      * in the description of the {@linkplain org.apache.sis.referencing.operation.projection map projection package}.
      *
-     * @param  cs     The coordinate system, or {@code null}.
-     * @param  filter The modifications to apply on coordinate system axes.
-     * @return The modified coordinate system as a new instance,
+     * @param  cs      the coordinate system, or {@code null}.
+     * @param  filter  the modifications to apply on coordinate system axes.
+     * @return the modified coordinate system as a new instance,
      *         or {@code cs} if the given coordinate system was null or does not need any change.
      * @throws IllegalArgumentException if the specified coordinate system can not be normalized.
      *
@@ -420,9 +427,9 @@ public final class CoordinateSystems ext
      *     });
      * }
      *
-     * @param  cs       The coordinate system in which to replace linear units, or {@code null}.
-     * @param  newUnit  The new linear unit.
-     * @return The modified coordinate system as a new instance,
+     * @param  cs       the coordinate system in which to replace linear units, or {@code null}.
+     * @param  newUnit  the new linear unit.
+     * @return the modified coordinate system as a new instance,
      *         or {@code cs} if all linear units were already equal to the given one.
      *
      * @see Units#isLinear(Unit)
@@ -461,9 +468,9 @@ public final class CoordinateSystems ext
      *     });
      * }
      *
-     * @param  cs       The coordinate system in which to replace angular units, or {@code null}.
-     * @param  newUnit  The new angular unit.
-     * @return The modified coordinate system as a new instance,
+     * @param  cs       the coordinate system in which to replace angular units, or {@code null}.
+     * @param  newUnit  the new angular unit.
+     * @return the modified coordinate system as a new instance,
      *         or {@code cs} if all angular units were already equal to the given one.
      *
      * @see Units#isAngular(Unit)

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -190,7 +190,7 @@ public class DefaultAffineCS extends Abs
         if (!AxisDirections.isSpatialOrUserDefined(direction, true)) {
             return INVALID_DIRECTION;
         }
-        if (!Units.isLinear(unit) && !Units.ONE.equals(unit)) {
+        if (!Units.isLinear(unit) && !Units.UNITY.equals(unit)) {
             return INVALID_UNIT;
         }
         return VALID;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -157,7 +157,7 @@ public class DefaultLinearCS extends Abs
         if (!AxisDirections.isSpatialOrUserDefined(direction, false)) {
             return INVALID_DIRECTION;
         }
-        if (!Units.isLinear(unit) && !Units.ONE.equals(unit)) {
+        if (!Units.isLinear(unit) && !Units.UNITY.equals(unit)) {
             return INVALID_UNIT;
         }
         return VALID;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -172,7 +172,7 @@ public class DefaultVerticalCS extends A
         if (unit.equals(Units.METRE)   ||   // Most usual case.
             unit.equals(Units.PASCAL)  ||   // Height or depth estimated by the atmospheric or ocean pressure.
             unit.equals(Units.SECOND)  ||   // Depth estimated by the time needed for an echo to travel.
-            unit.equals(Units.ONE))         // Sigma-level (percentage from sea surface to ocean floor).
+            unit.equals(Units.UNITY))         // Sigma-level (percentage from sea surface to ocean floor).
         {
             return VALID;
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -23,7 +23,6 @@ import java.io.Serializable;
 import java.io.ObjectInputStream;
 import javax.measure.Unit;
 import javax.measure.Quantity;
-import javax.measure.UnitConverter;
 import org.opengis.geometry.Envelope;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.opengis.referencing.operation.Matrix;
@@ -123,9 +122,9 @@ import org.apache.sis.measure.Units;
  * same version of Apache SIS. But for long term storage, an established datum shift grid format like
  * NTv2 should be preferred.
  *
- * @param <C> Dimension of the coordinate unit (usually {@link javax.measure.quantity.Angle}).
- * @param <T> Dimension of the translation unit (usually {@link javax.measure.quantity.Angle}
- *            or {@link javax.measure.quantity.Length}).
+ * @param  <C>  dimension of the coordinate unit (usually {@link javax.measure.quantity.Angle}).
+ * @param  <T>  dimension of the translation unit (usually {@link javax.measure.quantity.Angle}
+ *              or {@link javax.measure.quantity.Length}).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
@@ -200,11 +199,11 @@ public abstract class DatumShiftGrid<C e
      * methods. The argument order is roughly the order in which they are used in the process of
      * interpolating translation vectors.</p>
      *
-     * @param coordinateUnit    The unit of measurement of input values, before conversion to grid indices by {@code coordinateToGrid}.
-     * @param coordinateToGrid  Conversion from the "real world" coordinates to grid indices including fractional parts.
-     * @param gridSize          Number of cells along each axis in the grid. The length of this array shall be equal to {@code coordinateToGrid} target dimensions.
-     * @param isCellValueRatio  {@code true} if results of {@link #interpolateInCell interpolateInCell(…)} are divided by grid cell size.
-     * @param translationUnit   The unit of measurement of output values.
+     * @param  coordinateUnit    the unit of measurement of input values, before conversion to grid indices by {@code coordinateToGrid}.
+     * @param  coordinateToGrid  conversion from the "real world" coordinates to grid indices including fractional parts.
+     * @param  gridSize          number of cells along each axis in the grid. The length of this array shall be equal to {@code coordinateToGrid} target dimensions.
+     * @param  isCellValueRatio  {@code true} if results of {@link #interpolateInCell interpolateInCell(…)} are divided by grid cell size.
+     * @param  translationUnit   the unit of measurement of output values.
      */
     protected DatumShiftGrid(final Unit<C> coordinateUnit, final LinearTransform coordinateToGrid,
             int[] gridSize, final boolean isCellValueRatio, final Unit<T> translationUnit)
@@ -244,15 +243,14 @@ public abstract class DatumShiftGrid<C e
         scaleY = Double.NaN;
         x0     = Double.NaN;
         y0     = Double.NaN;
-        final UnitConverter c = coordinateUnit.getSystemUnit().getConverterTo(coordinateUnit);
-        if (c.isLinear() && c.convert(0) == 0) {
+        final double toStandardUnit = Units.toStandardUnit(coordinateUnit);
+        if (!Double.isNaN(toStandardUnit)) {
             final Matrix m = coordinateToGrid.getMatrix();
             if (Matrices.isAffine(m)) {
                 final int n = m.getNumCol() - 1;
-                final double toUnit = Units.derivative(c, 0);
                 switch (m.getNumRow()) {
-                    default: y0 = m.getElement(1,n); scaleY = diagonal(m, 1, n) * toUnit;   // Fall through
-                    case 1:  x0 = m.getElement(0,n); scaleX = diagonal(m, 0, n) * toUnit;
+                    default: y0 = m.getElement(1,n); scaleY = diagonal(m, 1, n) / toStandardUnit;   // Fall through
+                    case 1:  x0 = m.getElement(0,n); scaleX = diagonal(m, 0, n) / toStandardUnit;
                     case 0:  break;
                 }
             }
@@ -262,10 +260,10 @@ public abstract class DatumShiftGrid<C e
     /**
      * Returns the value on the diagonal of the given matrix, provided that all other non-translation terms are 0.
      *
-     * @param m The matrix from which to get the scale factor on a row.
-     * @param j The row for which to get the scale factor.
-     * @param n Index of the last column.
-     * @return The scale factor on the diagonal, or NaN.
+     * @param  m  the matrix from which to get the scale factor on a row.
+     * @param  j  the row for which to get the scale factor.
+     * @param  n  index of the last column.
+     * @return the scale factor on the diagonal, or NaN.
      */
     private static double diagonal(final Matrix m, final int j, int n) {
         while (--n >= 0) {
@@ -279,7 +277,7 @@ public abstract class DatumShiftGrid<C e
     /**
      * Creates a new datum shift grid with the same grid geometry (size and units) than the given grid.
      *
-     * @param other The other datum shift grid from which to copy the grid geometry.
+     * @param  other  the other datum shift grid from which to copy the grid geometry.
      */
     protected DatumShiftGrid(final DatumShiftGrid<C,T> other) {
         ArgumentChecks.ensureNonNull("other", other);
@@ -295,10 +293,10 @@ public abstract class DatumShiftGrid<C e
     }
 
     /**
-     * Returns the number of cells along each axis in the grid. The length of this array is equal to
-     * {@code coordinateToGrid} target dimensions.
+     * Returns the number of cells along each axis in the grid.
+     * The length of this array is equal to {@code coordinateToGrid} target dimensions.
      *
-     * @return The number of cells along each axis in the grid.
+     * @return the number of cells along each axis in the grid.
      */
     public int[] getGridSize() {
         return gridSize.clone();
@@ -312,7 +310,7 @@ public abstract class DatumShiftGrid<C e
      * <p>The unit of measurement for the coordinate values in the returned envelope is
      * given by {@link #getCoordinateUnit()}. The complete CRS is undefined.</p>
      *
-     * @return The domain covered by this grid.
+     * @return the domain covered by this grid.
      * @throws TransformException if an error occurred while computing the envelope.
      */
     public Envelope getDomainOfValidity() throws TransformException {
@@ -327,7 +325,7 @@ public abstract class DatumShiftGrid<C e
      * Returns the unit of measurement of input values, before conversion to grid indices.
      * The coordinate unit is usually {@link javax.measure.Units#DEGREE}, but other units are allowed.
      *
-     * @return The unit of measurement of input values before conversion to grid indices.
+     * @return the unit of measurement of input values before conversion to grid indices.
      *
      * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getInterpolationCRS()
      */
@@ -365,7 +363,7 @@ public abstract class DatumShiftGrid<C e
      *   └                      ┘
      * }
      *
-     * @return Conversion from the "real world" coordinates to grid indices including fractional parts.
+     * @return conversion from the "real world" coordinates to grid indices including fractional parts.
      */
     public LinearTransform getCoordinateToGrid() {
         return coordinateToGrid;
@@ -376,8 +374,8 @@ public abstract class DatumShiftGrid<C e
      * "Normalized coordinates" are coordinates in the unit of measurement given by {@link Unit#toSI()}.
      * For angular coordinates, this is radians. For linear coordinates, this is metres.
      *
-     * @param x The "real world" ordinate (often longitude in radians) of the point for which to get the translation.
-     * @return The grid index for the given ordinate. May be out of bounds.
+     * @param  x  the "real world" ordinate (often longitude in radians) of the point for which to get the translation.
+     * @return the grid index for the given ordinate. May be out of bounds.
      */
     public final double normalizedToGridX(final double x) {
         return x * scaleX + x0;
@@ -388,8 +386,8 @@ public abstract class DatumShiftGrid<C e
      * "Normalized coordinates" are coordinates in the unit of measurement given by {@link Unit#toSI()}.
      * For angular coordinates, this is radians. For linear coordinates, this is metres.
      *
-     * @param y The "real world" ordinate (often latitude in radians) of the point for which to get the translation.
-     * @return The grid index for the given ordinate. May be out of bounds.
+     * @param  y  the "real world" ordinate (often latitude in radians) of the point for which to get the translation.
+     * @return the grid index for the given ordinate. May be out of bounds.
      */
     public final double normalizedToGridY(final double y) {
         return y * scaleY + y0;
@@ -416,7 +414,7 @@ public abstract class DatumShiftGrid<C e
      *       the translation unit shall be the same than the unit of source ellipsoid axis lengths.</li>
      * </ul>
      *
-     * @return The unit of measurement of output values interpolated by {@code interpolateAt(…)}.
+     * @return the unit of measurement of output values interpolated by {@code interpolateAt(…)}.
      *
      * @see #interpolateAt
      */
@@ -439,9 +437,9 @@ public abstract class DatumShiftGrid<C e
      *       the translation vector by the inverse of the conversion given at step 1.</li>
      * </ol>
      *
-     * @param ordinates  The "real world" ordinate (often longitude and latitude, but not necessarily)
+     * @param ordinates  the "real world" ordinate (often longitude and latitude, but not necessarily)
      *                   of the point for which to get the translation.
-     * @return The translation vector at the given position.
+     * @return the translation vector at the given position.
      * @throws TransformException if an error occurred while computing the translation vector.
      */
     public double[] interpolateAt(final double... ordinates) throws TransformException {
@@ -476,9 +474,9 @@ public abstract class DatumShiftGrid<C e
      *   <li>Apply a bilinear interpolation and store the result in {@code vector[dim]}.</li>
      * </ol>
      *
-     * @param gridX   First grid ordinate of the point for which to get the translation.
-     * @param gridY   Second grid ordinate of the point for which to get the translation.
-     * @param vector  A pre-allocated array where to write the translation vector.
+     * @param  gridX   first grid ordinate of the point for which to get the translation.
+     * @param  gridY   second grid ordinate of the point for which to get the translation.
+     * @param  vector  a pre-allocated array where to write the translation vector.
      */
     public void interpolateInCell(double gridX, double gridY, final double[] vector) {
         int ix = (int) gridX;  gridX -= ix;
@@ -522,9 +520,9 @@ public abstract class DatumShiftGrid<C e
      * and {@code gridY}, because empirical tests suggest that the accuracy of such interpolation
      * is uncertain.
      *
-     * @param  gridX First grid ordinate of the point for which to get the translation.
-     * @param  gridY Second grid ordinate of the point for which to get the translation.
-     * @return The derivative at the given location.
+     * @param  gridX  first grid ordinate of the point for which to get the translation.
+     * @param  gridY  second grid ordinate of the point for which to get the translation.
+     * @return the derivative at the given location.
      */
     public Matrix derivativeInCell(final double gridX, final double gridY) {
         final int ix = Math.max(0, Math.min(gridSize[0] - 2, (int) gridX));
@@ -551,11 +549,11 @@ public abstract class DatumShiftGrid<C e
      *       {@linkplain #DatumShiftGrid(Unit, LinearTransform, int[], boolean, Unit) constructor javadoc}).</li>
      * </ul>
      *
-     * @param dim    The dimension of the translation vector component to get,
-     *               from 0 inclusive to {@link #getTranslationDimensions()} exclusive.
-     * @param gridX  The grid index on the <var>x</var> axis, from 0 inclusive to {@code gridSize[0]} exclusive.
-     * @param gridY  The grid index on the <var>y</var> axis, from 0 inclusive to {@code gridSize[1]} exclusive.
-     * @return The translation for the given dimension in the grid cell at the given index.
+     * @param  dim    the dimension of the translation vector component to get,
+     *                from 0 inclusive to {@link #getTranslationDimensions()} exclusive.
+     * @param  gridX  the grid index on the <var>x</var> axis, from 0 inclusive to {@code gridSize[0]} exclusive.
+     * @param  gridY  the grid index on the <var>y</var> axis, from 0 inclusive to {@code gridSize[1]} exclusive.
+     * @return the translation for the given dimension in the grid cell at the given index.
      */
     public abstract double getCellValue(int dim, int gridX, int gridY);
 
@@ -573,9 +571,9 @@ public abstract class DatumShiftGrid<C e
      * are fixed by definition to -168, -60 and +320 metres for dimensions 0, 1 and 2 respectively
      * (geocentric <var>X</var>, <var>Y</var> and <var>Z</var>).</div>
      *
-     * @param dim  The dimension for which to get an average translation value,
-     *             from 0 inclusive to {@link #getTranslationDimensions()} exclusive.
-     * @return A translation value close to the average for the given dimension.
+     * @param  dim  the dimension for which to get an average translation value,
+     *              from 0 inclusive to {@link #getTranslationDimensions()} exclusive.
+     * @return a translation value close to the average for the given dimension.
      */
     public double getCellMean(final int dim) {
         final DoubleDouble sum = new DoubleDouble();
@@ -607,7 +605,7 @@ public abstract class DatumShiftGrid<C e
      *
      * <p>This information is used for determining a tolerance threshold in iterative calculation.</p>
      *
-     * @return An estimation of cell value precision.
+     * @return an estimation of cell value precision.
      */
     public abstract double getCellPrecision();
 
@@ -628,7 +626,7 @@ public abstract class DatumShiftGrid<C e
     /**
      * Returns {@code true} if the given object is a grid containing the same data than this grid.
      *
-     * @param  other The other object to compare with this datum shift grid.
+     * @param  other  the other object to compare with this datum shift grid.
      * @return {@code true} if the given object is non-null, of the same class than this {@code DatumShiftGrid}
      *         and contains the same data.
      */
@@ -650,7 +648,7 @@ public abstract class DatumShiftGrid<C e
      * This method does not need to compute a hash code from all grid values.
      * Comparing some metadata like the grid filename is considered sufficient
      *
-     * @return A hash code based on metadata.
+     * @return a hash code based on metadata.
      */
     @Override
     public int hashCode() {
@@ -660,7 +658,7 @@ public abstract class DatumShiftGrid<C e
     /**
      * Invoked after deserialization. This method computes the transient fields.
      *
-     * @param  in The input stream from which to deserialize the datum shift grid.
+     * @param  in  the input stream from which to deserialize the datum shift grid.
      * @throws IOException if an I/O error occurred while reading or if the stream contains invalid data.
      * @throws ClassNotFoundException if the class serialized on the stream is not on the classpath.
      */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.referencing.datum;
 
 import java.util.Map;
+import java.util.Objects;
 import javax.measure.Unit;
 import javax.measure.quantity.Angle;
 import javax.xml.bind.annotation.XmlType;
@@ -28,8 +29,9 @@ import org.opengis.metadata.Identifier;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.crs.GeneralDerivedCRS;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.jaxb.gml.Measure;
@@ -42,10 +44,6 @@ import org.apache.sis.measure.Units;
 import static org.apache.sis.util.ArgumentChecks.ensureFinite;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
-// Branch-dependent imports
-import java.util.Objects;
-import org.apache.sis.internal.referencing.Formulas;
-
 
 /**
  * Defines the origin from which longitude values are determined.
@@ -149,9 +147,9 @@ public class DefaultPrimeMeridian extend
      *   </tr>
      * </table>
      *
-     * @param properties          The properties to be given to the identified object.
-     * @param greenwichLongitude  The longitude value relative to the Greenwich Meridian.
-     * @param angularUnit         The angular unit of the longitude.
+     * @param  properties          the properties to be given to the identified object.
+     * @param  greenwichLongitude  the longitude value relative to the Greenwich Meridian.
+     * @param  angularUnit         the angular unit of the longitude.
      *
      * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createPrimeMeridian(Map, double, Unit)
      */
@@ -172,7 +170,7 @@ public class DefaultPrimeMeridian extend
      *
      * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
      *
-     * @param meridian The prime meridian to copy.
+     * @param  meridian  the prime meridian to copy.
      *
      * @see #castOrCopy(PrimeMeridian)
      */
@@ -188,8 +186,8 @@ public class DefaultPrimeMeridian extend
      * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged.
      * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.
      *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
+     * @param  object  the object to get as a SIS implementation, or {@code null} if none.
+     * @return a SIS implementation containing the values of the given object (may be the
      *         given object itself), or {@code null} if the argument was null.
      */
     public static DefaultPrimeMeridian castOrCopy(final PrimeMeridian object) {
@@ -216,7 +214,7 @@ public class DefaultPrimeMeridian extend
     /**
      * Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.
      *
-     * @return The prime meridian Greenwich longitude, in {@linkplain #getAngularUnit() angular unit}.
+     * @return the prime meridian Greenwich longitude, in {@linkplain #getAngularUnit() angular unit}.
      */
     @Override
     public double getGreenwichLongitude() {
@@ -232,8 +230,8 @@ public class DefaultPrimeMeridian extend
      *     double longitudeInDegrees = primeMeridian.getGreenwichLongitude(Units.DEGREE);
      * }
      *
-     * @param unit The unit in which to express longitude.
-     * @return The Greenwich longitude in the given units.
+     * @param  unit  the unit in which to express longitude.
+     * @return the Greenwich longitude in the given units.
      */
     public double getGreenwichLongitude(final Unit<Angle> unit) {
         return getAngularUnit().getConverterTo(unit).convert(getGreenwichLongitude());
@@ -242,7 +240,7 @@ public class DefaultPrimeMeridian extend
     /**
      * Returns the angular unit of the Greenwich longitude.
      *
-     * @return The angular unit of the {@linkplain #getGreenwichLongitude() Greenwich longitude}.
+     * @return the angular unit of the {@linkplain #getGreenwichLongitude() Greenwich longitude}.
      */
     @Override
     public Unit<Angle> getAngularUnit() {
@@ -252,7 +250,7 @@ public class DefaultPrimeMeridian extend
     /**
      * Compares this prime meridian with the specified object for equality.
      *
-     * @param  object The object to compare to {@code this}.
+     * @param  object  the object to compare to {@code this}.
      * @param  mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison, or
      *         {@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} for comparing only properties
      *         relevant to coordinate transformations.
@@ -261,7 +259,7 @@ public class DefaultPrimeMeridian extend
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
         if (object == this) {
-            return true; // Slight optimization.
+            return true;                                // Slight optimization.
         }
         if (super.equals(object, mode)) switch (mode) {
             case STRICT: {
@@ -301,7 +299,7 @@ public class DefaultPrimeMeridian extend
      * See {@link org.apache.sis.referencing.AbstractIdentifiedObject#computeHashCode()}
      * for more information.
      *
-     * @return The hash code value. This value may change in any future Apache SIS version.
+     * @return the hash code value. This value may change in any future Apache SIS version.
      */
     @Override
     protected long computeHashCode() {
@@ -376,7 +374,7 @@ public class DefaultPrimeMeridian extend
         if (!isWKT1) {
             unit = getAngularUnit();
             if (convention != Convention.INTERNAL) {
-                unit = PatchedUnitFormat.toFormattable(unit);
+                unit = WKTUtilities.toFormattable(unit);
             }
         }
         formatter.append(getGreenwichLongitude(unit));

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=1766508&r1=1766507&r2=1766508&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 Oct 25 10:45:14 2016
@@ -36,7 +36,7 @@ import org.apache.sis.internal.referenci
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.7
+ * @version 0.8
  * @module
  *
  * @see Matrices#createDiagonal(int, int)
@@ -89,12 +89,12 @@ class GeneralMatrix extends MatrixSIS im
      * If {@code setToIdentity} is {@code true}, then the elements
      * on the diagonal (<var>j</var> == <var>i</var>) are set to 1.
      *
-     * @param numRow Number of rows.
-     * @param numCol Number of columns.
-     * @param setToIdentity {@code true} for initializing the matrix to the identity matrix,
-     *        or {@code false} for leaving it initialized to zero.
-     * @param precision 1 for normal precision, or 2 for extended precision.
-     *        No other value is allowed (this is not verified).
+     * @param  numRow         number of rows.
+     * @param  numCol         number of columns.
+     * @param  setToIdentity  {@code true} for initializing the matrix to the identity matrix,
+     *                        or {@code false} for leaving it initialized to zero.
+     * @param  precision      1 for normal precision, or 2 for extended precision.
+     *                        No other value is allowed (this is not verified).
      */
     GeneralMatrix(final int numRow, final int numCol, final boolean setToIdentity, final int precision) {
         ensureValidSize(numRow, numCol);
@@ -114,9 +114,9 @@ class GeneralMatrix extends MatrixSIS im
      * The array values are copied in one row at a time in row major fashion.
      * The array shall be exactly {@code numRow*numCol} in length.
      *
-     * @param numRow Number of rows.
-     * @param numCol Number of columns.
-     * @param elements Initial values.
+     * @param  numRow    number of rows.
+     * @param  numCol    number of columns.
+     * @param  elements  initial values.
      */
     GeneralMatrix(final int numRow, final int numCol, final double[] elements) {
         ensureValidSize(numRow, numCol);
@@ -129,7 +129,7 @@ class GeneralMatrix extends MatrixSIS im
     /**
      * Constructs a new matrix and copies the initial values from the given matrix.
      *
-     * @param matrix The matrix to copy.
+     * @param  matrix  the matrix to copy.
      */
     GeneralMatrix(final Matrix matrix) {
         final int numRow = matrix.getNumRow();
@@ -158,10 +158,10 @@ class GeneralMatrix extends MatrixSIS im
     /**
      * Creates a new extended precision matrix of the given size.
      *
-     * @param numRow Number of rows.
-     * @param numCol Number of columns.
-     * @param setToIdentity {@code true} for initializing the matrix to the identity matrix,
-     *        or {@code false} for leaving it initialized to zero.
+     * @param  numRow         number of rows.
+     * @param  numCol         number of columns.
+     * @param  setToIdentity  {@code true} for initializing the matrix to the identity matrix,
+     *                        or {@code false} for leaving it initialized to zero.
      */
     static GeneralMatrix createExtendedPrecision(final int numRow, final int numCol, final boolean setToIdentity) {
         if (numRow == numCol) {
@@ -262,9 +262,9 @@ class GeneralMatrix extends MatrixSIS im
      * Retrieves the value at the specified row and column of this matrix, wrapped in a {@code Number}
      * or a {@link DoubleDouble} depending on available precision.
      *
-     * @param row    The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
-     * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
-     * @return       The current value at the given row and column.
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @return the current value at the given row and column.
      */
     @Override
     public Number getNumber(int row, int column) {
@@ -285,9 +285,9 @@ class GeneralMatrix extends MatrixSIS im
     /**
      * Retrieves the value at the specified row and column of this matrix.
      *
-     * @param row    The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
-     * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
-     * @return       The current value at the given row and column.
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @return the current value at the given row and column.
      */
     @Override
     public final double getElement(final int row, final int column) {
@@ -301,9 +301,9 @@ class GeneralMatrix extends MatrixSIS im
     /**
      * Modifies the value at the specified row and column of this matrix.
      *
-     * @param row    The row index, from 0 inclusive to {@link #getNumRow() } exclusive.
-     * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
-     * @param value  The new value to set at the given row and column.
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow() } exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @param  value   the new value to set at the given row and column.
      */
     @Override
     public final void setElement(final int row, final int column, final double value) {
@@ -326,7 +326,7 @@ class GeneralMatrix extends MatrixSIS im
      * <p>This method may return a direct reference to the internal array. <strong>Do not modify.</strong>,
      * unless the {@code copy} argument is {@code true}.</p>
      *
-     * @param copy If {@code true}, then the returned array is guaranteed to be a copy, never the internal array.
+     * @param  copy  if {@code true}, then the returned array is guaranteed to be a copy, never the internal array.
      */
     static double[] getExtendedElements(final Matrix matrix, final int numRow, final int numCol, final boolean copy) {
         double[] elements;
@@ -406,11 +406,11 @@ class GeneralMatrix extends MatrixSIS im
      *       may have any values.</li>
      * </ul>
      *
-     * @param  elements The new matrix elements in a row-major array.
+     * @param  elements  the new matrix elements in a row-major array.
      * @return {@code true} if at leat one {@link DoubleDouble} instance has been found, in which case all
      *         errors terms have been initialized, or {@code false} otherwise, in which case no error term
      *         has been initialized (this is a <cite>all or nothing</cite> operation).
-     * @throws IllegalArgumentException If the given array does not have the expected length.
+     * @throws IllegalArgumentException if the given array does not have the expected length.
      *
      * @see Matrices#create(int, int, Number[])
      */
@@ -424,7 +424,10 @@ class GeneralMatrix extends MatrixSIS im
         }
         boolean isExtended = false;
         for (int i=0; i<length; i++) {
-            final Number value = newValues[i];
+            Number value = newValues[i];
+            if (DoubleDouble.shouldConvert(value)) {
+                value = new DoubleDouble(value);
+            }
             final double element = value.doubleValue();
             elements[i] = element;
             final double error;
@@ -461,7 +464,7 @@ class GeneralMatrix extends MatrixSIS im
      * Sets this matrix to the values of another matrix. This method overrides the default implementation with a more
      * efficient implementation in the particular case where the other matrix is an instance of {@code GeneralMatrix}.
      *
-     * @param matrix  The matrix to copy.
+     * @param  matrix  the matrix to copy.
      * @throws MismatchedMatrixSizeException if the given matrix has a different size than this matrix.
      *
      * @since 0.7
@@ -500,7 +503,7 @@ class GeneralMatrix extends MatrixSIS im
     /**
      * Implementation of {@link #isAffine()} with control on whether we require the matrix to be square.
      *
-     * @param square {@code true} if the matrix must be square, or {@code false} for allowing non-square matrices.
+     * @param  square  {@code true} if the matrix must be square, or {@code false} for allowing non-square matrices.
      */
     final boolean isAffine(final boolean square) {
         final int numRow = this.numRow;                     // Protection against accidental changes.
@@ -540,7 +543,7 @@ class GeneralMatrix extends MatrixSIS im
         if (numRow != numCol) {
             return false;
         }
-        int di = 0; // Index of next diagonal element.
+        int di = 0;                                         // Index of next diagonal element.
         final int length = numRow * numCol;
         for (int i=0; i<length; i++) {
             final double element = elements[i];
@@ -630,7 +633,7 @@ class GeneralMatrix extends MatrixSIS im
      * Returns {@code true} if the specified object is of type {@code GeneralMatrix} and
      * all of the data members are equal to the corresponding data members in this matrix.
      *
-     * @param object The object to compare with this matrix for equality.
+     * @param  object  the object to compare with this matrix for equality.
      * @return {@code true} if the given object is equal to this matrix.
      */
     @Override

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=1766508&r1=1766507&r2=1766508&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 Oct 25 10:45:14 2016
@@ -122,9 +122,9 @@ public final class Matrices extends Stat
      * {@value org.apache.sis.referencing.operation.matrix.Matrix4#SIZE} inclusive, the matrix
      * is guaranteed to be an instance of one of {@link Matrix1} … {@link Matrix4} subtypes.</div>
      *
-     * @param numRow For a math transform, this is the number of {@linkplain MathTransform#getTargetDimensions() target dimensions} + 1.
-     * @param numCol For a math transform, this is the number of {@linkplain MathTransform#getSourceDimensions() source dimensions} + 1.
-     * @return An identity matrix of the given size.
+     * @param  numRow  for a math transform, this is the number of {@linkplain MathTransform#getTargetDimensions() target dimensions} + 1.
+     * @param  numCol  for a math transform, this is the number of {@linkplain MathTransform#getSourceDimensions() source dimensions} + 1.
+     * @return an identity matrix of the given size.
      */
     public static MatrixSIS createDiagonal(final int numRow, final int numCol) {
         if (numRow == numCol) {
@@ -144,9 +144,9 @@ public final class Matrices extends Stat
      * {@value org.apache.sis.referencing.operation.matrix.Matrix4#SIZE} inclusive, the matrix
      * is guaranteed to be an instance of one of {@link Matrix1} … {@link Matrix4} subtypes.</div>
      *
-     * @param numRow For a math transform, this is the number of {@linkplain MathTransform#getTargetDimensions() target dimensions} + 1.
-     * @param numCol For a math transform, this is the number of {@linkplain MathTransform#getSourceDimensions() source dimensions} + 1.
-     * @return A matrix of the given size with only zero values.
+     * @param  numRow  for a math transform, this is the number of {@linkplain MathTransform#getTargetDimensions() target dimensions} + 1.
+     * @param  numCol  for a math transform, this is the number of {@linkplain MathTransform#getSourceDimensions() source dimensions} + 1.
+     * @return a matrix of the given size with only zero values.
      */
     public static MatrixSIS createZero(final int numRow, final int numCol) {
         if (numRow == numCol) switch (numRow) {
@@ -176,10 +176,10 @@ public final class Matrices extends Stat
      * {@value org.apache.sis.referencing.operation.matrix.Matrix4#SIZE} inclusive, the matrix
      * is guaranteed to be an instance of one of {@link Matrix1} … {@link Matrix4} subtypes.</div>
      *
-     * @param  numRow   Number of rows.
-     * @param  numCol   Number of columns.
-     * @param  elements The matrix elements in a row-major array. Column indices vary fastest.
-     * @return A matrix initialized to the given elements.
+     * @param  numRow    number of rows.
+     * @param  numCol    number of columns.
+     * @param  elements  the matrix elements in a row-major array. Column indices vary fastest.
+     * @return a matrix initialized to the given elements.
      *
      * @see MatrixSIS#setElements(double[])
      */
@@ -198,10 +198,10 @@ public final class Matrices extends Stat
      * Creates a matrix of size {@code numRow} × {@code numCol} initialized to the given numbers.
      * The elements array size must be equals to {@code numRow*numCol}. Column indices vary fastest.
      *
-     * @param  numRow   Number of rows.
-     * @param  numCol   Number of columns.
-     * @param  elements The matrix elements in a row-major array. Column indices vary fastest.
-     * @return A matrix initialized to the given elements.
+     * @param  numRow    number of rows.
+     * @param  numCol    number of columns.
+     * @param  elements  the matrix elements in a row-major array. Column indices vary fastest.
+     * @return a matrix initialized to the given elements.
      */
     public static MatrixSIS create(final int numRow, final int numCol, final Number[] elements) {
         ArgumentChecks.ensureNonNull("elements", elements);
@@ -240,7 +240,12 @@ public final class Matrices extends Stat
         } else {
             dstCorner = srcCorner = srcOppositeCorner = null;
         }
-        final MatrixSIS matrix = createZero(dstAxes.length+1, srcAxes.length+1);
+        /*
+         * Unconditionally create extended precision matrix even if standard precision would be
+         * enough because callers in other package may perform additional arithmetic operations
+         * on it (for example org.apache.sis.referencing.cs.CoordinateSystems.swapAndScaleAxes).
+         */
+        final MatrixSIS matrix = new GeneralMatrix(dstAxes.length+1, srcAxes.length+1, false, 2);
         /*
          * Maps source axes to destination axes. If no axis is moved (for example if the user
          * want to transform (NORTH,EAST) to (SOUTH,EAST)), then source and destination index
@@ -265,18 +270,23 @@ public final class Matrices extends Stat
                      * They will be left to zero, which is their desired value.
                      */
                     final boolean same = srcDir.equals(dstDir);
-                    double scale = same ? +1 : -1;
-                    double translate = 0;
                     if (useEnvelopes) {
                         // See the comment in transform(Envelope, Envelope) for an explanation about why
                         // we use the lower/upper corners instead than getMinimum()/getMaximum() methods.
-                        translate  = dstCorner.getOrdinate(dstIndex);
-                        scale     *= dstEnvelope.getSpan(dstIndex) /
-                                     srcEnvelope.getSpan(srcIndex);
-                        translate -= scale * (same ? srcCorner : srcOppositeCorner).getOrdinate(srcIndex);
+                        final DoubleDouble scale = new DoubleDouble(same ? +1 : -1, 0);
+                        scale.multiply(dstEnvelope.getSpan(dstIndex));
+                        scale.divide  (srcEnvelope.getSpan(srcIndex));
+
+                        final DoubleDouble translate = new DoubleDouble(scale);
+                        translate.multiply((same ? srcCorner : srcOppositeCorner).getOrdinate(srcIndex));
+                        translate.negate();
+                        translate.add(dstCorner.getOrdinate(dstIndex));
+
+                        matrix.setNumber(dstIndex, srcIndex,       scale);
+                        matrix.setNumber(dstIndex, srcAxes.length, translate);
+                    } else {
+                        matrix.setElement(dstIndex, srcIndex, same ? +1 : -1);
                     }
-                    matrix.setElement(dstIndex, srcIndex,       scale);
-                    matrix.setElement(dstIndex, srcAxes.length, translate);
                 }
             }
             if (!hasFound) {
@@ -332,9 +342,9 @@ public final class Matrices extends Stat
      *   └     ┘   └              ┘   └     ┘
      * }
      *
-     * @param  srcEnvelope The source envelope.
-     * @param  dstEnvelope The destination envelope.
-     * @return The transform from the given source envelope to target envelope.
+     * @param  srcEnvelope  the source envelope.
+     * @param  dstEnvelope  the destination envelope.
+     * @return the transform from the given source envelope to target envelope.
      *
      * @see #createTransform(AxisDirection[], AxisDirection[])
      * @see #createTransform(Envelope, AxisDirection[], Envelope, AxisDirection[])
@@ -409,10 +419,10 @@ public final class Matrices extends Stat
      *   └    ┘   └         ┘   └    ┘
      * }
      *
-     * @param  srcAxes The ordered sequence of axis directions for source coordinate system.
-     * @param  dstAxes The ordered sequence of axis directions for destination coordinate system.
-     * @return The transform from the given source axis directions to the given target axis directions.
-     * @throws IllegalArgumentException If {@code dstAxes} contains at least one axis not found in {@code srcAxes},
+     * @param  srcAxes  the ordered sequence of axis directions for source coordinate system.
+     * @param  dstAxes  the ordered sequence of axis directions for destination coordinate system.
+     * @return the transform from the given source axis directions to the given target axis directions.
+     * @throws IllegalArgumentException if {@code dstAxes} contains at least one axis not found in {@code srcAxes},
      *         or if some colinear axes were found.
      *
      * @see #createTransform(Envelope, Envelope)
@@ -469,15 +479,15 @@ public final class Matrices extends Stat
      * }
      * </div>
      *
-     * @param  srcEnvelope The source envelope.
-     * @param  srcAxes     The ordered sequence of axis directions for source coordinate system.
-     * @param  dstEnvelope The destination envelope.
-     * @param  dstAxes     The ordered sequence of axis directions for destination coordinate system.
-     * @return The transform from the given source envelope and axis directions
+     * @param  srcEnvelope  the source envelope.
+     * @param  srcAxes      the ordered sequence of axis directions for source coordinate system.
+     * @param  dstEnvelope  the destination envelope.
+     * @param  dstAxes      the ordered sequence of axis directions for destination coordinate system.
+     * @return the transform from the given source envelope and axis directions
      *         to the given envelope and target axis directions.
-     * @throws MismatchedDimensionException If an envelope {@linkplain Envelope#getDimension() dimension} does not
+     * @throws MismatchedDimensionException if an envelope {@linkplain Envelope#getDimension() dimension} does not
      *         match the length of the axis directions sequence.
-     * @throws IllegalArgumentException If {@code dstAxes} contains at least one axis not found in {@code srcAxes},
+     * @throws IllegalArgumentException if {@code dstAxes} contains at least one axis not found in {@code srcAxes},
      *         or if some colinear axes were found.
      *
      * @see #createTransform(Envelope, Envelope)
@@ -531,8 +541,8 @@ public final class Matrices extends Stat
      * The inverse of the matrix created by this method will put {@link Double#NaN} values in the extra dimensions.
      * Other dimensions will work as expected.
      *
-     * @param  sourceDimensions The number of dimensions in source coordinates.
-     * @param  selectedDimensions The 0-based indices of source ordinate values to keep.
+     * @param  sourceDimensions    the number of dimensions in source coordinates.
+     * @param  selectedDimensions  the 0-based indices of source ordinate values to keep.
      *         The length of this array will be the number of dimensions in target coordinates.
      * @return An affine transform matrix keeping only the given source dimensions, and discarding all others.
      * @throws IllegalArgumentException if a value of {@code selectedDimensions} is lower than 0
@@ -607,10 +617,10 @@ public final class Matrices extends Stat
      * }
      * </div>
      *
-     * @param  firstAffectedOrdinate The lowest index of the affected ordinates.
-     * @param  subMatrix The matrix to use for affected ordinates.
-     * @param  numTrailingOrdinates Number of trailing ordinates to pass through.
-     * @return A matrix for the same transform than the given matrix,
+     * @param  firstAffectedOrdinate  the lowest index of the affected ordinates.
+     * @param  subMatrix              the matrix to use for affected ordinates.
+     * @param  numTrailingOrdinates   number of trailing ordinates to pass through.
+     * @return a matrix for the same transform than the given matrix,
      *         augmented with leading and trailing pass-through coordinates.
      *
      * @see org.apache.sis.referencing.operation.DefaultMathTransformFactory#createPassThroughTransform(int, MathTransform, int)
@@ -761,8 +771,8 @@ public final class Matrices extends Stat
      * and {@value org.apache.sis.referencing.operation.matrix.Matrix4#SIZE} inclusive, the returned matrix is
      * usually an instance of one of {@link Matrix1} … {@link Matrix4} subtypes.</div>
      *
-     * @param matrix The matrix to copy, or {@code null}.
-     * @return A copy of the given matrix, or {@code null} if the given matrix was null.
+     * @param  matrix  the matrix to copy, or {@code null}.
+     * @return a copy of the given matrix, or {@code null} if the given matrix was null.
      *
      * @see MatrixSIS#clone()
      * @see MatrixSIS#castOrCopy(Matrix)
@@ -790,8 +800,8 @@ public final class Matrices extends Stat
      * Returns an unmodifiable view of the given matrix. The returned matrix is immutable
      * only if the given {@code matrix} is not modified anymore after this method call.
      *
-     * @param matrix The matrix for which to get an unmodifiable view, or {@code null}.
-     * @return A unmodifiable view of the given matrix, or {@code null} if the given matrix was null.
+     * @param  matrix  the matrix for which to get an unmodifiable view, or {@code null}.
+     * @return a unmodifiable view of the given matrix, or {@code null} if the given matrix was null.
      *
      * @since 0.6
      */
@@ -807,9 +817,9 @@ public final class Matrices extends Stat
      * Returns a new matrix which is the result of multiplying the first matrix with the second one.
      * In other words, returns {@code m1} × {@code m2}.
      *
-     * @param  m1 The first matrix to multiply.
-     * @param  m2 The second matrix to multiply.
-     * @return The result of {@code m1} × {@code m2}.
+     * @param  m1  the first matrix to multiply.
+     * @param  m2  the second matrix to multiply.
+     * @return the result of {@code m1} × {@code m2}.
      * @throws MismatchedMatrixSizeException if the number of columns in {@code m1} is not equals to the
      *         number of rows in {@code m2}.
      *
@@ -831,8 +841,8 @@ public final class Matrices extends Stat
     /**
      * Returns the inverse of the given matrix.
      *
-     * @param  matrix The matrix to inverse, or {@code null}.
-     * @return The inverse of this matrix, or {@code null} if the given matrix was null.
+     * @param  matrix  the matrix to inverse, or {@code null}.
+     * @return the inverse of this matrix, or {@code null} if the given matrix was null.
      * @throws NoninvertibleMatrixException if the given matrix is not invertible.
      *
      * @see MatrixSIS#inverse()
@@ -856,7 +866,7 @@ public final class Matrices extends Stat
      * 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.
+     * @param  matrix  the matrix to test.
      * @return {@code true} if the matrix represents an affine transform.
      *
      * @see MatrixSIS#isAffine()
@@ -874,7 +884,7 @@ public final class Matrices extends Stat
      * This method returns {@code true} if the given matrix {@linkplain #isAffine(Matrix) is affine}
      * and differs from the identity matrix only in the last column.
      *
-     * @param matrix The matrix to test.
+     * @param  matrix  the matrix to test.
      * @return {@code true} if the matrix represents a translation.
      *
      * @since 0.7
@@ -906,8 +916,8 @@ public final class Matrices extends Stat
      * errors. In case of doubt, it is often safer to use the strict {@link MatrixSIS#isIdentity()} method instead
      * than this one.</p>
      *
-     * @param  matrix The matrix to test for identity.
-     * @param  tolerance The tolerance value, or 0 for a strict comparison.
+     * @param  matrix     the matrix to test for identity.
+     * @param  tolerance  the tolerance value, or 0 for a strict comparison.
      * @return {@code true} if this matrix is close to the identity matrix given the tolerance threshold.
      *
      * @see MatrixSIS#isIdentity()
@@ -924,7 +934,7 @@ public final class Matrices extends Stat
                 if (i == j) {
                     e--;
                 }
-                if (!(Math.abs(e) <= tolerance)) {  // Uses '!' in order to catch NaN values.
+                if (!(Math.abs(e) <= tolerance)) {              // Uses '!' in order to catch NaN values.
                     return false;
                 }
             }
@@ -947,13 +957,13 @@ public final class Matrices extends Stat
      * and <var>v2</var><sub>j,i</sub> to compare, the tolerance threshold is scaled by
      * {@code max(abs(v1), abs(v2))}. Otherwise the threshold is used as-is.
      *
-     * @param  m1       The first matrix to compare, or {@code null}.
-     * @param  m2       The second matrix to compare, or {@code null}.
-     * @param  epsilon  The tolerance value.
-     * @param  relative If {@code true}, then the tolerance value is relative to the magnitude
-     *         of the matrix elements being compared.
-     * @return {@code true} if the values of the two matrix do not differ by a quantity
-     *         greater than the given tolerance threshold.
+     * @param  m1        the first matrix to compare, or {@code null}.
+     * @param  m2        the second matrix to compare, or {@code null}.
+     * @param  epsilon   the tolerance value.
+     * @param  relative  if {@code true}, then the tolerance value is relative to the magnitude
+     *                   of the matrix elements being compared.
+     * @return {@code true} if the values of the two matrix do not differ by a quantity greater
+     *         than the given tolerance threshold.
      *
      * @see MatrixSIS#equals(Matrix, double)
      */
@@ -1010,9 +1020,9 @@ public final class Matrices extends Stat
      *       For more control, use {@link #equals(Matrix, Matrix, double, boolean)} instead.</li>
      * </ul>
      *
-     * @param  m1  The first matrix to compare, or {@code null}.
-     * @param  m2  The second matrix to compare, or {@code null}.
-     * @param  mode The strictness level of the comparison.
+     * @param  m1    the first matrix to compare, or {@code null}.
+     * @param  m2    the second matrix to compare, or {@code null}.
+     * @param  mode  the strictness level of the comparison.
      * @return {@code true} if both matrices are equal.
      *
      * @see MatrixSIS#equals(Object, ComparisonMode)
@@ -1059,8 +1069,8 @@ public final class Matrices extends Stat
      * reference system. In addition, the last column is often a translation vector having a magnitude very
      * different than the other columns.</div>
      *
-     * @param  matrix The matrix for which to get a string representation.
-     * @return A string representation of the given matrix.
+     * @param  matrix  the matrix for which to get a string representation.
+     * @return a string representation of the given matrix.
      */
     public static String toString(final Matrix matrix) {
         final int numRow = matrix.getNumRow();
@@ -1077,7 +1087,7 @@ public final class Matrices extends Stat
          * Create now the string representation of all matrix elements and measure the width
          * of the integer field and the fraction field, then the total width of each column.
          */
-        int spacing = 1; // Spacing is 1 before the first column only, then SPACING for other columns.
+        int spacing = 1;                // Spacing is 1 before the first column only, then SPACING for other columns.
         for (int i=0; i<numCol; i++) {
             for (int j=0; j<numRow; j++) {
                 final int flatIndex = j*numCol + i;
@@ -1091,7 +1101,7 @@ public final class Matrices extends Stat
                  */
                 if (value == -1 || value == 0 || value == +1) {
                     noFractionDigits[flatIndex] = true;
-                    width = spacing + element.length() - 2; // The -2 is for ignoring the trailing ".0"
+                    width = spacing + element.length() - 2;           // The -2 is for ignoring the trailing ".0"
                     widthBeforeFraction[i] = (byte) Math.max(widthBeforeFraction[i], width);
                 } else {
                     /*
@@ -1128,7 +1138,7 @@ public final class Matrices extends Stat
                 elements[flatIndex] = element;
             }
             totalWidth += columnWidth[i];
-            spacing = SPACING; // Specing before all columns after the first one.
+            spacing = SPACING;                              // Spacing before all columns after the first one.
         }
         /*
          * Now append the formatted elements with the appropriate amount of spaces before each value,
@@ -1147,9 +1157,9 @@ public final class Matrices extends Stat
                 int spaces, s = element.lastIndexOf('.');
                 if (s >= 0) {
                     if (hasDecimalSeparator[i]) s++;
-                    spaces = widthBeforeFraction[i] - s; // Number of spaces for alignment on the decimal separator
+                    spaces = widthBeforeFraction[i] - s;    // Number of spaces for alignment on the decimal separator
                 } else {
-                    spaces = columnWidth[i] - width; // Number of spaces for right alignment (NaN or ∞ cases)
+                    spaces = columnWidth[i] - width;        // Number of spaces for right alignment (NaN or ∞ cases)
                 }
                 buffer.append(CharSequences.spaces(spaces)).append(element);
                 if (s >= 0) {
@@ -1159,7 +1169,7 @@ public final class Matrices extends Stat
                      */
                     s += maximumFractionDigits[i] - width;
                     if (noFractionDigits[flatIndex]) {
-                        buffer.setLength(buffer.length() - 2); // Erase the trailing ".0"
+                        buffer.setLength(buffer.length() - 2);      // Erase the trailing ".0"
                         s += 2;
                     } else {
                         int n = Math.min(s, maximumPaddingZeros[flatIndex]);

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=1766508&r1=1766507&r2=1766508&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java [UTF-8] Tue Oct 25 10:45:14 2016
@@ -77,7 +77,7 @@ public abstract class MatrixSIS implemen
      * Ensures that the given array is non-null and has the expected length.
      * This is a convenience method for subclasses constructors.
      *
-     * @throws IllegalArgumentException If the given array does not have the expected length.
+     * @throws IllegalArgumentException if the given array does not have the expected length.
      */
     static void ensureLengthMatch(final int expected, final double[] elements) throws IllegalArgumentException {
         ArgumentChecks.ensureNonNull("elements", elements);
@@ -106,10 +106,10 @@ public abstract class MatrixSIS implemen
      * Ensures that the number of rows of a given matrix matches the given value.
      * This is a convenience method for {@link #multiply(Matrix)} implementations.
      *
-     * @param expected The expected number of rows.
-     * @param actual   The actual number of rows in the matrix to verify.
-     * @param numCol   The number of columns to report in case of errors. This is an arbitrary
-     *                 value and have no incidence on the verification performed by this method.
+     * @param  expected  the expected number of rows.
+     * @param  actual    the actual number of rows in the matrix to verify.
+     * @param  numCol    the number of columns to report in case of errors. This is an arbitrary
+     *                   value and have no incidence on the verification performed by this method.
      */
     static void ensureNumRowMatch(final int expected, final int actual, final int numCol) {
         if (actual != expected) {
@@ -130,8 +130,8 @@ public abstract class MatrixSIS implemen
      * an instance of {@code MatrixSIS}, then it is returned unchanged. Otherwise all elements
      * are copied in a new {@code MatrixSIS} object.
      *
-     * @param  matrix The matrix to cast or copy, or {@code null}.
-     * @return The matrix argument if it can be safely casted (including {@code null} argument),
+     * @param  matrix  the matrix to cast or copy, or {@code null}.
+     * @return the matrix argument if it can be safely casted (including {@code null} argument),
      *         or a copy of the given matrix otherwise.
      *
      * @see Matrices#copy(Matrix)
@@ -166,20 +166,42 @@ public abstract class MatrixSIS implemen
      * Retrieves the value at the specified row and column of this matrix, wrapped in a {@code Number}.
      * The {@code Number} type depends on the matrix accuracy.
      *
-     * @param row    The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
-     * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
-     * @return       The current value at the given row and column.
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @return the current value at the given row and column.
      */
     public Number getNumber(int row, int column) {
         return getElement(row, column);
     }
 
     /**
+     * Modifies the value at the specified row and column of this matrix.
+     * This method is the converses of {@link #getNumber(int, int)}.
+     *
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @param  value   the new matrix element value.
+     *
+     * @since 0.8
+     *
+     * @see #setElement(int, int, double)
+     */
+    public void setNumber(int row, int column, final Number value) {
+        if (value instanceof DoubleDouble) {
+            set(row, column, (DoubleDouble) value);
+        } else if (DoubleDouble.shouldConvert(value)) {
+            set(row, column, new DoubleDouble(value));
+        } else {
+            setElement(row, column, value.doubleValue());
+        }
+    }
+
+    /**
      * Retrieves the value at the specified row and column of this matrix.
      *
-     * @param row    The row index, from 0 inclusive to {@link #getNumRow()} exclusive.
-     * @param column The column index, from 0 inclusive to {@link #getNumCol()} exclusive.
-     * @return       The current value at the given row and column.
+     * @param  row     the row index, from 0 inclusive to {@link #getNumRow()} exclusive.
+     * @param  column  the column index, from 0 inclusive to {@link #getNumCol()} exclusive.
+     * @return the current value at the given row and column.
      */
     @Override
     public abstract double getElement(int row, int column);
@@ -188,7 +210,7 @@ public abstract class MatrixSIS implemen
      * Returns a copy of all matrix elements in a flat, row-major (column indices vary fastest) array.
      * The array length is <code>{@linkplain #getNumRow()} * {@linkplain #getNumCol()}</code>.
      *
-     * @return A copy of all current matrix elements in a row-major array.
+     * @return a copy of all current matrix elements in a row-major array.
      */
     public double[] getElements() {
         final int numRow = getNumRow();
@@ -207,8 +229,8 @@ public abstract class MatrixSIS implemen
      * All subclasses in this {@code org.apache.sis.referencing.operation.matrix} package override this
      * method with a more efficient implementation.
      *
-     * @param dest The destination array. May be longer than necessary (this happen when the caller needs to
-     *             append {@link org.apache.sis.internal.util.DoubleDouble#error} values after the elements).
+     * @param  dest  the destination array. May be longer than necessary (this happen when the caller needs to
+     *               append {@link org.apache.sis.internal.util.DoubleDouble#error} values after the elements).
      */
     void getElements(final double[] dest) {
         final double[] elements = getElements();
@@ -219,10 +241,10 @@ public abstract class MatrixSIS implemen
      * Copies the elements of the given matrix in the given array.
      * This method ignores the error terms, if any.
      *
-     * @param matrix   The matrix to copy.
-     * @param numRow   {@code matrix.getNumRow()}.
-     * @param numCol   {@code matrix.getNumCol()}.
-     * @param elements Where to copy the elements.
+     * @param  matrix    the matrix to copy.
+     * @param  numRow    {@code matrix.getNumRow()}.
+     * @param  numCol    {@code matrix.getNumCol()}.
+     * @param  elements  where to copy the elements.
      */
     static void getElements(final Matrix matrix, final int numRow, final int numCol, final double[] elements) {
         if (matrix instanceof MatrixSIS) {
@@ -251,17 +273,17 @@ public abstract class MatrixSIS implemen
     /**
      * Sets elements in a sub-region of this matrix, optionally including error terms.
      *
-     * @param source    Row-major values as given by {@link ExtendedPrecisionMatrix#getExtendedElements()}.
-     * @param length    Number of elements ({@code numRow} × {@code numCol}) in the source matrix, not including error terms.
-     * @param stride    Number of columns in the source matrix, used for computing indices in {@code source} array.
-     * @param srcRow    Index of the first row from the {@code source} to copy in {@code this}.
-     * @param srcCol    Index of the first column from the {@code source} to copy in {@code this}.
-     * @param dstRow    Index of the first row in {@code this} where to copy the {@code source} values.
-     * @param dstCol    Index of the first column in {@code this} where to copy the {@code source} values.
-     * @param numRow    Number of rows to copy.
-     * @param numCol    Number of columns to copy.
-     * @param transfer  If both {@code source} and {@code this} use extended precision,
-     *                  the temporary object to use for transferring values. Otherwise {@code null}.
+     * @param  source     row-major values as given by {@link ExtendedPrecisionMatrix#getExtendedElements()}.
+     * @param  length     number of elements ({@code numRow} × {@code numCol}) in the source matrix, not including error terms.
+     * @param  stride     number of columns in the source matrix, used for computing indices in {@code source} array.
+     * @param  srcRow     index of the first row from the {@code source} to copy in {@code this}.
+     * @param  srcCol     index of the first column from the {@code source} to copy in {@code this}.
+     * @param  dstRow     index of the first row in {@code this} where to copy the {@code source} values.
+     * @param  dstCol     index of the first column in {@code this} where to copy the {@code source} values.
+     * @param  numRow     number of rows to copy.
+     * @param  numCol     number of columns to copy.
+     * @param  transfer   if both {@code source} and {@code this} use extended precision,
+     *                    the temporary object to use for transferring values. Otherwise {@code null}.
      */
     final void setElements(final double[] source, final int length, final int stride, final DoubleDouble transfer,
                            int srcRow, final int srcCol,
@@ -287,7 +309,7 @@ public abstract class MatrixSIS implemen
      * Sets this matrix to the values of another matrix.
      * The given matrix must have the same size.
      *
-     * @param matrix  The matrix to copy.
+     * @param  matrix  the matrix to copy.
      * @throws MismatchedMatrixSizeException if the given matrix has a different size than this matrix.
      *
      * @since 0.7
@@ -448,9 +470,9 @@ public abstract class MatrixSIS implemen
      *   </tr>
      * </table>
      *
-     * @param srcDim The dimension of the ordinate to rescale in the source coordinates.
-     * @param scale  The amount by which to multiply the source ordinate value before to apply the transform, or {@code null} if none.
-     * @param offset The amount by which to translate the source ordinate value before to apply the transform, or {@code null} if none.
+     * @param  srcDim  the dimension of the ordinate to rescale in the source coordinates.
+     * @param  scale   the amount by which to multiply the source ordinate value before to apply the transform, or {@code null} if none.
+     * @param  offset  the amount by which to translate the source ordinate value before to apply the transform, or {@code null} if none.
      * @throws UnsupportedOperationException if this matrix is unmodifiable.
      *
      * @see AffineTransform#concatenate(AffineTransform)
@@ -483,9 +505,9 @@ public abstract class MatrixSIS implemen
      * given dimension. Converting a point with the resulting matrix is equivalent to first convert the point with
      * the original matrix, then convert the result with {@code ordinates[tgtDim] = ordinates[tgtDim] * scale + offset}.
      *
-     * @param tgtDim The dimension of the ordinate to rescale in the target coordinates.
-     * @param scale  The amount by which to multiply the target ordinate value after this transform, or {@code null} if none.
-     * @param offset The amount by which to translate the target ordinate value after this transform, or {@code null} if none.
+     * @param  tgtDim  the dimension of the ordinate to rescale in the target coordinates.
+     * @param  scale   the amount by which to multiply the target ordinate value after this transform, or {@code null} if none.
+     * @param  offset  the amount by which to translate the target ordinate value after this transform, or {@code null} if none.
      * @throws UnsupportedOperationException if this matrix is unmodifiable.
      *
      * @see AffineTransform#preConcatenate(AffineTransform)
@@ -520,8 +542,8 @@ public abstract class MatrixSIS implemen
      * <code>{@linkplain AffineTransform#concatenate AffineTransform.concatenate}(other)</code>:
      * first transforms by the supplied transform and then transform the result by the original transform.
      *
-     * @param  matrix The matrix to multiply to this matrix.
-     * @return The result of {@code this} × {@code matrix}.
+     * @param  matrix  the matrix to multiply to this matrix.
+     * @return the result of {@code this} × {@code matrix}.
      * @throws MismatchedMatrixSizeException if the number of rows in the given matrix is not equals to the
      *         number of columns in this matrix.
      */
@@ -538,8 +560,8 @@ public abstract class MatrixSIS implemen
      * This is equivalent to first computing the inverse of {@code this}, then multiplying the result
      * by the given matrix.
      *
-     * @param  matrix The matrix to solve.
-     * @return The <var>U</var> matrix that satisfies {@code this} × <var>U</var> = {@code matrix}.
+     * @param  matrix  the matrix to solve.
+     * @return the <var>U</var> matrix that satisfies {@code this} × <var>U</var> = {@code matrix}.
      * @throws MismatchedMatrixSizeException if the number of rows in the given matrix is not equals
      *         to the number of columns in this matrix.
      * @throws NoninvertibleMatrixException if this matrix is not invertible.
@@ -551,7 +573,7 @@ public abstract class MatrixSIS implemen
     /**
      * Returns the inverse of this matrix.
      *
-     * @return The inverse of this matrix.
+     * @return the inverse of this matrix.
      * @throws NoninvertibleMatrixException if this matrix is not invertible.
      *
      * @see AffineTransform#createInverse()
@@ -564,9 +586,9 @@ public abstract class MatrixSIS implemen
      * Returns a new matrix with the same elements than this matrix except for the specified rows.
      * This method is useful for removing a range of <em>target</em> dimensions in an affine transform.
      *
-     * @param  lower Index of the first row to remove (inclusive).
-     * @param  upper Index after the last row to remove (exclusive).
-     * @return A copy of this matrix with the specified rows removed.
+     * @param  lower  index of the first row to remove (inclusive).
+     * @param  upper  index after the last row to remove (exclusive).
+     * @return a copy of this matrix with the specified rows removed.
      *
      * @since 0.7
      */
@@ -600,9 +622,9 @@ public abstract class MatrixSIS implemen
      * This method is useful for removing a range of <em>source</em> dimensions in an affine transform.
      * Coordinates will be converted as if the values in the removed dimensions were zeros.
      *
-     * @param  lower  Index of the first column to remove (inclusive).
-     * @param  upper  Index after the last column to remove (exclusive).
-     * @return A copy of this matrix with the specified columns removed.
+     * @param  lower  index of the first column to remove (inclusive).
+     * @param  upper  index after the last column to remove (exclusive).
+     * @return a copy of this matrix with the specified columns removed.
      *
      * @since 0.7
      */
@@ -634,7 +656,7 @@ public abstract class MatrixSIS implemen
     /**
      * Returns a hash code value based on the data values in this matrix.
      *
-     * @return A hash code value for this matrix.
+     * @return a hash code value for this matrix.
      */
     @Override
     public int hashCode() {
@@ -645,7 +667,7 @@ public abstract class MatrixSIS implemen
      * Returns {@code true} if the specified object is of the same class than this matrix and
      * all of the data members are equal to the corresponding data members in this matrix.
      *
-     * @param object The object to compare with this matrix for equality.
+     * @param  object  the object to compare with this matrix for equality.
      * @return {@code true} if the given object is equal to this matrix.
      */
     @Override
@@ -680,8 +702,8 @@ public abstract class MatrixSIS implemen
      *       smaller than or equals to the given threshold.</li>
      * </ul>
      *
-     * @param matrix    The matrix to compare.
-     * @param tolerance The tolerance value.
+     * @param  matrix     the matrix to compare.
+     * @param  tolerance  the tolerance value.
      * @return {@code true} if this matrix is close enough to the given matrix given the tolerance value.
      *
      * @see Matrices#equals(Matrix, Matrix, double, boolean)
@@ -706,8 +728,8 @@ public abstract class MatrixSIS implemen
      *       The threshold value is determined empirically and may change in any future SIS versions.</li>
      * </ul>
      *
-     * @param  object The object to compare to {@code this}.
-     * @param  mode The strictness level of the comparison.
+     * @param  object  the object to compare to {@code this}.
+     * @param  mode    the strictness level of the comparison.
      * @return {@code true} if both objects are equal.
      *
      * @see Matrices#equals(Matrix, Matrix, ComparisonMode)
@@ -720,7 +742,7 @@ public abstract class MatrixSIS implemen
     /**
      * Returns a clone of this matrix.
      *
-     * @return A new matrix of the same class and with the same values than this matrix.
+     * @return a new matrix of the same class and with the same values than this matrix.
      *
      * @see Matrices#copy(Matrix)
      */




Mime
View raw message