sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1766204 [1/2] - in /sis/branches/JDK8: application/sis-console/src/main/java/org/apache/sis/console/ application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core...
Date Sat, 22 Oct 2016 15:48:56 GMT
Author: desruisseaux
Date: Sat Oct 22 15:48:56 2016
New Revision: 1766204

URL: http://svn.apache.org/viewvc?rev=1766204&view=rev
Log:
Remove PatchedUnitFormat. It should not be needed anymore since we will provide our own UnitFormat implementation.
Provide cleaner implementations of Units.toStandardUnit(...) and Units.derivative(...). It is now possible since we control our implementation details.
This commit contains also opportunistic Javadoc formatting.

Added:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractConverter.java   (with props)
Removed:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
Modified:
    sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
    sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/ConcatenatedConverter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java

Modified: sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -52,7 +52,6 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.DirectPositionView;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.storage.CodeType;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.internal.util.X364;
@@ -476,8 +475,8 @@ final class TransformCommand extends Met
             final CoordinateSystemAxis axis = cs.getAxis(i);
             String name =  axis.getName().getCode();
             name = Transliterator.DEFAULT.toShortAxisName(cs, axis.getDirection(), name);
-            final String unit = PatchedUnitFormat.toString(axis.getUnit());
-            if (unit != null && !unit.isEmpty()) {
+            final String unit = axis.getUnit().toString();
+            if (!unit.isEmpty()) {
                 name = name + " (" + unit + ')';
             }
             printQuotedText(name, ordinateWidth, X364.FOREGROUND_CYAN);

Modified: sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/ReferencingFunctions.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -40,7 +40,6 @@ import org.apache.sis.util.Classes;
 import org.apache.sis.util.Locales;
 import org.apache.sis.util.collection.Cache;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.storage.CodeType;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.DataStores;
@@ -232,7 +231,7 @@ public class ReferencingFunctions extend
                             return Errors.getResources(getJavaLocale()).getString(Errors.Keys.IndexOutOfBounds_1, dimension);
                         }
                     }
