sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1445515 - in /sis/branches/JDK7/sis-utility/src: main/java/org/apache/sis/measure/ main/java/org/apache/sis/util/collection/ test/java/org/apache/sis/measure/
Date Wed, 13 Feb 2013 09:24:05 GMT
Author: desruisseaux
Date: Wed Feb 13 09:24:05 2013
New Revision: 1445515

URL: http://svn.apache.org/r1445515
Log:
Minor javadoc updates.

Modified:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/BackingStoreException.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java Wed
Feb 13 09:24:05 2013
@@ -125,7 +125,7 @@ public class DateRange extends Range<Dat
 
     /**
      * Casts the given {@code Range} object to a {@code DateRange}. This method shall be
invoked
-     * only in context where we have verified that the range element class is compatible.
+     * only in context where we have verified that the range element type is compatible.
      * This verification is performed by {@link Range#ensureCompatible(Range)} method.
      */
     private static DateRange cast(final Range<?> range) {

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
Wed Feb 13 09:24:05 2013
@@ -155,7 +155,7 @@ public class MeasurementRange<T extends 
     /**
      * Constructs a range of {@link Number} objects.
      *
-     * @param type          The element class, usually one of {@link Byte}, {@link Short},
+     * @param type          The element type, usually one of {@link Byte}, {@link Short},
      *                      {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param minimum       The minimum value.
      * @param maximum       The maximum value.
@@ -169,7 +169,7 @@ public class MeasurementRange<T extends 
     /**
      * Constructs a range of {@link Number} objects.
      *
-     * @param type          The element class, usually one of {@link Byte}, {@link Short},
+     * @param type          The element type, usually one of {@link Byte}, {@link Short},
      *                      {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param minimum       The minimum value.
      * @param isMinIncluded Defines whether the minimum value is included in the Range.
@@ -190,10 +190,10 @@ public class MeasurementRange<T extends 
      * Constructs a range with the same values than the specified range,
      * casted to the specified type.
      *
-     * @param type The element class, usually one of {@link Byte}, {@link Short},
-     *             {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
+     * @param type  The element type, usually one of {@link Byte}, {@link Short},
+     *              {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param range The range to copy. The elements must be {@link Number} instances.
-     * @param units   The units of measurement, or {@code null} if unknown.
+     * @param units The units of measurement, or {@code null} if unknown.
      */
     private MeasurementRange(Class<T> type, Range<? extends Number> range, final
Unit<?> units) {
         super(type, range);
@@ -201,7 +201,7 @@ public class MeasurementRange<T extends 
     }
 
     /**
-     * Creates a new range using the same element class than this range.
+     * Creates a new range using the same element type than this range.
      */
     @Override
     MeasurementRange<T> create(final T minValue, final boolean isMinIncluded,

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java Wed
Feb 13 09:24:05 2013
@@ -298,7 +298,7 @@ public class NumberRange<T extends Numbe
         if (range instanceof NumberRange<?>) {
             return (NumberRange<N>) range;
         }
-        // The constructor will ensure that the range element class is a subclass of Number.
+        // The constructor will ensure that the range element type is a subclass of Number.
         return new NumberRange<>(range);
     }
 
@@ -315,7 +315,7 @@ public class NumberRange<T extends Numbe
     /**
      * Constructs an inclusive range of {@link Number} objects.
      *
-     * @param  type     The element class, usually one of {@link Byte}, {@link Short},
+     * @param  type     The element type, usually one of {@link Byte}, {@link Short},
      *                  {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param  minValue The minimum value, inclusive, or {@code null} if none.
      * @param  maxValue The maximum value, <strong>inclusive</strong>, or {@code
null} if none.
@@ -327,7 +327,7 @@ public class NumberRange<T extends Numbe
     /**
      * Constructs a range of {@link Number} objects.
      *
-     * @param type           The element class, usually one of {@link Byte}, {@link Short},
+     * @param type           The element type, usually one of {@link Byte}, {@link Short},
      *                       {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param minValue       The minimal value, or {@code null} if none.
      * @param isMinIncluded  {@code true} if the minimal value is inclusive, or {@code false}
if exclusive.
@@ -345,7 +345,7 @@ public class NumberRange<T extends Numbe
      * Constructs a range with the same values than the specified range,
      * casted to the specified type.
      *
-     * @param  type  The element class, usually one of {@link Byte}, {@link Short},
+     * @param  type  The element type, usually one of {@link Byte}, {@link Short},
      *               {@link Integer}, {@link Long}, {@link Float} or {@link Double}.
      * @param  range The range to copy. The elements must be {@link Number} instances.
      * @throws IllegalArgumentException If the given type is not one of the primitive
@@ -359,7 +359,7 @@ public class NumberRange<T extends Numbe
     }
 
     /**
-     * Creates a new range using the same element class than this range. This method will
+     * Creates a new range using the same element type than this range. This method will
      * be overridden by subclasses in order to create a range of a more specific type.
      */
     @Override

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java Wed Feb
13 09:24:05 2013
@@ -101,7 +101,7 @@ public class Range<T extends Comparable<
         isMinIncluded = range.isMinIncluded;
         maxValue      = range.maxValue;
         isMaxIncluded = range.isMaxIncluded;
-        ensureValidType();
+        validate();
     }
 
     /**
@@ -112,7 +112,12 @@ public class Range<T extends Comparable<
      * @param maxValue     The maximal value (inclusive), or {@code null} if none.
      */
     public Range(final Class<T> elementType, final T minValue, final T maxValue) {
-        this(elementType, minValue, true, maxValue, true);
+        this.elementType   = elementType;
+        this.minValue      = minValue;
+        this.isMinIncluded = (minValue != null);
+        this.maxValue      = maxValue;
+        this.isMaxIncluded = (maxValue != null);
+        validate();
     }
 
     /**
@@ -128,7 +133,6 @@ public class Range<T extends Comparable<
             final T minValue, final boolean isMinIncluded,
             final T maxValue, final boolean isMaxIncluded)
     {
-        ensureNonNull("elementType", elementType);
         /*
          * The 'isMin/Maxincluded' flags must be forced to 'false' if 'minValue' or 'maxValue'
          * are null. This is required for proper working of algorithms implemented in this
class.
@@ -138,13 +142,11 @@ public class Range<T extends Comparable<
         this.isMinIncluded = isMinIncluded && (minValue != null);
         this.maxValue      = maxValue;
         this.isMaxIncluded = isMaxIncluded && (maxValue != null);
-        ensureValidType();
-        if (minValue != null) ensureCompatibleType(minValue.getClass());
-        if (maxValue != null) ensureCompatibleType(maxValue.getClass());
+        validate();
     }
 
     /**
-     * Creates a new range using the same element class than this range. This method will
+     * Creates a new range using the same element type than this range. This method will
      * be overridden by subclasses in order to create a range of a more specific type.
      */
     Range<T> create(final T minValue, final boolean isMinIncluded,
@@ -170,7 +172,7 @@ public class Range<T extends Comparable<
     }
 
     /**
-     * Ensures that the given range uses the same element class than this range,
+     * Ensures that the given range uses the same element type than this range,
      * then return the casted argument value.
      *
      * @param range The range to test for compatibility.
@@ -205,6 +207,16 @@ public class Range<T extends Comparable<
     }
 
     /**
+     * Invoked by the constructors in order to ensure that the argument are of valid types.
+     */
+    private void validate() {
+        ensureNonNull("elementType", elementType);
+        ensureValidType();
+        if (minValue != null) ensureCompatibleType(minValue.getClass());
+        if (maxValue != null) ensureCompatibleType(maxValue.getClass());
+    }
+
+    /**
      * Returns the base type of elements in this range.
      * This is the type specified at construction time.
      */

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java Wed
Feb 13 09:24:05 2013
@@ -267,7 +267,7 @@ public class RangeFormat extends Format 
 
     /**
      * Creates a new format for parsing and formatting {@linkplain Range ranges} of
-     * the given element class using the given locale. The element class is typically
+     * the given element type using the given locale. The element type is typically
      * {@code Date.class} or some subclass of {@code Number.class}.
      *
      * @param  locale The locale for parsing and formatting range components.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/BackingStoreException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/BackingStoreException.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/BackingStoreException.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/BackingStoreException.java
Wed Feb 13 09:24:05 2013
@@ -41,6 +41,13 @@ import java.sql.SQLException;
  *     }
  * }
  *
+ * {@section Relationship with <code>java.io.UncheckedIOException</code>}
+ * JDK8 provides a {@link java.io.UncheckedIOException} which partially overlaps
+ * the purpose of this {@code BackingStoreException}. While Apache SIS still uses
+ * {@code BackingStoreException} as a general mechanism for any kind of checked
+ * exceptions, client code targeting JDK8 would be well advised to catch both kind
+ * of exceptions for robustness.
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.3)
  * @version 0.3

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java?rev=1445515&r1=1445514&r2=1445515&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
(original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
Wed Feb 13 09:24:05 2013
@@ -19,7 +19,6 @@ package org.apache.sis.measure;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
-import java.text.Format;
 import java.text.DateFormat;
 import java.text.FieldPosition;
 import java.text.ParsePosition;



Mime
View raw message