sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1755610 [5/7] - in /sis/branches/JDK7: ./ core/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-feature/s...
Date Tue, 09 Aug 2016 14:48:05 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -97,7 +97,7 @@ public class TransformSeparator {
     /**
      * Constructs a separator for the given transform.
      *
-     * @param transform The transform to separate.
+     * @param transform  the transform to separate.
      */
     public TransformSeparator(final MathTransform transform) {
         this(transform, DefaultFactories.forBuildin(MathTransformFactory.class));
@@ -106,8 +106,8 @@ public class TransformSeparator {
     /**
      * Constructs a separator for the given transform and using the given factory.
      *
-     * @param transform The transform to separate.
-     * @param factory The factory to use for creating new math transforms.
+     * @param transform  the transform to separate.
+     * @param factory    the factory to use for creating new math transforms.
      */
     public TransformSeparator(final MathTransform transform, final MathTransformFactory factory) {
         ArgumentChecks.ensureNonNull("transform", transform);
@@ -136,8 +136,8 @@ public class TransformSeparator {
      * confusion as some users could expect the separated transform to use the dimensions in the order he specified
      * them).</div>
      *
-     * @param sequence   The {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
-     * @param dimension  The value to add to the given sequence.
+     * @param sequence   the {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
+     * @param dimension  the value to add to the given sequence.
      */
     private static int[] insert(int[] sequence, int dimension) throws IllegalArgumentException {
         if (sequence == null) {
@@ -158,9 +158,9 @@ public class TransformSeparator {
      * Adds the specified {@code dimensions} to the specified sequence.
      * Values must be given in strictly increasing order.
      *
-     * @param  sequence    The {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
-     * @param  dimensions  The user-supplied dimensions to add to the given sequence.
-     * @param  max         The maximal value allowed, exclusive.
+     * @param  sequence    the {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
+     * @param  dimensions  the user-supplied dimensions to add to the given sequence.
+     * @param  max         the maximal value allowed, exclusive.
      * @throws IllegalArgumentException if a {@code dimensions} value does not meet the conditions.
      */
     private static int[] add(int[] sequence, final int[] dimensions, final int max) throws IllegalArgumentException {
@@ -191,10 +191,10 @@ public class TransformSeparator {
     /**
      * Adds the specified range to the specified sequence.
      *
-     * @param  sequence  The {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
-     * @param  lower     The lower value of the range to add, inclusive.
-     * @param  upper     The upper value of the range to add, exclusive.
-     * @param  max       The maximal value allowed, exclusive.
+     * @param  sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to update.
+     * @param  lower     the lower value of the range to add, inclusive.
+     * @param  upper     the upper value of the range to add, exclusive.
+     * @param  max       the maximal value allowed, exclusive.
      * @throws IllegalArgumentException if the {@code lower} or {@code upper} value does not meet the conditions.
      */
     private static int[] add(int[] sequence, final int lower, final int upper, final int max) throws IllegalArgumentException {
@@ -246,7 +246,7 @@ public class TransformSeparator {
      *       of this method since construction or since the last call to {@link #clear()}.</li>
      * </ul>
      *
-     * @param  dimensions A sequence of source dimensions to keep, in strictly increasing order.
+     * @param  dimensions  a sequence of source dimensions to keep, in strictly increasing order.
      * @throws IllegalArgumentException if {@code dimensions} contains negative values
      *         or if values are not in a strictly increasing order.
      */
@@ -260,8 +260,8 @@ public class TransformSeparator {
      * The {@code lower} and {@code upper} values define a range of  <em>source</em> dimension indices
      * of the transform given to the constructor.
      *
-     * @param  lower The lower dimension, inclusive. Shall not be smaller than 0.
-     * @param  upper The upper dimension, exclusive. Shall be smaller than {@link MathTransform#getSourceDimensions()}.
+     * @param  lower  the lower dimension, inclusive. Shall not be smaller than 0.
+     * @param  upper  the upper dimension, exclusive. Shall be smaller than {@link MathTransform#getSourceDimensions()}.
      * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
      */
     public void addSourceDimensionRange(final int lower, final int upper) throws IllegalArgumentException {
@@ -284,7 +284,7 @@ public class TransformSeparator {
      *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
-     * @return The input dimension as a sequence of strictly increasing values.
+     * @return the input dimension as a sequence of strictly increasing values.
      * @throws IllegalStateException if input dimensions have not been set and
      *         {@link #separate()} has not yet been invoked.
      */
@@ -307,7 +307,7 @@ public class TransformSeparator {
      *       of this method since construction or since the last call to {@link #clear()}.</li>
      * </ul>
      *
-     * @param  dimensions A sequence of target dimensions to keep, in strictly increasing order.
+     * @param  dimensions  a sequence of target dimensions to keep, in strictly increasing order.
      * @throws IllegalArgumentException if {@code dimensions} contains negative values
      *         or if values are not in a strictly increasing order.
      */
@@ -321,8 +321,8 @@ public class TransformSeparator {
      * The {@code lower} and {@code upper} values define a range of <em>target</em> dimension indices
      * of the transform given to the constructor.
      *
-     * @param  lower The lower dimension, inclusive. Shall not be smaller than 0.
-     * @param  upper The upper dimension, exclusive. Shall be smaller than {@link MathTransform#getTargetDimensions()}.
+     * @param  lower  the lower dimension, inclusive. Shall not be smaller than 0.
+     * @param  upper  the upper dimension, exclusive. Shall be smaller than {@link MathTransform#getTargetDimensions()}.
      * @throws IllegalArgumentException if {@code lower} or {@code upper} are out of bounds.
      */
     public void addTargetDimensionRange(final int lower, final int upper) throws IllegalArgumentException {
@@ -345,7 +345,7 @@ public class TransformSeparator {
      *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
-     * @return The output dimension as a sequence of strictly increasing values.
+     * @return the output dimension as a sequence of strictly increasing values.
      * @throws IllegalStateException if output dimensions have not been set and
      *         {@link #separate()} has not yet been invoked.
      */
@@ -375,7 +375,7 @@ public class TransformSeparator {
      * The source and target dimensions actually used can be queried by calls to {@link #getSourceDimensions()}
      * or {@link #getTargetDimensions()} after this {@code separate()} method.
      *
-     * @return The separated math transform.
+     * @return the separated math transform.
      * @throws FactoryException if the transform can not be separated.
      */
     public MathTransform separate() throws FactoryException {
@@ -396,7 +396,7 @@ public class TransformSeparator {
              * Source dimensions are more difficult to process than target dimensions.
              */
             final int[] requested = targetDimensions;
-            tr = filterSourceDimensions(tr, sourceDimensions);  // May update targetDimensions.
+            tr = filterSourceDimensions(tr, sourceDimensions);            // May update targetDimensions.
             assert ArraysExt.isSorted(targetDimensions, true) : "targetDimensions";
             if (requested != null) {
                 final int[] inferred = targetDimensions;
@@ -456,9 +456,9 @@ public class TransformSeparator {
      *       {@code step.getTargetDimensions()} exclusive.</li>
      * </ul>
      *
-     * @param  step The transform for which to retain only a subset of the source dimensions.
-     * @param  dimensions Indices of the source dimensions of {@code step} to retain.
-     * @return A transform expecting only the given source dimensions.
+     * @param  step  the transform for which to retain only a subset of the source dimensions.
+     * @param  dimensions  indices of the source dimensions of {@code step} to retain.
+     * @return a transform expecting only the given source dimensions.
      * @throws FactoryException if the given transform is not separable.
      */
     @SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter")
@@ -613,9 +613,9 @@ reduce:     for (int j=0; j <= numTgt; j
      * transform may keep only the (<var>longitude</var>, <var>latitude</var>) part for the same inputs.
      * In most cases, the filtered transform is non-invertible since it loose informations.
      *
-     * @param  step The transform for which to retain only a subset of the target dimensions.
-     * @param  dimensions Indices of the target dimensions of {@code step} to retain.
-     * @return A transform producing only the given target dimensions.
+     * @param  step  the transform for which to retain only a subset of the target dimensions.
+     * @param  dimensions  indices of the target dimensions of {@code step} to retain.
+     * @return a transform producing only the given target dimensions.
      * @throws FactoryException if the given transform is not separable.
      */
     protected MathTransform filterTargetDimensions(MathTransform step, final int[] dimensions) throws FactoryException {
@@ -666,9 +666,9 @@ reduce:     for (int j=0; j <= numTgt; j
      * Returns {@code true} if the given sequence contains all index in the range {@code lower} inclusive
      * to {@code upper} exclusive.
      *
-     * @param  sequence The {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
-     * @param  lower    The lower value, inclusive.
-     * @param  upper    The upper value, exclusive.
+     * @param  sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
+     * @param  lower     the lower value, inclusive.
+     * @param  upper     the upper value, exclusive.
      * @return {@code true} if the full range was found in the sequence.
      */
     private static boolean containsAll(final int[] sequence, final int lower, int upper) {
@@ -691,9 +691,9 @@ reduce:     for (int j=0; j <= numTgt; j
     /**
      * Returns {@code true} if the given sequence contains any value in the given range.
      *
-     * @param  sequence The {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
-     * @param  lower    The lower value, inclusive.
-     * @param  upper    The upper value, exclusive.
+     * @param  sequence  the {@link #sourceDimensions} or {@link #targetDimensions} sequence to test.
+     * @param  lower     the lower value, inclusive.
+     * @param  upper     the upper value, exclusive.
      * @return {@code true} if the sequence contains at least one value in the given range.
      */
     private static boolean containsAny(final int[] sequence, final int lower, final int upper) {

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -247,7 +247,6 @@ public final strictfp class AlbersEqualA
 
         tolerance = Formulas.LINEAR_TOLERANCE;
         toleranceModifier = ToleranceModifier.PROJECTION;
-        derivativeDeltas = new double[] {100, 100};
         final double delta = toRadians(100.0 / 60) / 1852;      // Approximatively 100 metres.
         derivativeDeltas = new double[] {delta, delta};
         verifyInDomain(new double[] {-40, 10},                  // Minimal input ordinate values

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -167,7 +167,6 @@ public final strictfp class CylindricalE
 
         tolerance = Formulas.LINEAR_TOLERANCE;
         toleranceModifier = ToleranceModifier.PROJECTION;
-        derivativeDeltas = new double[] {100, 100};
         final double delta = toRadians(100.0 / 60) / 1852;      // Approximatively 100 metres.
         derivativeDeltas = new double[] {delta, delta};
         verifyInDomain(CoordinateDomain.GEOGRAPHIC_SAFE, 0);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -76,7 +76,7 @@ public final strictfp class CartesianToS
     public void testConsistency() throws FactoryException, TransformException {
         transform = CartesianToSpherical.INSTANCE.completeTransform(SphericalToCartesianTest.factory());
         derivativeDeltas = new double[] {1E-6, 1E-6, 1E-6};
-        tolerance = 1E-6;
+        tolerance = 2E-6;
         verifyInDomain(new double[] {-100, -100, -100},      // Minimal coordinates
                        new double[] {+100, +100, +100},      // Maximal coordinates
                        new int[]    {  10,   10,   10},

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -108,7 +108,7 @@ public class IdentifierMapAdapter extend
     /**
      * Creates a new map which will be a view over the given identifiers.
      *
-     * @param identifiers The identifiers to wrap in a map view.
+     * @param  identifiers  the identifiers to wrap in a map view.
      */
     public IdentifierMapAdapter(final Collection<Identifier> identifiers) {
         this.identifiers = identifiers;
@@ -118,8 +118,8 @@ public class IdentifierMapAdapter extend
      * If the given authority is a special case, returns its {@link NonMarshalledAuthority} integer enum.
      * Otherwise returns -1. See javadoc for more information about special cases.
      *
-     * @param authority A {@link Citation} constant. The type is relaxed to {@code Object}
-     *        because the signature of some {@code Map} methods are that way.
+     * @param  authority  a {@link Citation} constant. The type is relaxed to {@code Object}
+     *         because the signature of some {@code Map} methods are that way.
      */
     static int specialCase(final Object authority) {
         if (authority == IdentifierSpace.HREF) return NonMarshalledAuthority.HREF;
@@ -148,7 +148,7 @@ public class IdentifierMapAdapter extend
     /**
      * Returns the string representation of the given value, or {@code null} if none.
      *
-     * @param value The value returned be one of the above {@code getFoo()} methods.
+     * @param  value  the value returned be one of the above {@code getFoo()} methods.
      */
     private static String toString(final Object value) {
         return (value != null) ? value.toString() : null;
@@ -204,7 +204,7 @@ public class IdentifierMapAdapter extend
     /**
      * Returns {@code true} if at least one identifier declares the given {@linkplain Identifier#getCode() code}.
      *
-     * @param  code The code to search, which should be an instance of {@link String}.
+     * @param  code  the code to search, which should be an instance of {@link String}.
      * @return {@code true} if at least one identifier uses the given code.
      */
     @Override
@@ -225,7 +225,7 @@ public class IdentifierMapAdapter extend
      * Returns {@code true} if at least one identifier declares the given
      * {@linkplain Identifier#getAuthority() authority}.
      *
-     * @param  authority The authority to search, which should be an instance of {@link Citation}.
+     * @param  authority  the authority to search, which should be an instance of {@link Citation}.
      * @return {@code true} if at least one identifier uses the given authority.
      */
     @Override
@@ -276,8 +276,8 @@ public class IdentifierMapAdapter extend
      * Returns the code of the first identifier associated with the given
      * {@linkplain Identifier#getAuthority() authority}, or {@code null} if no identifier was found.
      *
-     * @param  authority The authority to search, which should be an instance of {@link Citation}.
-     * @return The code of the identifier for the given authority, or {@code null} if none.
+     * @param  authority  the authority to search, which should be an instance of {@link Citation}.
+     * @return the code of the identifier for the given authority, or {@code null} if none.
      */
     @Override
     public final String get(final Object authority) {
@@ -297,8 +297,8 @@ public class IdentifierMapAdapter extend
     /**
      * Removes all identifiers associated with the given {@linkplain Identifier#getAuthority() authority}.
      *
-     * @param  authority The authority to search, which should be an instance of {@link Citation}.
-     * @return The code of the identifier for the given authority, or {@code null} if none.
+     * @param  authority  the authority to search, which should be an instance of {@link Citation}.
+     * @return the code of the identifier for the given authority, or {@code null} if none.
      * @throws UnsupportedOperationException if the collection of identifiers is unmodifiable.
      */
     @Override
@@ -322,9 +322,9 @@ public class IdentifierMapAdapter extend
      * If more than one identifier is found for the given authority, then all previous identifiers may be removed
      * in order to ensure that the new entry will be the first entry, so it can be find by the {@code get} method.
      *
-     * @param  authority The authority for which to set the code.
-     * @param  code The new code for the given authority, or {@code null} for removing the entry.
-     * @return The previous code for the given authority, or {@code null} if none.
+     * @param  authority  the authority for which to set the code.
+     * @param  code  the new code for the given authority, or {@code null} for removing the entry.
+     * @return the previous code for the given authority, or {@code null} if none.
      * @throws UnsupportedOperationException if the collection of identifiers is unmodifiable.
      */
     @Override
@@ -348,7 +348,7 @@ public class IdentifierMapAdapter extend
      * If the backing collection contains many entries for the same authority, then only the first
      * occurrence is included.</p>
      *
-     * @return A view over the collection of identifiers.
+     * @return a view over the collection of identifiers.
      */
     @Override
     public Set<Entry<Citation,String>> entrySet() {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/Instant.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -38,7 +38,7 @@ public final class Instant {
     /**
      * Creates a new instant.
      *
-     * @param millis Number of milliseconds since January 1st, 1970 midnight UTC.
+     * @param  millis  number of milliseconds since January 1st, 1970 midnight UTC.
      */
     private Instant(final long millis) {
         this.millis = millis;
@@ -47,7 +47,7 @@ public final class Instant {
     /**
      * Parses the given text.
      *
-     * @param  text the text to parse.
+     * @param  text  the text to parse.
      * @return the instant.
      * @throws DateTimeException if the text can not be parsed.
      */
@@ -66,7 +66,7 @@ public final class Instant {
     /**
      * Creates a new instant for the given time in milliseconds.
      *
-     * @param  millis number of milliseconds since January 1st, 1970 midnight UTC.
+     * @param  millis  number of milliseconds since January 1st, 1970 midnight UTC.
      * @return the instant for the given time.
      */
     public static Instant ofEpochMilli(final long millis) {
@@ -76,7 +76,7 @@ public final class Instant {
     /**
      * Returns the number of milliseconds since January 1st, 1970 midnight UTC.
      *
-     * @return Number of milliseconds since January 1st, 1970 midnight UTC.
+     * @return number of milliseconds since January 1st, 1970 midnight UTC.
      */
     public long toEpochMilli() {
         return millis;
@@ -85,7 +85,7 @@ public final class Instant {
     /**
      * Not a JDK method - used as a replacement of {@code Date.from(Instant)}.
      *
-     * @return This instant as a legacy date object.
+     * @return this instant as a legacy date object.
      */
     public Date toDate() {
         return new Date(millis);

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -44,7 +44,7 @@ import java.nio.file.Path;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class JDK8 {
@@ -64,9 +64,9 @@ public final class JDK8 {
     /**
      * Compares two numbers as unsigned.
      *
-     * @param  x First unsigned value.
-     * @param  y Second unsigned value.
-     * @return Comparison result.
+     * @param  x  first unsigned value.
+     * @param  y  second unsigned value.
+     * @return comparison result.
      *
      * @since 0.7
      */
@@ -75,10 +75,37 @@ public final class JDK8 {
     }
 
     /**
+     * Returns the given value as an unsigned string.
+     * This implementation does not support values larger than {@link Long#MAX_VALUE}.
+     * This is only a placeholder; JDK8 provides a better implementation.
+     *
+     * @param  x  the value to format.
+     * @return a string representation of the given value.
+     *
+     * @since 0.8
+     */
+    public static String toUnsignedString(final long x) {
+        if (x >= 0) return Long.toString(x);
+        throw new ArithmeticException();
+    }
+
+    /**
+     * Returns the given integer as an unsigned long.
+     *
+     * @param  x  the integer to return as an unsigned long.
+     * @return the unsigned value of the given integer.
+     *
+     * @since 0.8
+     */
+    public static int toUnsignedLong(final int x) {
+        return x & 0xFFFFFFFF;
+    }
+
+    /**
      * Returns the given byte as an unsigned integer.
      *
-     * @param x The byte to return as an unsigned integer.
-     * @return The unsigned value of the given byte.
+     * @param  x  the byte to return as an unsigned integer.
+     * @return the unsigned value of the given byte.
      *
      * @since 0.7
      */
@@ -89,8 +116,8 @@ public final class JDK8 {
     /**
      * Returns the given short as an unsigned integer.
      *
-     * @param x The short to return as an unsigned integer.
-     * @return The unsigned value of the given short.
+     * @param  x  the short to return as an unsigned integer.
+     * @return the unsigned value of the given short.
      *
      * @since 0.7
      */
@@ -101,8 +128,8 @@ public final class JDK8 {
     /**
      * Safe cast of the given long to integer.
      *
-     * @param value The value to cast.
-     * @return The casted value.
+     * @param  value  the value to cast.
+     * @return the casted value.
      * @throws ArithmeticException if the value overflows.
      *
      * @since 0.7
@@ -116,11 +143,39 @@ public final class JDK8 {
     }
 
     /**
+     * Returns the sum of the given numbers.
+     * @param  x  first value to add.
+     * @param  y  second value to add.
+     * @return the result.
+     * @throws ArithmeticException if the result overflows.
+     *
+     * @since 0.8
+     */
+    public static long addExact(final long x, final long y) {
+        final long r = x + y;
+        if (((x ^ r) & (y ^ r)) >= 0) return r;
+        throw new ArithmeticException();
+    }
+
+    /**
+     * Returns the product of the arguments,
+     * @param  x  first value to multiply.
+     * @param  y  second value to multiply.
+     * @return the result.
+     * @throws ArithmeticException if the result overflows (Note: not implemented in this placeholder).
+     *
+     * @since 0.8
+     */
+    public static long multiplyExact(final long x, final long y) {
+        return x * y;   // Check for overflow not implemented in this placeholder.
+    }
+
+    /**
      * Safe product of the arguments.
      *
-     * @param x The first value.
-     * @param y The second value.
-     * @return The product.
+     * @param  x  the first value.
+     * @param  y  the second value.
+     * @return the product.
      * @throws ArithmeticException if the value overflows.
      *
      * @since 0.7
@@ -132,8 +187,8 @@ public final class JDK8 {
     /**
      * Returns the floating-point value adjacent to {@code value} in the direction of negative infinity.
      *
-     * @param  value The value for which to get the adjacent value.
-     * @return The adjacent value in the direction of negative infinity.
+     * @param  value  the value for which to get the adjacent value.
+     * @return the adjacent value in the direction of negative infinity.
      *
      * @since 0.4
      */
@@ -144,11 +199,11 @@ public final class JDK8 {
     /**
      * Returns the value of the given key, or the given default value if there is no value for that key.
      *
-     * @param <V> The type of values.
-     * @param map The map from which to get the value.
-     * @param key The key for the value to fetch.
-     * @param defaultValue The value to return if the map does not contain any value for the given key.
-     * @return The value for the given key (which may be {@code null}), or {@code defaultValue}.
+     * @param  <V>  the type of values.
+     * @param  map  the map from which to get the value.
+     * @param  key  the key for the value to fetch.
+     * @param  defaultValue the value to return if the map does not contain any value for the given key.
+     * @return the value for the given key (which may be {@code null}), or {@code defaultValue}.
      */
     public static <V> V getOrDefault(final Map<?,V> map, final Object key, final V defaultValue) {
         V value = map.get(key);
@@ -162,12 +217,12 @@ public final class JDK8 {
      * Stores the value in the given map, provided that no value were set.
      * This implementation presumes that the map can not contain null values.
      *
-     * @param  <K>   The type of keys.
-     * @param  <V>   The type of values.
-     * @param  map   The map where to store the value.
-     * @param  key   The key for the value to store.
-     * @param  value The value to store.
-     * @return The previous value, or {@code null} if none.
+     * @param  <K>    the type of keys.
+     * @param  <V>    the type of values.
+     * @param  map    the map where to store the value.
+     * @param  key    the key for the value to store.
+     * @param  value  the value to store.
+     * @return the previous value, or {@code null} if none.
      */
     public static <K,V> V putIfAbsent(final Map<K,V> map, final K key, final V value) {
         final V previous = map.put(key, value);
@@ -181,11 +236,11 @@ public final class JDK8 {
     /**
      * Removes the entry for the given key, provided that it is currently mapped to the given value.
      *
-     * @param  <K>   The type of keys.
-     * @param  <V>   The type of values.
-     * @param  map   The map from where to remove the value.
-     * @param  key   The key for the value to remove.
-     * @param  value The value that must exist for allowing removal.
+     * @param  <K>    the type of keys.
+     * @param  <V>    the type of values.
+     * @param  map    the map from where to remove the value.
+     * @param  key    the key for the value to remove.
+     * @param  value  the value that must exist for allowing removal.
      * @return {@code true} if the entry has been removed.
      *
      * @since 0.7
@@ -202,9 +257,9 @@ public final class JDK8 {
     /**
      * Removes all elements for which the given filter returns {@code true}.
      *
-     * @param  <E>        The type of elements in the given collection.
-     * @param  collection The collection from which to remove element.
-     * @param  filter     The condition for elements to remove.
+     * @param  <E>         the type of elements in the given collection.
+     * @param  collection  the collection from which to remove element.
+     * @param  filter      the condition for elements to remove.
      * @return {@code true} if at least one element has been removed.
      */
     public static <E> boolean removeIf(final Collection<E> collection, final Predicate<? super E> filter) {
@@ -221,13 +276,13 @@ public final class JDK8 {
     /**
      * Replaces the value for the given key if the current value is {@code oldValue}.
      *
-     * @param  <K>      The type of keys.
-     * @param  <V>      The type of values.
-     * @param  map      The map from where to replace the values.
-     * @param  key      The key of value to replace.
-     * @param  oldValue The expected current value.
-     * @param  newValue The new value to store if the current value is the expected one.
-     * @return Whether the replacement has been done.
+     * @param  <K>       the type of keys.
+     * @param  <V>       the type of values.
+     * @param  map       the map from where to replace the values.
+     * @param  key       the key of value to replace.
+     * @param  oldValue  the expected current value.
+     * @param  newValue  the new value to store if the current value is the expected one.
+     * @return whether the replacement has been done.
      *
      * @since 0.7
      */
@@ -243,10 +298,10 @@ public final class JDK8 {
     /**
      * Replaces the values for all entries in the given map.
      *
-     * @param  <K>      The type of keys.
-     * @param  <V>      The type of values.
-     * @param  map      The map from where to replace the values.
-     * @param  function The function performing the value replacements.
+     * @param  <K>       the type of keys.
+     * @param  <V>       the type of values.
+     * @param  map       the map from where to replace the values.
+     * @param  function  the function performing the value replacements.
      *
      * @since 0.7
      */
@@ -261,12 +316,12 @@ public final class JDK8 {
      * {@link ConcurrentMap#compute(java.lang.Object, java.util.function.BiFunction)}
      * on pre-JDK8 branches.
      *
-     * @param  <K> The type of keys.
-     * @param  <V> The type of values.
-     * @param  map The map where to store the value.
-     * @param  key The key for the value to compute and store.
-     * @param  remappingFunction The function for computing the value.
-     * @return The new value computed by the given function.
+     * @param  <K>  the type of keys.
+     * @param  <V>  the type of values.
+     * @param  map  the map where to store the value.
+     * @param  key  the key for the value to compute and store.
+     * @param  remappingFunction  the function for computing the value.
+     * @return the new value computed by the given function.
      *
      * @since 0.5
      */
@@ -296,13 +351,39 @@ public final class JDK8 {
     }
 
     /**
+     * Substitute for {@link Map#merge} on pre-JDK8 branches.
+     *
+     * @param  <K>    the type of keys.
+     * @param  <V>    the type of values.
+     * @param  map    the map where to store the value.
+     * @param  key    the key for the value to compute and store.
+     * @param  value  the value to store if none exists.
+     * @param  remappingFunction  the function for computing the value.
+     * @return the new value computed by the given function.
+     *
+     * @since 0.8
+     */
+    public static <K,V> V merge(final Map<K,V> map, final K key, final V value,
+            BiFunction<? super V, ? super V, ? extends V> remappingFunction)
+    {
+        final V oldValue = map.get(key);
+        final V newValue = (oldValue == null) ? value : remappingFunction.apply(oldValue, value);
+        if (newValue == null) {
+            map.remove(key);
+        } else {
+            map.put(key, newValue);
+        }
+        return newValue;
+    }
+
+    /**
      * Parses a date from a string in ISO 8601 format. More specifically, this method expects the
      * format defined by <cite>XML Schema Part 2: Datatypes for {@code xsd:dateTime}</cite>.
      *
      * <p>This method will be replaced by {@link java.time.format.DateTimeFormatter} on the JDK8 branch.</p>
      *
-     * @param  date The date to parse.
-     * @return The parsed date.
+     * @param  date  the date to parse.
+     * @return the parsed date.
      * @throws IllegalArgumentException if the given date can not be parsed.
      *
      * @see DatatypeConverter#parseDateTime(String)
@@ -317,8 +398,8 @@ public final class JDK8 {
      *
      * <p>This method will be replaced by {@link java.time.format.DateTimeFormatter} on the JDK8 branch.</p>
      *
-     * @param  date The date to format.
-     * @return The formatted date.
+     * @param  date  the date to format.
+     * @return the formatted date.
      *
      * @see DatatypeConverter#printDateTime(Calendar)
      */
@@ -336,8 +417,8 @@ public final class JDK8 {
     /**
      * Creates a buffered reader using UTF-8 encoding.
      *
-     * @param path The file to open.
-     * @return The reader.
+     * @param  path  the file to open.
+     * @return the reader.
      * @throws IOException if an error occurred while opening the reader.
      *
      * @since 0.7
@@ -349,8 +430,8 @@ public final class JDK8 {
     /**
      * Creates a buffered writer using UTF-8 encoding.
      *
-     * @param path The file to open.
-     * @return The writer.
+     * @param  path  the file to open.
+     * @return the writer.
      * @throws IOException if an error occurred while opening the writer.
      *
      * @since 0.7

Added: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java?rev=1755610&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java (added)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jdk8;
+
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
+
+
+/**
+ * Placeholder for the {@link java.time.LocalDate} class.
+ */
+public final class LocalDate {
+    /**
+     * The calendar to use for computing dates.
+     * Use of this calendar must be synchronized.
+     */
+    private static final GregorianCalendar CALENDAR = new GregorianCalendar(TimeZone.getTimeZone("UTC"), Locale.US);
+
+    /**
+     * Number of milliseconds since January 1st, 1970 midnight UTC.
+     */
+    private final long millis;
+
+    /**
+     * Creates a new date.
+     *
+     * @param millis Number of milliseconds since January 1st, 1970 midnight UTC.
+     */
+    private LocalDate(final long millis) {
+        this.millis = millis;
+    }
+
+    /**
+     * Creates a date.
+     *
+     * @param  year        the year.
+     * @param  month       the month-of-year from 1 to 12.
+     * @param  dayOfMonth  the day-of-month from 1 to 31
+     * @return the local date.
+     */
+    public static LocalDate of(int year, int month, int dayOfMonth) {
+        final long millis;
+        synchronized (CALENDAR) {
+            CALENDAR.clear();
+            CALENDAR.set(year, month - 1, dayOfMonth);
+            millis = CALENDAR.getTimeInMillis();
+        }
+        return new LocalDate(millis);
+    }
+
+    /**
+     * Returns the number of days elapsed since January 1st, 1970.
+     *
+     * @return number of days elapsed since January 1st, 1970.
+     */
+    public long toEpochDay() {
+        return millis / (24 * 60 * 60 * 1000L);
+    }
+}

Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LocalDate.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -36,7 +36,7 @@ import org.apache.sis.util.logging.Loggi
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public final class Loggers extends Static {
@@ -91,6 +91,12 @@ public final class Loggers extends Stati
     public static final String COORDINATE_OPERATION = "org.apache.sis.referencing.operation";
 
     /**
+     * The logger name for operation related to the {@code sis-referencing} modules that do not fit
+     * into the {@link #CRS_FACTORY} or {@link #COORDINATE_OPERATION} categories.
+     */
+    public static final String REFERENCING = "org.apache.sis.referencing";
+
+    /**
      * The logger name for operation related to localization.
      */
     public static final String LOCALIZATION = "org.apache.sis.util.resources";

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -26,7 +26,7 @@ import java.util.NoSuchElementException;
  * The {@link #hasNext()} method shall set the {@code #next} field to a non-null value if there is more elements to
  * return.
  *
- * @param <E> The type of elements to be returned by the iterator.
+ * @param <E> the type of elements to be returned by the iterator.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
@@ -49,7 +49,7 @@ public abstract class AbstractIterator<E
     /**
      * Returns the next element in this iteration.
      *
-     * @return The next element.
+     * @return the next element.
      */
     @Override
     public E next() {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -63,8 +63,8 @@ import java.util.Objects;
  *   <li>{@link #addValue(Object)} (non-standard, optional method)</li>
  * </ul>
  *
- * @param <K> The type of keys maintained by the map.
- * @param <V> The type of mapped values.
+ * @param <K> the type of keys maintained by the map.
+ * @param <V> the type of mapped values.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
@@ -82,8 +82,8 @@ public abstract class AbstractMap<K,V> i
      *       instead than creating new {@code Map.Element} on each iterator.</li>
      * </ul>
      *
-     * @param <K> The type of keys maintained by the map.
-     * @param <V> The type of mapped values.
+     * @param <K> the type of keys maintained by the map.
+     * @param <V> the type of mapped values.
      *
      * @see AbstractMap#entryIterator()
      */
@@ -99,7 +99,7 @@ public abstract class AbstractMap<K,V> i
          * Returns the key at the current iterator position.
          * This method is invoked only after {@link #next()}.
          *
-         * @return The key at the current iterator position.
+         * @return the key at the current iterator position.
          */
         protected abstract K getKey();
 
@@ -107,7 +107,7 @@ public abstract class AbstractMap<K,V> i
          * Returns the value at the current iterator position.
          * This method is invoked only after {@link #next()}.
          *
-         * @return The value at the current iterator position.
+         * @return the value at the current iterator position.
          */
         protected abstract V getValue();
 
@@ -116,7 +116,7 @@ public abstract class AbstractMap<K,V> i
          * This method is invoked only after {@link #next()}.
          * The default implementation creates an immutable entry with {@link #getKey()} and {@link #getValue()}.
          *
-         * @return The entry at the current iterator position.
+         * @return the entry at the current iterator position.
          */
         protected Entry<K,V> getEntry() {
             return new java.util.AbstractMap.SimpleImmutableEntry<>(getKey(), getValue());
@@ -139,8 +139,8 @@ public abstract class AbstractMap<K,V> i
      * (which is consistent with the default implementation of {@link AbstractMap} methods).
      * Modifiable maps should override {@code remove()} themselves.</p>
      *
-     * @param <K> The type of keys maintained by the map.
-     * @param <V> The type of mapped values.
+     * @param <K> the type of keys maintained by the map.
+     * @param <V> the type of mapped values.
      *
      * @see AbstractMap#entryIterator()
      */
@@ -165,7 +165,7 @@ public abstract class AbstractMap<K,V> i
         /**
          * Creates a new adapter initialized to the entry iterator of the given map.
          *
-         * @param map The map from which to return entries.
+         * @param map the map from which to return entries.
          */
         public IteratorAdapter(final Map<K,V> map) {
             it = map.entrySet().iterator();
@@ -246,7 +246,7 @@ public abstract class AbstractMap<K,V> i
      * Returns {@code true} if this map contains a value for the given name.
      * The default implementation assumes that the map can not contain {@code null} values.
      *
-     * @param  key The key for which to test the presence of a value.
+     * @param  key  the key for which to test the presence of a value.
      * @return {@code true} if the map contains a non-null value for the given key.
      */
     @Override
@@ -258,7 +258,7 @@ public abstract class AbstractMap<K,V> i
      * Returns {@code true} if this map contains the given value.
      * The default implementation iterates over all values using the {@link #entryIterator()}.
      *
-     * @param  value The value for which to test the presence.
+     * @param  value  the value for which to test the presence.
      * @return {@code true} if the map contains the given value.
      */
     @Override
@@ -295,8 +295,8 @@ public abstract class AbstractMap<K,V> i
      * Removes the entry for the given key in this map.
      * The default operation throws {@link UnsupportedOperationException}.
      *
-     * @param  key The key of the entry to remove.
-     * @return The previous value, or {@code null} if none.
+     * @param  key  the key of the entry to remove.
+     * @return the previous value, or {@code null} if none.
      */
     @Override
     public V remove(Object key) throws UnsupportedOperationException {
@@ -307,9 +307,9 @@ public abstract class AbstractMap<K,V> i
      * Adds an entry for the given key in this map.
      * The default operation throws {@link UnsupportedOperationException}.
      *
-     * @param  key The key of the entry to remove.
-     * @param  value The value to associate to the given key.
-     * @return The previous value, or {@code null} if none.
+     * @param  key    the key of the entry to remove.
+     * @param  value  the value to associate to the given key.
+     * @return the previous value, or {@code null} if none.
      */
     @Override
     public V put(K key, V value) throws UnsupportedOperationException {
@@ -319,7 +319,7 @@ public abstract class AbstractMap<K,V> i
     /**
      * Puts all entries of the given map in this map.
      *
-     * @param map The other map from which to copy the entries.
+     * @param map  the other map from which to copy the entries.
      */
     @Override
     public void putAll(final Map<? extends K, ? extends V> map) throws UnsupportedOperationException {
@@ -332,7 +332,7 @@ public abstract class AbstractMap<K,V> i
      * Adds the given key in this map. Implementation of this method shall generate a corresponding value.
      * The default operation throws {@link UnsupportedOperationException}.
      *
-     * @param  key The key to add.
+     * @param  key  the key to add.
      * @return {@code true} if this map changed as a result of this operation.
      */
     protected boolean addKey(final K key) throws UnsupportedOperationException {
@@ -343,7 +343,7 @@ public abstract class AbstractMap<K,V> i
      * Adds the given value in this map. Implementation of this method shall generate a corresponding key.
      * The default operation throws {@link UnsupportedOperationException}.
      *
-     * @param  value The value to add.
+     * @param  value  the value to add.
      * @return {@code true} if this map changed as a result of this operation.
      */
     protected boolean addValue(final V value) throws UnsupportedOperationException {
@@ -358,7 +358,7 @@ public abstract class AbstractMap<K,V> i
      * and usually not retained for a long time (we often want only its iterator). Caching the set would require
      * a {@code volatile} field for thread safety, which also has cost.</p>
      *
-     * @return A view of the keys in this map.
+     * @return a view of the keys in this map.
      */
     @Override
     public Set<K> keySet() {
@@ -406,7 +406,7 @@ public abstract class AbstractMap<K,V> i
      * <p>The default implementation does not cache the collection on the assumption that it is very quick to create
      * and usually not retained for a long time.</p>
      *
-     * @return A view of the values in this map.
+     * @return a view of the values in this map.
      */
     @Override
     public Collection<V> values() {
@@ -429,7 +429,7 @@ public abstract class AbstractMap<K,V> i
      * <p>The default implementation does not cache the set on the assumption that it is very quick to create
      * and usually not retained for a long time.</p>
      *
-     * @return A view of the entries in this map.
+     * @return a view of the entries in this map.
      */
     @Override
     public Set<Entry<K,V>> entrySet() {
@@ -485,7 +485,7 @@ public abstract class AbstractMap<K,V> i
      * Returns an iterator over the entries in this map.
      * It is okay (but not required) to return {@code null} if the map is empty.
      *
-     * @return An iterator over the entries in this map, or {@code null}.
+     * @return an iterator over the entries in this map, or {@code null}.
      */
     protected abstract EntryIterator<K,V> entryIterator();
 
@@ -580,7 +580,7 @@ public abstract class AbstractMap<K,V> i
     /**
      * Compares this map with the given object for equality.
      *
-     * @param  object The other object to compare with this map.
+     * @param  object  the other object to compare with this map.
      * @return {@code true} if both objects are equal.
      */
     @Override
@@ -614,7 +614,7 @@ public abstract class AbstractMap<K,V> i
     /**
      * Computes a hash code value for this map.
      *
-     * @return A hash code value.
+     * @return a hash code value.
      */
     @Override
     public int hashCode() {
@@ -631,7 +631,7 @@ public abstract class AbstractMap<K,V> i
      * {@code java.util.AbstractMap} one, as it uses a tabular format rather than formatting all entries
      * on a single line.
      *
-     * @return A string representation of this map.
+     * @return a string representation of this map.
      */
     @Override
     public String toString() {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -43,7 +43,7 @@ import java.util.Objects;
  *
  * <p>This class is not thread-safe. Synchronization, if desired, shall be done by the caller.</p>
  *
- * @param <E> The type of elements in the set.
+ * @param <E> the type of elements in the set.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.6
@@ -86,7 +86,7 @@ public class LazySet<E> extends SetOfUnk
      * only when first needed, and at most one iteration will be performed (unless {@link #reload()}
      * is invoked).
      *
-     * @param service  the type of service to request with {@link ServiceLoader}, or {@code null} if unknown.
+     * @param  service  the type of service to request with {@link ServiceLoader}, or {@code null} if unknown.
      */
     public LazySet(final Class<E> service) {
         Objects.requireNonNull(service);
@@ -97,7 +97,7 @@ public class LazySet<E> extends SetOfUnk
      * Constructs a set to be filled using the specified iterator.
      * Iteration with the given iterator will occur only when needed.
      *
-     * @param iterator The iterator to use for filling this set.
+     * @param  iterator  the iterator to use for filling this set.
      */
     public LazySet(final Iterator<? extends E> iterator) {
         Objects.requireNonNull(iterator);
@@ -123,7 +123,7 @@ public class LazySet<E> extends SetOfUnk
      * {@code LazySet} will not write in that array ({@code LazySet} will create a new array if
      * it needs to add more values).
      *
-     * @return Values to prepend before the source {@code Iterable}, or {@code null} if none.
+     * @return values to prepend before the source {@code Iterable}, or {@code null} if none.
      *
      * @since 0.7
      */
@@ -184,7 +184,7 @@ public class LazySet<E> extends SetOfUnk
      * Returns the number of elements in this set. Invoking this method
      * forces the set to immediately iterates through all remaining elements.
      *
-     * @return Number of elements in the iterator.
+     * @return number of elements in the iterator.
      */
     @Override
     public final int size() {
@@ -201,7 +201,7 @@ public class LazySet<E> extends SetOfUnk
      * Caches a new element. Subclasses can override this method is they want to substitute the given value
      * by another value.
      *
-     * @param element The element to add to the cache.
+     * @param  element  The element to add to the cache.
      */
     protected void cache(final E element) {
         if (numCached >= cachedElements.length) {
@@ -214,7 +214,7 @@ public class LazySet<E> extends SetOfUnk
      * Returns an unmodifiable view over the elements cached so far.
      * The returned list does not contain any elements that were not yet fetched from the source.
      *
-     * @return  the elements cached so far.
+     * @return the elements cached so far.
      */
     protected final List<E> cached() {
         return UnmodifiableArrayList.wrap(cachedElements, 0, numCached);
@@ -235,8 +235,8 @@ public class LazySet<E> extends SetOfUnk
     /**
      * Returns the element at the specified position in this set.
      *
-     * @param index The index at which to get an element.
-     * @return The element at the requested index.
+     * @param  index  the index at which to get an element.
+     * @return the element at the requested index.
      */
     final E get(final int index) {
         if (index >= numCached) {
@@ -253,7 +253,7 @@ public class LazySet<E> extends SetOfUnk
      * Returns an iterator over the elements contained in this set.
      * This is not the same iterator than the one given to the constructor.
      *
-     * @return An iterator over the elements in this set.
+     * @return an iterator over the elements in this set.
      */
     @Override
     public final Iterator<E> iterator() {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -34,7 +34,7 @@ import org.apache.sis.internal.jdk8.JDK8
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.8
  * @module
  */
 public final class Numerics extends Static {
@@ -136,9 +136,9 @@ public final class Numerics extends Stat
      * If the given value is presents in the cache, returns the cached value.
      * Otherwise returns the given value as-is.
      *
-     * @param  <T> The type of the given value.
-     * @param  value The given value for which to get a cached instance, if one exists.
-     * @return An object equals to the given value (may be the given instance itself).
+     * @param  <T>    the type of the given value.
+     * @param  value  the given value for which to get a cached instance, if one exists.
+     * @return an object equals to the given value (may be the given instance itself).
      */
     @SuppressWarnings("unchecked")
     public static <T> T cached(final T value) {
@@ -149,8 +149,8 @@ public final class Numerics extends Stat
     /**
      * Wraps the given {@code value} in a {@link Double} wrapper, using one of the cached instance if possible.
      *
-     * @param  value The value to get as a {@code Double}.
-     * @return The given value as a {@code Double}.
+     * @param  value  the value to get as a {@code Double}.
+     * @return the given value as a {@code Double}.
      */
     public static Double valueOf(final double value) {
         final Double boxed = value;
@@ -161,9 +161,9 @@ public final class Numerics extends Stat
     /**
      * Returns a copy of the given array where each value has been casted to the {@code float} type.
      *
-     * @param  data The array to copy, or {@code null}.
-     * @return A copy of the given array with values casted to the {@code float} type, or
-     *         {@code null} if the given array was null.
+     * @param  data  the array to copy, or {@code null}.
+     * @return a copy of the given array with values casted to the {@code float} type,
+     *         or {@code null} if the given array was null.
      */
     public static float[] copyAsFloats(final double[] data) {
         if (data == null) return null;
@@ -178,9 +178,9 @@ public final class Numerics extends Stat
      * Returns a copy of the given array where each value has been
      * {@linkplain Math#round(double) rounded} to the {@code int} type.
      *
-     * @param  data The array to copy, or {@code null}.
-     * @return A copy of the given array with values rounded to the {@code int} type, or
-     *         {@code null} if the given array was null.
+     * @param  data  the array to copy, or {@code null}.
+     * @return a copy of the given array with values rounded to the {@code int} type,
+     *         or {@code null} if the given array was null.
      */
     public static int[] copyAsInts(final double[] data) {
         if (data == null) return null;
@@ -195,8 +195,8 @@ public final class Numerics extends Stat
      * Returns {@code true} if the given floats are equals. Positive and negative zero are
      * considered different, while a NaN value is considered equal to all other NaN values.
      *
-     * @param  v1 The first value to compare.
-     * @param  v2 The second value to compare.
+     * @param  v1  the first value to compare.
+     * @param  v2  the second value to compare.
      * @return {@code true} if both values are equal.
      *
      * @see Float#equals(Object)
@@ -210,8 +210,8 @@ public final class Numerics extends Stat
      * Positive and negative zeros are considered different.
      * NaN values are considered equal to all other NaN values.
      *
-     * @param  v1 The first value to compare.
-     * @param  v2 The second value to compare.
+     * @param  v1  the first value to compare.
+     * @param  v2  the second value to compare.
      * @return {@code true} if both values are equal.
      *
      * @see Double#equals(Object)
@@ -224,8 +224,8 @@ public final class Numerics extends Stat
      * Returns {@code true} if the given doubles are equal, ignoring the sign of zero values.
      * NaN values are considered equal to all other NaN values.
      *
-     * @param  v1 The first value to compare.
-     * @param  v2 The second value to compare.
+     * @param  v1  the first value to compare.
+     * @param  v2  the second value to compare.
      * @return {@code true} if both values are equal.
      */
     public static boolean equalsIgnoreZeroSign(final double v1, final double v2) {
@@ -235,9 +235,9 @@ public final class Numerics extends Stat
     /**
      * Returns {@code true} if the given values are approximatively equal, up to the given comparison threshold.
      *
-     * @param  v1 The first value to compare.
-     * @param  v2 The second value to compare.
-     * @param  threshold The comparison threshold.
+     * @param  v1  the first value to compare.
+     * @param  v2  the second value to compare.
+     * @param  threshold  the comparison threshold.
      * @return {@code true} if both values are approximatively equal.
      */
     public static boolean epsilonEqual(final double v1, final double v2, final double threshold) {
@@ -252,9 +252,9 @@ public final class Numerics extends Stat
      * <p>This method does not thrown {@link AssertionError} in {@link ComparisonMode#DEBUG}.
      * It is caller responsibility to handle the {@code DEBUG} case.</p>
      *
-     * @param  v1   The first value to compare.
-     * @param  v2   The second value to compare.
-     * @param  mode The comparison mode to use for comparing the numbers.
+     * @param  v1    the first value to compare.
+     * @param  v2    the second value to compare.
+     * @param  mode  the comparison mode to use for comparing the numbers.
      * @return {@code true} if both values are considered equal for the given comparison mode.
      */
     public static boolean epsilonEqual(final double v1, final double v2, final ComparisonMode mode) {
@@ -271,10 +271,10 @@ public final class Numerics extends Stat
      * Creates a messages to put in {@link AssertionError} when two values differ in an unexpected way.
      * This is a helper method for debugging purpose only, typically used with {@code assert} statements.
      *
-     * @param name The name of the property which differ, or {@code null} if unknown.
-     * @param v1   The first value.
-     * @param v2   The second value.
-     * @return The message to put in {@code AssertionError}.
+     * @param  name  the name of the property which differ, or {@code null} if unknown.
+     * @param  v1    the first value.
+     * @param  v2    the second value.
+     * @return the message to put in {@code AssertionError}.
      *
      * @since 0.6
      */
@@ -295,14 +295,48 @@ public final class Numerics extends Stat
     /**
      * Returns a hash code value for the given long.
      *
-     * @param  c The value to hash.
-     * @return Hash code value for the given long.
+     * @param  c  the value to hash.
+     * @return hash code value for the given long.
      */
     public static int hashCode(final long c) {
         return ((int) c) ^ (int) (c >>> Integer.SIZE);
     }
 
     /**
+     * Converts an unsigned {@code long} to a {@code float} value.
+     *
+     * @param  value  the unsigned {@code long} value.
+     * @return the given unsigned {@code long} as a {@code float} value.
+     *
+     * @since 0.8
+     */
+    public static float toUnsignedFloat(final long value) {
+        if (value >= 0) {
+            return value;
+        } else {
+            // Following hack is inefficient, but should rarely be needed.
+            return Float.parseFloat(JDK8.toUnsignedString(value));
+        }
+    }
+
+    /**
+     * Converts an unsigned {@code long} to a {@code double} value.
+     *
+     * @param  value  the unsigned {@code long} value.
+     * @return the given unsigned {@code long} as a {@code double} value.
+     *
+     * @since 0.8
+     */
+    public static double toUnsignedDouble(final long value) {
+        if (value >= 0) {
+            return value;
+        } else {
+            // Following hack is inefficient, but should rarely be needed.
+            return Double.parseDouble(JDK8.toUnsignedString(value));
+        }
+    }
+
+    /**
      * Converts a power of 2 to a power of 10, rounded toward negative infinity.
      * This method is equivalent to the following code, but using only integer arithmetic:
      *
@@ -320,8 +354,8 @@ public final class Numerics extends Stat
      * which must be compensated by a smaller {@code exp2} value such as {@code toExp10(exp2) < n}. Note that if the
      * {@code getExponent(…)} argument is not a power of 10, then the result can be either <var>n</var> or <var>n</var>-1.
      *
-     * @param  exp2 The power of 2 to convert Must be in the [-2620 … 2620] range.
-     * @return The power of 10, rounded toward negative infinity.
+     * @param  exp2  the power of 2 to convert Must be in the [-2620 … 2620] range.
+     * @return the power of 10, rounded toward negative infinity.
      *
      * @see org.apache.sis.math.MathFunctions#LOG10_2
      * @see org.apache.sis.math.MathFunctions#getExponent(double)
@@ -353,8 +387,8 @@ public final class Numerics extends Stat
      *
      * For negative values, this method behaves as if the value was positive.
      *
-     * @param  value The value for which to get the significand.
-     * @return The significand of the given value.
+     * @param  value  the value for which to get the significand.
+     * @return the significand of the given value.
      */
     public static long getSignificand(final double value) {
         long bits = Double.doubleToRawLongBits(value);
@@ -383,8 +417,8 @@ public final class Numerics extends Stat
      *
      * For negative values, this method behaves as if the value was positive.
      *
-     * @param  value The value for which to get the significand.
-     * @return The significand of the given value.
+     * @param  value  the value for which to get the significand.
+     * @return the significand of the given value.
      */
     public static int getSignificand(final float value) {
         int bits = Float.floatToRawIntBits(value);

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java?rev=1755610&r1=1755609&r2=1755610&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java [UTF-8] Tue Aug  9 14:48:04 2016
@@ -28,11 +28,11 @@ import org.apache.sis.util.ArraysExt;
  * An alternative to {@code AbstractSet} for implementations having a costly {@link #size()} method.
  * This class overrides some methods in a way that avoid or reduce calls to {@link #size()}.
  *
- * @param <E> The type of elements in the set.
+ * @param <E> the type of elements in the set.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  * @module
  */
 public abstract class SetOfUnknownSize<E> extends AbstractSet<E> {
@@ -64,10 +64,29 @@ public abstract class SetOfUnknownSize<E
     }
 
     /**
+     * Returns the number of elements in this set. The default implementation counts the number of elements
+     * returned by the {@link #iterator() iterator}. Subclasses are encouraged to cache this value if they
+     * know that the underlying storage is immutable.
+     *
+     * @return the number of elements in this set.
+     */
+    @Override
+    public int size() {
+        int count = 0;
+        for (final Iterator<E> it=iterator(); it.hasNext();) {
+            it.next();
+            if (++count == Integer.MAX_VALUE) {
+                break;
+            }
+        }
+        return count;
+    }
+
+    /**
      * Removes elements of the given collection from this set.
      * This method avoids to invoke {@link #size()}.
      *
-     * @param c The collection containing elements to remove.
+     * @param  c  the collection containing elements to remove.
      * @return {@code true} if at least one element has been removed.
      */
     @Override
@@ -89,7 +108,7 @@ public abstract class SetOfUnknownSize<E
     /**
      * Returns the elements in an array.
      *
-     * @return An array containing all set elements.
+     * @return an array containing all set elements.
      */
     @Override
     public Object[] toArray() {
@@ -100,9 +119,9 @@ public abstract class SetOfUnknownSize<E
      * Returns the elements in the given array, or in a new array of the same type
      * if it was necessary to allocate more space.
      *
-     * @param <T> The type array elements.
-     * @param  array Where to store the elements.
-     * @return An array containing all set elements.
+     * @param  <T>    the type array elements.
+     * @param  array  where to store the elements.
+     * @return an array containing all set elements.
      */
     @Override
     @SuppressWarnings("SuspiciousToArrayCall")
@@ -124,7 +143,7 @@ public abstract class SetOfUnknownSize<E
                 array = Arrays.copyOf(array, Math.max(16, array.length) << 1);
                 trimToSize = true;
             }
-            array[i++] = (T) it.next();   // Will throw an ArrayStoreException if the type is incorrect.
+            array[i++] = (T) it.next();     // Will throw an ArrayStoreException if the type is incorrect.
         }
         if (trimToSize) {
             array = ArraysExt.resize(array, i);
@@ -139,7 +158,7 @@ public abstract class SetOfUnknownSize<E
      * This method avoids to invoke {@link #size()} on this instance (but it still call that method
      * on the other instance).
      *
-     * @param object The object to compare with this set.
+     * @param  object  the object to compare with this set.
      * @return {@code true} if the two set have the same content.
      */
     @Override



Mime
View raw message