-                    final String unit = PatchedUnitFormat.toString(axis.getUnit());
+                    final String unit = axis.getUnit().toString();
                     name = Transliterator.DEFAULT.toShortAxisName(cs, axis.getDirection(), axis.getName().getCode());
                     if (unit != null && !unit.isEmpty()) {
                         name = name + " (" + unit + ')';

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -24,7 +24,6 @@ import org.opengis.annotation.UML;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.iso.Types;
@@ -41,7 +40,7 @@ import static org.apache.sis.util.CharSe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class AxisDirections extends Static {
@@ -188,8 +187,8 @@ public final class AxisDirections extend
      *   <tr align="center"><td>{@code OTHER}</td><td>{@code OTHER}</td></tr>
      * </table>
      *
-     * @param  dir The direction for which to return the absolute direction, or {@code null}.
-     * @return The direction from the above table, or {@code null} if the given direction was null.
+     * @param  dir  the direction for which to return the absolute direction, or {@code null}.
+     * @return the direction from the above table, or {@code null} if the given direction was null.
      */
     public static AxisDirection absolute(AxisDirection dir) {
         final AxisDirection opposite = opposite(dir);
@@ -212,8 +211,8 @@ public final class AxisDirections extend
      * The same applies to {@code EAST}-{@code WEST}, {@code UP}-{@code DOWN} and {@code FUTURE}-{@code PAST},
      * <i>etc.</i> If the given axis direction has no opposite, then this method returns {@code null}.
      *
-     * @param  dir The direction for which to return the opposite direction, or {@code null}.
-     * @return The opposite direction, or {@code null} if none or unknown.
+     * @param  dir  the direction for which to return the opposite direction, or {@code null}.
+     * @return the opposite direction, or {@code null} if none or unknown.
      */
     public static AxisDirection opposite(AxisDirection dir) {
         return OPPOSITES.get(dir);
@@ -224,7 +223,7 @@ public final class AxisDirections extend
      * If the given argument is {@code null} or is not a known direction, then
      * this method conservatively returns {@code false}.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is an "opposite".
      */
     public static boolean isOpposite(final AxisDirection dir) {
@@ -236,7 +235,7 @@ public final class AxisDirections extend
      * Returns {@code true} if the specified direction is a compass direction.
      * Compass directions are {@code NORTH}, {@code EAST}, {@code NORTH_EAST}, etc.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is a compass direction.
      *
      * @see #angleForCompass(AxisDirection, AxisDirection)
@@ -251,7 +250,7 @@ public final class AxisDirections extend
      * Returns {@code true} if the specified direction is an inter-cardinal direction.
      * Inter-cardinal directions are {@code NORTH_EAST}, {@code SOUTH_SOUTH_EAST}, etc.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is an inter-cardinal direction.
      */
     public static boolean isIntercardinal(final AxisDirection dir) {
@@ -263,7 +262,7 @@ public final class AxisDirections extend
     /**
      * Returns {@code true} if the given direction is {@code UP} or {@code DOWN}.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the direction is vertical, or {@code false} otherwise.
      */
     public static boolean isVertical(final AxisDirection dir) {
@@ -275,7 +274,7 @@ public final class AxisDirections extend
      * Returns {@code true} if the given direction is {@code GEOCENTRIC_X}, {@code GEOCENTRIC_Y}
      * or {@code GEOCENTRIC_Z}.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is one of geocentric directions.
      */
     public static boolean isGeocentric(final AxisDirection dir) {
@@ -295,8 +294,8 @@ public final class AxisDirections extend
      *
      * <p>The rules implemented by this method may change in any future SIS version.</p>
      *
-     * @param  dir The direction to test, or {@code null}.
-     * @param  image {@code true} for accepting grid and image axis directions in addition to spatial ones.
+     * @param  dir    the direction to test, or {@code null}.
+     * @param  image  {@code true} for accepting grid and image axis directions in addition to spatial ones.
      * @return {@code true} if the given direction is presumed for spatial CS.
      */
     public static boolean isSpatialOrUserDefined(final AxisDirection dir, final boolean image) {
@@ -308,7 +307,7 @@ public final class AxisDirections extend
     /**
      * Returns {@code true} if the given direction is a user-defined direction (i.e. is not defined by GeoAPI).
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is user-defined.
      */
     public static boolean isUserDefined(final AxisDirection dir) {
@@ -319,7 +318,7 @@ public final class AxisDirections extend
      * Returns {@code true} if the given direction is {@code COLUMN_POSITIVE}, {@code COLUMN_NEGATICE},
      * {@code ROW_POSITIVE} or {@code ROW_NEGATIVE}.
      *
-     * @param  dir The direction to test, or {@code null}.
+     * @param  dir  the direction to test, or {@code null}.
      * @return {@code true} if the given direction is presumed for grid CS.
      */
     public static boolean isGrid(final AxisDirection dir) {
@@ -331,9 +330,9 @@ public final class AxisDirections extend
     /**
      * Angle between geocentric directions only.
      *
-     * @param  source The start direction.
-     * @param  target The final direction.
-     * @return The angle as a multiple of 90°, or {@link Integer#MIN_VALUE} if none.
+     * @param  source  the start direction.
+     * @param  target  the final direction.
+     * @return the angle as a multiple of 90°, or {@link Integer#MIN_VALUE} if none.
      */
     public static int angleForGeocentric(final AxisDirection source, final AxisDirection target) {
         final int base = GEOCENTRIC_X.ordinal();
@@ -352,9 +351,9 @@ public final class AxisDirections extend
     /**
      * Angle between compass directions only (not for angle between direction along meridians).
      *
-     * @param  source The start direction.
-     * @param  target The final direction.
-     * @return The arithmetic angle as a multiple of 360/{@link #COMPASS_COUNT}, or {@link Integer#MIN_VALUE} if none.
+     * @param  source  the start direction.
+     * @param  target  the final direction.
+     * @return the arithmetic angle as a multiple of 360/{@link #COMPASS_COUNT}, or {@link Integer#MIN_VALUE} if none.
      *
      * @see #isCompass(AxisDirection)
      */
@@ -379,9 +378,9 @@ public final class AxisDirections extend
     /**
      * Angle between display directions only.
      *
-     * @param  source The start direction.
-     * @param  target The final direction.
-     * @return The arithmetic angle as a multiple of 360/{@link #DISPLAY_COUNT}, or {@link Integer#MIN_VALUE} if none.
+     * @param  source  the start direction.
+     * @param  target  the final direction.
+     * @return the arithmetic angle as a multiple of 360/{@link #DISPLAY_COUNT}, or {@link Integer#MIN_VALUE} if none.
      */
     public static int angleForDisplay(final AxisDirection source, final AxisDirection target) {
         final int base = DISPLAY_RIGHT.ordinal();
@@ -415,9 +414,9 @@ public final class AxisDirections extend
      * Returns the angular unit of the specified coordinate system.
      * The preference will be given to the longitude axis, if found.
      *
-     * @param  cs The coordinate system from which to get the angular unit, or {@code null}.
-     * @param  unit The default unit to return if no angular unit is found.
-     * @return The angular unit, of {@code unit} if no angular unit was found.
+     * @param  cs    the coordinate system from which to get the angular unit, or {@code null}.
+     * @param  unit  the default unit to return if no angular unit is found.
+     * @return the angular unit, of {@code unit} if no angular unit was found.
      *
      * @since 0.6
      *
@@ -447,9 +446,9 @@ public final class AxisDirections extend
      * If both the given direction and its opposite exist, then the dimension for the given
      * direction has precedence over the opposite direction.
      *
-     * @param  cs The coordinate system to inspect, or {@code null}.
-     * @param  direction The direction of the axis to search.
-     * @return The dimension of the axis using the given direction or its opposite, or -1 if none.
+     * @param  cs         the coordinate system to inspect, or {@code null}.
+     * @param  direction  the direction of the axis to search.
+     * @return the dimension of the axis using the given direction or its opposite, or -1 if none.
      */
     public static int indexOfColinear(final CoordinateSystem cs, final AxisDirection direction) {
         int fallback = -1;
@@ -472,9 +471,9 @@ public final class AxisDirections extend
      * Returns the index of the first dimension in {@code cs} where axes are colinear with the {@code subCS} axes.
      * If no such dimension is found, returns -1.
      *
-     * @param  cs    The coordinate system which contains all axes.
-     * @param  subCS The coordinate system to search into {@code cs}.
-     * @return The first dimension of a sequence of axes colinear with {@code subCS} axes, or {@code -1} if none.
+     * @param  cs     the coordinate system which contains all axes.
+     * @param  subCS  the coordinate system to search into {@code cs}.
+     * @return the first dimension of a sequence of axes colinear with {@code subCS} axes, or {@code -1} if none.
      *
      * @since 0.5
      */
@@ -508,9 +507,9 @@ public final class AxisDirections extend
      *       then it will be considered equivalent to {@code "WEST"}.</li>
      * </ul>
      *
-     * @param  name The name of the axis direction to search.
-     * @param  directions The list of axis directions in which to search.
-     * @return The first axis direction having a name matching the given one, or {@code null} if none.
+     * @param  name        the name of the axis direction to search.
+     * @param  directions  the list of axis directions in which to search.
+     * @return the first axis direction having a name matching the given one, or {@code null} if none.
      */
     public static AxisDirection find(final String name, final AxisDirection[] directions) {
         for (final AxisDirection candidate : directions) {
@@ -533,8 +532,8 @@ public final class AxisDirections extend
      * The later is a parser which may create new directions, while this method searches only in a set
      * of predefined directions and never create new ones.</p>
      *
-     * @param  name The name of the axis direction to search.
-     * @return The first axis direction having a name matching the given one, or {@code null} if none.
+     * @param  name  the name of the axis direction to search.
+     * @return the first axis direction having a name matching the given one, or {@code null} if none.
      */
     public static AxisDirection valueOf(String name) {
         name = trimWhitespaces(name.replace('_', ' '));
@@ -615,10 +614,10 @@ public final class AxisDirections extend
      * for resolving some ambiguities like whether {@link AxisDirection#EAST} is for "x" (Easting)
      * or "λ" (Longitude).
      *
-     * @param name      The axis name for which to suggest an abbreviation.
-     * @param direction The axis direction for which to suggest an abbreviation.
-     * @param unit      The axis unit of measurement, for disambiguation.
-     * @return A suggested abbreviation.
+     * @param  name       the axis name for which to suggest an abbreviation.
+     * @param  direction  the axis direction for which to suggest an abbreviation.
+     * @param  unit       the axis unit of measurement, for disambiguation.
+     * @return a suggested abbreviation.
      *
      * @since 0.6
      */
@@ -686,9 +685,9 @@ public final class AxisDirections extend
      *   <li>Compound CS: East (km), North (km), Up (m).</li>
      * </ul>
      *
-     * @param  buffer A buffer pre-filled with the name header.
-     * @param  axes The axes to append in the given buffer.
-     * @return A name for the given coordinate system type and axes.
+     * @param  buffer  a buffer pre-filled with the name header.
+     * @param  axes    the axes to append in the given buffer.
+     * @return a name for the given coordinate system type and axes.
      *
      * @since 0.6
      */
@@ -697,9 +696,12 @@ public final class AxisDirections extend
         for (final CoordinateSystemAxis axis : axes) {
             buffer.append(separator).append(Types.getCodeLabel(axis.getDirection()));
             separator = ", ";
-            final String symbol = PatchedUnitFormat.toString(axis.getUnit());
-            if (symbol != null && !symbol.isEmpty()) {
-                buffer.append(" (").append(symbol).append(')');
+            final Unit<?> unit = axis.getUnit();
+            if (unit != null) {
+                final String symbol = unit.toString();
+                if (symbol != null && !symbol.isEmpty()) {
+                    buffer.append(" (").append(symbol).append(')');
+                }
             }
         }
         return buffer.append('.').toString();

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -46,8 +46,8 @@ public final class MetadataUtilities ext
      * Returns the milliseconds value of the given date, or {@link Long#MIN_VALUE}
      * if the date us null.
      *
-     * @param  value The date, or {@code null}.
-     * @return The time in milliseconds, or {@code Long.MIN_VALUE} if none.
+     * @param  value  the date, or {@code null}.
+     * @return the time in milliseconds, or {@code Long.MIN_VALUE} if none.
      */
     public static long toMilliseconds(final Date value) {
         return (value != null) ? value.getTime() : Long.MIN_VALUE;
@@ -57,8 +57,8 @@ public final class MetadataUtilities ext
      * Returns the given milliseconds time to a date object, or returns null
      * if the given time is {@link Long#MIN_VALUE}.
      *
-     * @param  value The time in milliseconds.
-     * @return The date for the given milliseconds value, or {@code null}.
+     * @param  value  the time in milliseconds.
+     * @return the date for the given milliseconds value, or {@code null}.
      */
     public static Date toDate(final long value) {
         return (value != Long.MIN_VALUE) ? new Date(value) : null;
@@ -69,10 +69,10 @@ public final class MetadataUtilities ext
      * then this method logs a warning if we are in process of (un)marshalling a XML document or throw an exception
      * otherwise.
      *
-     * @param  classe   The class which invoke this method.
-     * @param  property The property name. Method name will be inferred by the usual Java bean convention.
-     * @param  strict   {@code true} if the value was expected to be strictly positive, or {@code false} if 0 is accepted.
-     * @param  newValue The argument value to verify.
+     * @param  classe    the class which invoke this method.
+     * @param  property  the property name. Method name will be inferred by the usual Java bean convention.
+     * @param  strict    {@code true} if the value was expected to be strictly positive, or {@code false} if 0 is accepted.
+     * @param  newValue  the argument value to verify.
      * @return {@code true} if the value is valid.
      * @throws IllegalArgumentException if the given value is negative and the problem has not been logged.
      */
@@ -81,7 +81,7 @@ public final class MetadataUtilities ext
     {
         if (newValue != null) {
             final double value = newValue.doubleValue();
-            if (!(strict ? value > 0 : value >= 0)) {   // Use '!' for catching NaN.
+            if (!(strict ? value > 0 : value >= 0)) {                               // Use '!' for catching NaN.
                 if (NilReason.forObject(newValue) == null) {
                     final String msg = logOrFormat(classe, property, strict
                             ? Errors.Keys.ValueNotGreaterThanZero_2
@@ -101,11 +101,11 @@ public final class MetadataUtilities ext
      * If the user argument is outside the expected range of values, then this method logs a warning
      * if we are in process of (un)marshalling a XML document or throw an exception otherwise.
      *
-     * @param  classe   The class which invoke this method.
-     * @param  property Name of the property to check.
-     * @param  minimum  The minimal legal value.
-     * @param  maximum  The maximal legal value.
-     * @param  newValue The value given by the user.
+     * @param  classe    the class which invoke this method.
+     * @param  property  name of the property to check.
+     * @param  minimum   the minimal legal value.
+     * @param  maximum   the maximal legal value.
+     * @param  newValue  the value given by the user.
      * @return {@code true} if the value is valid.
      * @throws IllegalArgumentException if the given value is out of range and the problem has not been logged.
      */
@@ -115,7 +115,7 @@ public final class MetadataUtilities ext
     {
         if (newValue != null) {
             final double value = newValue.doubleValue();
-            if (!(value >= minimum.doubleValue() && value <= maximum.doubleValue())) {  // Use '!' for catching NaN.
+            if (!(value >= minimum.doubleValue() && value <= maximum.doubleValue())) {      // Use '!' for catching NaN.
                 if (NilReason.forObject(newValue) == null) {
                     final String msg = logOrFormat(classe, property,
                             Errors.Keys.ValueOutOfRange_4, property, minimum, maximum, newValue);
@@ -133,10 +133,10 @@ public final class MetadataUtilities ext
      * Formats an error message and logs it if we are (un)marshalling a document, or return the message otherwise.
      * In the later case, it is caller's responsibility to use the message for throwing an exception.
      *
-     * @param  classe    The caller class, used only in case of warning message to log.
-     * @param  property  The property name. Method name will be inferred by the usual Java bean convention.
-     * @param  key       A {@code Errors.Keys} value.
-     * @param  arguments The argument to use for formatting the error message.
+     * @param  classe     the caller class, used only in case of warning message to log.
+     * @param  property   the property name. Method name will be inferred by the usual Java bean convention.
+     * @param  key        a {@code Errors.Keys} value.
+     * @param  arguments  the argument to use for formatting the error message.
      * @return {@code null} if the message has been logged, or the message to put in an exception otherwise.
      */
     private static String logOrFormat(final Class<?> classe, final String property, final short key, final Object... arguments) {
@@ -164,9 +164,9 @@ public final class MetadataUtilities ext
      *       warning or error messages in future SIS versions.</li>
      * </ul>
      *
-     * @param  classe The caller class, used only in case of warning message to log.
-     * @param  method The caller method, used only in case of warning message to log.
-     * @param  name   The property name, used only in case of error message to format.
+     * @param  classe  the caller class, used only in case of warning message to log.
+     * @param  method  the caller method, used only in case of warning message to log.
+     * @param  name    the property name, used only in case of error message to format.
      * @throws IllegalStateException if {@code isDefined} is {@code true} and we are not unmarshalling an object.
      *
      * @since 0.7
@@ -186,8 +186,8 @@ public final class MetadataUtilities ext
      * Returns the {@code gco:id} or {@code gml:id} value to use for the given object.
      * The returned identifier will be unique in the current XML document.
      *
-     * @param  object The object for which to get the unique identifier.
-     * @return The unique XML identifier, or {@code null} if none.
+     * @param  object  the object for which to get the unique identifier.
+     * @return the unique XML identifier, or {@code null} if none.
      *
      * @since 0.7
      */
@@ -206,7 +206,7 @@ public final class MetadataUtilities ext
                     final int s = buffer.append('-').length();
                     int n = 0;
                     do {
-                        if (++n == 100) return null;    //  Arbitrary limit.
+                        if (++n == 100) return null;                        //  Arbitrary limit.
                         id = buffer.append(n).toString();
                         buffer.setLength(s);
                     } while (!Context.setObjectForID(context, object, id));
@@ -220,8 +220,8 @@ public final class MetadataUtilities ext
      * Invoked by {@code setID(String)} method implementations for assigning an identifier to an object
      * at unmarshalling time.
      *
-     * @param object The object for which to assign an identifier.
-     * @param id The {@code gco:id} or {@code gml:id} value.
+     * @param object  the object for which to assign an identifier.
+     * @param id      the {@code gco:id} or {@code gml:id} value.
      *
      * @since 0.7
      */

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -339,7 +339,7 @@ abstract class AbstractParser implements
             if (locale == Locale.ROOT) {
                 return Units.valueOf(text);             // Most common case.
             }
-            unitFormat = UnitFormat.getInstance(locale);
+            unitFormat = new UnitFormat(locale);
             unitFormat.setStyle(UnitFormat.Style.NAME);
         }
         return unitFormat.parse(text);

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -70,7 +70,6 @@ import org.apache.sis.util.resources.Voc
 import org.apache.sis.internal.util.X364;
 import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.simple.SimpleExtent;
 import org.apache.sis.internal.metadata.WKTKeywords;
@@ -344,7 +343,7 @@ public class Formatter implements Locali
         this.indentation   = (byte) indentation;
         this.numberFormat  = symbols.createNumberFormat();
         this.dateFormat    = new StandardDateFormat(symbols.getLocale());
-        this.unitFormat    = UnitFormat.getInstance(symbols.getLocale());
+        this.unitFormat    = new UnitFormat(symbols.getLocale());
         this.buffer        = new StringBuffer();
         unitFormat.setStyle(UnitFormat.Style.NAME);
         if (convention.usesCommonUnits) {
@@ -1254,13 +1253,17 @@ public class Formatter implements Locali
             closeQuote(fromIndex);
             resetColor();
             final double conversion = Units.toStandardUnit(unit);
-            appendExact(conversion);
+            if (Double.isNaN(conversion) && Units.isAngular(unit)) {
+                appendExact(Math.PI / 180);                 // Presume that we have sexagesimal degrees (see below).
+            } else {
+                appendExact(conversion);
+            }
             /*
-             * The EPSG code in UNIT elements is generally not recommended.
-             * But we make an exception for sexagesimal units (EPSG:9108, 9110 and 9111)
-             * because they can not be represented by a simple scale factor in WKT.
+             * The EPSG code in UNIT elements is generally not recommended. But we make an exception for sexagesimal
+             * units (EPSG:9108, 9110 and 9111) because they can not be represented by a simple scale factor in WKT.
+             * Those units are identified by a conversion factor set to NaN since the conversion is non-linear.
              */
-            if (convention == Convention.INTERNAL || PatchedUnitFormat.toFormattable(unit) != unit) {
+            if (convention == Convention.INTERNAL || Double.isNaN(conversion)) {
                 final Integer code = Units.getEpsgCode(unit, getEnclosingElement(1) instanceof CoordinateSystemAxis);
                 if (code != null) {
                     openElement(false, isWKT1 ? WKTKeywords.Authority : WKTKeywords.Id);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/WKTUtilities.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -16,6 +16,9 @@
  */
 package org.apache.sis.internal.referencing;
 
+import javax.measure.Unit;
+import javax.measure.Quantity;
+import javax.measure.quantity.Angle;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.GeneralParameterValue;
@@ -39,6 +42,7 @@ import org.apache.sis.parameter.DefaultP
 import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.measure.Units;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Vocabulary;
@@ -54,7 +58,7 @@ import org.apache.sis.util.resources.Voc
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class WKTUtilities extends Static {
@@ -67,8 +71,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given coordinate reference system as a formattable object.
      *
-     * @param  object The coordinate reference system, or {@code null}.
-     * @return The given coordinate reference system as a formattable object, or {@code null}.
+     * @param  object  the coordinate reference system, or {@code null}.
+     * @return the given coordinate reference system as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final CoordinateReferenceSystem object) {
         if (object instanceof FormattableObject) {
@@ -81,8 +85,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given coordinate system as a formattable object.
      *
-     * @param  object The coordinate system, or {@code null}.
-     * @return The given coordinate system as a formattable object, or {@code null}.
+     * @param  object  the coordinate system, or {@code null}.
+     * @return the given coordinate system as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final CoordinateSystem object) {
         if (object instanceof FormattableObject) {
@@ -95,8 +99,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given coordinate system axis as a formattable object.
      *
-     * @param  object The coordinate system axis, or {@code null}.
-     * @return The given coordinate system axis as a formattable object, or {@code null}.
+     * @param  object  the coordinate system axis, or {@code null}.
+     * @return the given coordinate system axis as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final CoordinateSystemAxis object) {
         if (object instanceof FormattableObject) {
@@ -109,8 +113,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given datum as a formattable object.
      *
-     * @param  object The datum, or {@code null}.
-     * @return The given datum as a formattable object, or {@code null}.
+     * @param  object  the datum, or {@code null}.
+     * @return the given datum as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final Datum object) {
         if (object instanceof FormattableObject) {
@@ -123,8 +127,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given geodetic datum as a formattable object.
      *
-     * @param  object The datum, or {@code null}.
-     * @return The given datum as a formattable object, or {@code null}.
+     * @param  object  the datum, or {@code null}.
+     * @return the given datum as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final GeodeticDatum object) {
         if (object instanceof FormattableObject) {
@@ -137,8 +141,8 @@ public final class WKTUtilities extends
     /**
      * Returns the ellipsoid as a formattable object.
      *
-     * @param  object The ellipsoid, or {@code null}.
-     * @return The given ellipsoid as a formattable object, or {@code null}.
+     * @param  object  the ellipsoid, or {@code null}.
+     * @return the given ellipsoid as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final Ellipsoid object) {
         if (object instanceof FormattableObject) {
@@ -151,8 +155,8 @@ public final class WKTUtilities extends
     /**
      * Returns the given prime meridian as a formattable object.
      *
-     * @param  object The prime meridian, or {@code null}.
-     * @return The given prime meridian as a formattable object, or {@code null}.
+     * @param  object  the prime meridian, or {@code null}.
+     * @return the given prime meridian as a formattable object, or {@code null}.
      */
     public static FormattableObject toFormattable(final PrimeMeridian object) {
         if (object instanceof FormattableObject) {
@@ -163,11 +167,31 @@ public final class WKTUtilities extends
     }
 
     /**
+     * If the given unit is one of the unit that can not be formatted without ambiguity in WKT format,
+     * return a proposed replacement. Otherwise returns {@code unit} unchanged.
+     *
+     * @param  <Q>   the unit dimension.
+     * @param  unit  the unit to test.
+     * @return the replacement to format, or {@code unit} if not needed.
+     *
+     * @since 0.8
+     */
+    @SuppressWarnings("unchecked")
+    public static <Q extends Quantity<Q>> Unit<Q> toFormattable(Unit<Q> unit) {
+        if (Units.isAngular(unit)) {
+            if (!((Unit<Angle>) unit).getConverterTo(Units.RADIAN).isLinear()) {
+                unit = (Unit<Q>) Units.DEGREE;
+            }
+        }
+        return unit;
+    }
+
+    /**
      * Appends the name of the given object to the formatter.
      *
-     * @param object    The object from which to get the name.
-     * @param formatter The formatter where to append the name.
-     * @param type      The key of colors to apply if syntax colors are enabled.
+     * @param  object     the object from which to get the name.
+     * @param  formatter  the formatter where to append the name.
+     * @param  type       the key of colors to apply if syntax colors are enabled.
      */
     public static void appendName(final IdentifiedObject object, final Formatter formatter, final ElementKind type) {
         String name = IdentifiedObjects.getName(object, formatter.getNameAuthority());
@@ -183,8 +207,8 @@ public final class WKTUtilities extends
     /**
      * Appends a {@linkplain ParameterValueGroup group of parameters} in a {@code Param_MT[…]} element.
      *
-     * @param parameters The parameter to append to the WKT, or {@code null} if none.
-     * @param formatter The formatter where to append the parameter.
+     * @param  parameters  the parameter to append to the WKT, or {@code null} if none.
+     * @param  formatter   the formatter where to append the parameter.
      */
     public static void appendParamMT(final ParameterValueGroup parameters, final Formatter formatter) {
         if (parameters != null) {
@@ -198,8 +222,8 @@ public final class WKTUtilities extends
      * If the supplied parameter is actually a {@linkplain ParameterValueGroup parameter group},
      * all contained parameters will be flattened in a single list.
      *
-     * @param parameter The parameter to append to the WKT, or {@code null} if none.
-     * @param formatter The formatter where to append the parameter.
+     * @param  parameter  the parameter to append to the WKT, or {@code null} if none.
+     * @param  formatter  the formatter where to append the parameter.
      */
     public static void append(GeneralParameterValue parameter, final Formatter formatter) {
         if (parameter instanceof ParameterValueGroup) {
@@ -228,9 +252,9 @@ public final class WKTUtilities extends
      * {@code affine}, {@code Cartesian}, {@code cylindrical}, {@code ellipsoidal}, {@code linear},
      * {@code parametric}, {@code polar}, {@code spherical}, {@code temporal} or {@code vertical}.
      *
-     * @param  base The abstract base interface.
-     * @param  type The interface or classes for which to get the WKT type.
-     * @return The WKT type for the given class or interface, or {@code null} if none.
+     * @param  base  the abstract base interface.
+     * @param  type  the interface or classes for which to get the WKT type.
+     * @return the WKT type for the given class or interface, or {@code null} if none.
      *
      * @see ReferencingUtilities#toPropertyName(Class, Class)
      */

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Sat Oct 22 15:48:56 2016
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.parameter;
 
+import java.util.Objects;
+import java.nio.file.Path;
 import java.io.Serializable;
 import java.io.File;
 import java.net.URL;
@@ -43,7 +45,6 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.Numbers;
@@ -57,10 +58,6 @@ import org.apache.sis.util.Unconvertible
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.Utilities.deepEquals;
 
-// Branch-dependent imports
-import java.util.Objects;
-import java.nio.file.Path;
-
 
 /**
  * A single parameter value used by an operation method. {@code ParameterValue} instances are elements in
@@ -117,7 +114,7 @@ import java.nio.file.Path;
  * Consequently, the above-cited methods provide single points that subclasses can override
  * for modifying the behavior of all getter and setter methods.
  *
- * @param <T> The type of the value stored in this parameter.
+ * @param  <T>  the type of the value stored in this parameter.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
@@ -172,7 +169,7 @@ public class DefaultParameterValue<T> ex
      * Creates a parameter value from the specified descriptor.
      * The value will be initialized to the default value, if any.
      *
-     * @param descriptor The abstract definition of this parameter.
+     * @param  descriptor  the abstract definition of this parameter.
      */
     public DefaultParameterValue(final ParameterDescriptor<T> descriptor) {
         ensureNonNull("descriptor", descriptor);
@@ -186,7 +183,7 @@ public class DefaultParameterValue<T> ex
      * This is a <em>shallow</em> copy constructor, since the value contained in the given
      * object is not cloned.
      *
-     * @param parameter The parameter to copy values from.
+     * @param  parameter  the parameter to copy values from.
      *
      * @see #clone()
      * @see #unmodifiable(ParameterValue)
@@ -201,7 +198,7 @@ public class DefaultParameterValue<T> ex
     /**
      * Returns the definition of this parameter.
      *
-     * @return The definition of this parameter.
+     * @return the definition of this parameter.
      */
     @Override
     @XmlElement(name = "operationParameter", required = true)
@@ -218,7 +215,7 @@ public class DefaultParameterValue<T> ex
      * All getter methods which need unit information will invoke this {@code getUnit()} method.
      * Subclasses can override this method if they need to compute the unit dynamically.
      *
-     * @return The unit of measure, or {@code null} if none.
+     * @return the unit of measure, or {@code null} if none.
      *
      * @see #doubleValue()
      * @see #doubleValueList()
@@ -238,7 +235,7 @@ public class DefaultParameterValue<T> ex
      * All getter methods will invoke this {@code getValue()} method.
      * Subclasses can override this method if they need to compute the value dynamically.
      *
-     * @return The parameter value as an object, or {@code null} if no value has been set
+     * @return the parameter value as an object, or {@code null} if no value has been set
      *         and there is no default value.
      *
      * @see #setValue(Object)
@@ -256,7 +253,7 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation invokes {@link #getValue()} and casts the result if possible,
      * or throws an exception otherwise.</p>
      *
-     * @return The boolean value represented by this parameter.
+     * @return the boolean value represented by this parameter.
      * @throws InvalidParameterTypeException if the value is not a boolean type.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -279,7 +276,7 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation invokes {@link #getValue()} and casts the result if possible,
      * or throws an exception otherwise.</p>
      *
-     * @return The numeric value represented by this parameter after conversion to type {@code int}.
+     * @return the numeric value represented by this parameter after conversion to type {@code int}.
      * @throws InvalidParameterTypeException if the value is not an integer type.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -306,7 +303,7 @@ public class DefaultParameterValue<T> ex
      * or throws an exception otherwise. If the value can be casted, then the array is cloned before
      * to be returned.</p>
      *
-     * @return A copy of the sequence of values represented by this parameter.
+     * @return a copy of the sequence of values represented by this parameter.
      * @throws InvalidParameterTypeException if the value is not an array of {@code int}s.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -330,7 +327,7 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation invokes {@link #getValue()} and casts the result if possible,
      * or throws an exception otherwise.</p>
      *
-     * @return The numeric value represented by this parameter after conversion to type {@code double}.
+     * @return the numeric value represented by this parameter after conversion to type {@code double}.
      *         This method returns {@link Double#NaN} only if such "value" has been explicitely set.
      * @throws InvalidParameterTypeException if the value is not a numeric type.
      * @throws IllegalStateException if the value is not defined and there is no default value.
@@ -357,7 +354,7 @@ public class DefaultParameterValue<T> ex
      * or throws an exception otherwise. If the value can be casted, then the array is cloned before
      * to be returned.</p>
      *
-     * @return A copy of the sequence of values represented by this parameter.
+     * @return a copy of the sequence of values represented by this parameter.
      * @throws InvalidParameterTypeException if the value is not an array of {@code double}s.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -401,8 +398,8 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation invokes {@link #doubleValue()} and {@link #getUnit()},
      * then converts the values to the given unit of measurement.</p>
      *
-     * @param  unit The unit of measure for the value to be returned.
-     * @return The numeric value represented by this parameter after conversion to type
+     * @param  unit  the unit of measure for the value to be returned.
+     * @return the numeric value represented by this parameter after conversion to type
      *         {@code double} and conversion to {@code unit}.
      * @throws IllegalArgumentException if the specified unit is invalid for this parameter.
      * @throws InvalidParameterTypeException if the value is not a numeric type.
@@ -426,7 +423,7 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation invokes {@link #doubleValueList()} and {@link #getUnit()},
      * then converts the values to the given unit of measurement.</p>
      *
-     * @param  unit The unit of measure for the value to be returned.
+     * @param  unit  the unit of measure for the value to be returned.
      * @return The sequence of values represented by this parameter after conversion to type
      *         {@code double} and conversion to {@code unit}.
      * @throws IllegalArgumentException if the specified unit is invalid for this parameter.
@@ -452,7 +449,7 @@ public class DefaultParameterValue<T> ex
      * Returns the string value of this parameter.
      * A string value does not have an associated unit of measure.
      *
-     * @return The string value represented by this parameter.
+     * @return the string value represented by this parameter.
      * @throws InvalidParameterTypeException if the value is not a string.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -474,7 +471,7 @@ public class DefaultParameterValue<T> ex
      * The default implementation can convert the following value types:
      * {@link URI}, {@link URL}, {@link Path}, {@link File}.
      *
-     * @return The reference to a file containing parameter values.
+     * @return the reference to a file containing parameter values.
      * @throws InvalidParameterTypeException if the value is not a reference to a file or an URI.
      * @throws IllegalStateException if the value is not defined and there is no default value.
      *
@@ -558,7 +555,7 @@ public class DefaultParameterValue<T> ex
      * This implementation does not clone the given value. In particular, references to {@code int[]}
      * and {@code double[]} arrays are stored <cite>as-is</cite>.</p>
      *
-     * @param  value The parameter value, or {@code null} to restore the default.
+     * @param  value  the parameter value, or {@code null} to restore the default.
      * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example the value is numeric and out of range).
      *
@@ -592,7 +589,7 @@ public class DefaultParameterValue<T> ex
      *
      * <p>The default implementation delegates to {@link #setValue(Object, Unit)}.</p>
      *
-     * @param  value The parameter value.
+     * @param  value  the parameter value.
      * @throws InvalidParameterValueException if the boolean type is inappropriate for this parameter.
      *
      * @see #booleanValue()
@@ -610,7 +607,7 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation wraps the given integer in an object of the type specified by the
      * {@linkplain #getDescriptor() descriptor}, then delegates to {@link #setValue(Object, Unit)}.</p>
      *
-     * @param  value The parameter value.
+     * @param  value  the parameter value.
      * @throws InvalidParameterValueException if the integer type is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example a value out of range).
      *
@@ -635,7 +632,7 @@ public class DefaultParameterValue<T> ex
     /**
      * Wraps the given value in a type compatible with the expected value class, if possible.
      *
-     * @throws IllegalArgumentException If the given value can not be converted to the given type.
+     * @throws IllegalArgumentException if the given value can not be converted to the given type.
      */
     @SuppressWarnings("unchecked")
     private static Number wrap(final double value, final Class<?> valueClass) throws IllegalArgumentException {
@@ -652,10 +649,9 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation wraps the given number in an object of the type specified by the
      * {@linkplain #getDescriptor() descriptor}, then delegates to {@link #setValue(Object, Unit)}.</p>
      *
-     * @param value The parameter value.
-     * @throws InvalidParameterValueException if the floating point type is inappropriate for this
-     *         parameter, or if the value is illegal for some other reason (for example a value out
-     *         of range).
+     * @param  value  the parameter value.
+     * @throws InvalidParameterValueException if the floating point type is inappropriate for this parameter,
+     *         or if the value is illegal for some other reason (for example a value out of range).
      *
      * @see #setValue(double,Unit)
      * @see #doubleValue()
@@ -677,8 +673,8 @@ public class DefaultParameterValue<T> ex
      * <p>The default implementation wraps the given number in an object of the type specified by the
      * {@linkplain #getDescriptor() descriptor}, then delegates to {@link #setValue(Object, Unit)}.</p>
      *
-     * @param  value The parameter value.
-     * @param  unit The unit for the specified value.
+     * @param  value  the parameter value.
+     * @param  unit   the unit for the specified value.
      * @throws InvalidParameterValueException if the floating point type is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example a value out of range).
      *
@@ -702,8 +698,8 @@ public class DefaultParameterValue<T> ex
      *
      * <p>The default implementation delegates to {@link #setValue(Object, Unit)}.</p>
      *
-     * @param  values The parameter values.
-     * @param  unit The unit for the specified value.
+     * @param  values  the parameter values.
+     * @param  unit    the unit for the specified value.
      * @throws InvalidParameterValueException if the floating point array type is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example a value out of range).
      */
@@ -725,8 +721,8 @@ public class DefaultParameterValue<T> ex
      * subclasses can override if they want to perform more processing on the value before its storage,
      * or to be notified about value changes.
      *
-     * @param  value The parameter value, or {@code null} to restore the default.
-     * @param  unit  The unit associated to the new parameter value, or {@code null}.
+     * @param  value  the parameter value, or {@code null} to restore the default.
+     * @param  unit   the unit associated to the new parameter value, or {@code null}.
      * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example the value is numeric and out of range).
      *
@@ -760,8 +756,8 @@ public class DefaultParameterValue<T> ex
      * {@linkplain DefaultParameterDescriptor#getValidValues() valid values} are performed
      * before this method is invoked. The default implementation of this method does nothing.
      *
-     * @param  value The value converted to the unit of measurement specified by the descriptor.
-     * @throws InvalidParameterValueException If the given value is invalid for implementation-specific reasons.
+     * @param  value  the value converted to the unit of measurement specified by the descriptor.
+     * @throws InvalidParameterValueException if the given value is invalid for implementation-specific reasons.
      */
     protected void validate(final T value) throws InvalidParameterValueException {
     }
@@ -770,8 +766,8 @@ public class DefaultParameterValue<T> ex
      * Compares the specified object with this parameter for equality.
      * The strictness level is controlled by the second argument.
      *
-     * @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 according the given comparison mode.
      */
     @Override
@@ -808,7 +804,7 @@ public class DefaultParameterValue<T> ex
      *
      * Subclasses shall override {@link #equals(Object, ComparisonMode)} instead than this method.
      *
-     * @param  object The object to compare to {@code this}.
+     * @param  object  the object to compare to {@code this}.
      * @return {@code true} if both objects are equal.
      */
     @Override
@@ -818,9 +814,9 @@ public class DefaultParameterValue<T> ex
 
     /**
      * Returns a hash value for this parameter.
+     * This value does not need to be the same in past or future versions of this class.
      *
-     * @return The hash code value. This value doesn't need to be the same
-     *         in past or future versions of this class.
+     * @return the hash code value.
      */
     @Override
     public int hashCode() {
@@ -842,7 +838,7 @@ public class DefaultParameterValue<T> ex
         try {
             return (DefaultParameterValue<T>) super.clone();
         } catch (CloneNotSupportedException exception) {
-            throw new AssertionError(exception); // Should not happen, since we are cloneable
+            throw new AssertionError(exception);                // Should not happen, since we are cloneable
         }
     }
 
@@ -871,9 +867,9 @@ public class DefaultParameterValue<T> ex
      * Transverse Mercator</cite> (UTM) projections use the same scale factor (0.9996) and false easting (500000 metres).
      * </div>
      *
-     * @param  <T> The type of the value stored in the given parameter.
-     * @param  parameter The parameter to make unmodifiable, or {@code null}.
-     * @return An unmodifiable implementation of the given parameter, or {@code null} if the given parameter was null.
+     * @param  <T>        the type of the value stored in the given parameter.
+     * @param  parameter  the parameter to make unmodifiable, or {@code null}.
+     * @return a unmodifiable implementation of the given parameter, or {@code null} if the given parameter was null.
      *
      * @since 0.6
      *
@@ -933,7 +929,7 @@ public class DefaultParameterValue<T> ex
      * }
      * </div>
      *
-     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @param  formatter  the formatter where to format the inner content of this WKT element.
      * @return {@code "Parameter"} or {@code "ParameterFile"}.
      *
      * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#119">WKT 2 specification §17.2.4</a>
@@ -974,7 +970,7 @@ public class DefaultParameterValue<T> ex
                 ignoreUnits = true;
             } else {
                 if (convention != Convention.INTERNAL) {
-                    unit = PatchedUnitFormat.toFormattable(unit);
+                    unit = WKTUtilities.toFormattable(unit);
                 }
                 ignoreUnits = unit.equals(contextualUnit);
             }
@@ -1092,7 +1088,7 @@ public class DefaultParameterValue<T> ex
         @XmlElement(name = "valueList",         type = MeasureList.class)
     })
     private Object getXmlValue() {
-        final Object value = getValue();    // Give to user a chance to override.
+        final Object value = getValue();                        // Give to user a chance to override.
         if (value != null) {
             if (value instanceof Number) {
                 final Number n = (Number) value;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Sat Oct 22 15:48:56 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;
@@ -38,9 +38,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 +70,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 +115,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 +162,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 +230,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 +276,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
@@ -324,13 +322,16 @@ 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));
+                double scale  = 1;
+                double offset = 0;
+                final Number[] coefficients = Units.coefficients(sourceUnit.getConverterToAny(targetUnit));
+                switch (coefficients != null ? coefficients.length : -1) {
+                    case 2:  scale  = coefficients[1].doubleValue();       // Fall through
+                    case 1:  offset = coefficients[0].doubleValue();       // 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);
             }
@@ -376,9 +377,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 +421,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)
@@ -451,9 +452,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/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java?rev=1766204&r1=1766203&r2=1766204&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java [UTF-8] Sat Oct 22 15:48:56 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.
      */



Mime
View raw message