sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1446321 - in /sis/branches/JDK7/sis-utility/src: main/java/org/apache/sis/measure/ main/java/org/apache/sis/util/resources/ test/java/org/apache/sis/measure/
Date Thu, 14 Feb 2013 20:52:27 GMT
Author: desruisseaux
Date: Thu Feb 14 20:52:27 2013
New Revision: 1446321

URL: http://svn.apache.org/r1446321
Log:
Removed the convenience constructors for inclusive ranges. Instead, for the users
to specify explicitly if the bounds are inclusive or exclusive. Those convenience
constructors were extensively used in test suites, but a search in existing code
base (geotk) shows that they were very rarely used in real applications. Worst,
the were dangerous because the convention about whether the upper bound should
be inclusive or exclusive is arbitrary; the convention was "inclusive" while
many users expect the upper bound to be exclusive by default. So we are better
to force the users to be clear about their intend.

Modified:
    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/util/resources/Errors.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java

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=1446321&r1=1446320&r2=1446321&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 Thu Feb 14 20:52:27 2013
@@ -49,6 +49,9 @@ import java.util.Objects;
  * @since   0.3 (derived from geotk-2.4)
  * @version 0.3
  * @module
+ *
+ * @see RangeFormat
+ * @see org.apache.sis.util.collection.RangeSet
  */
 @Immutable
 public class MeasurementRange<E extends Number & Comparable<? super E>> extends NumberRange<E> {
@@ -65,20 +68,6 @@ public class MeasurementRange<E extends 
     private final Unit<?> unit;
 
     /**
-     * Constructs an inclusive range of {@code float} values.
-     *
-     * @param  minValue The minimal value, inclusive, or {@link Float#NEGATIVE_INFINITY} if none..
-     * @param  maxValue The maximal value, <strong>inclusive</strong>, or {@link Float#POSITIVE_INFINITY} if none.
-     * @param  unit     The unit of measurement, or {@code null} if unknown.
-     * @return The new range of numeric values for the given bounds and unit of measurement.
-     */
-    public static MeasurementRange<Float> create(float minValue, float maxValue, Unit<?> unit) {
-        return new MeasurementRange<>(Float.class,
-                valueOf("minValue", minValue, Float.NEGATIVE_INFINITY),
-                valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY), unit);
-    }
-
-    /**
      * Constructs a range of {@code float} values.
      *
      * @param  minValue       The minimal value, or {@link Float#NEGATIVE_INFINITY} if none.
@@ -97,20 +86,6 @@ public class MeasurementRange<E extends 
     }
 
     /**
-     * Constructs an inclusive range of {@code double} values.
-     *
-     * @param  minValue The minimal value, inclusive, or {@link Double#NEGATIVE_INFINITY} if none..
-     * @param  maxValue The maximal value, <strong>inclusive</strong>, or {@link Double#POSITIVE_INFINITY} if none.
-     * @param  unit     The unit of measurement, or {@code null} if unknown.
-     * @return The new range of numeric values for the given bounds and unit of measurement.
-     */
-    public static MeasurementRange<Double> create(double minValue, double maxValue, Unit<?> unit) {
-        return new MeasurementRange<>(Double.class,
-                valueOf("minValue", minValue, Double.NEGATIVE_INFINITY),
-                valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY), unit);
-    }
-
-    /**
      * Constructs a range of {@code double} values.
      *
      * @param  minValue       The minimal value, or {@link Double#NEGATIVE_INFINITY} if none.
@@ -168,19 +143,6 @@ public class MeasurementRange<E extends 
     /**
      * Constructs a range of {@link Number} objects.
      *
-     * @param type     The element type, usually one of {@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.
-     * @param unit     The unit of measurement, or {@code null} if unknown.
-     */
-    public MeasurementRange(final Class<E> type, final E minValue, final E maxValue, final Unit<?> unit) {
-        super(type, minValue, maxValue);
-        this.unit = unit;
-    }
-
-    /**
-     * Constructs a range of {@link Number} objects.
-     *
      * @param type          The element type, usually one of {@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.

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=1446321&r1=1446320&r2=1446321&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 Thu Feb 14 20:52:27 2013
@@ -60,6 +60,7 @@ import org.apache.sis.util.resources.Err
  * @module
  *
  * @see RangeFormat
+ * @see org.apache.sis.util.collection.RangeSet
  */
 @Immutable
 public class NumberRange<E extends Number & Comparable<? super E>> extends Range<E> {
@@ -69,17 +70,6 @@ public class NumberRange<E extends Numbe
     private static final long serialVersionUID = -818167965963008231L;
 
     /**
-     * Constructs an inclusive range of {@code byte} values.
-     *
-     * @param  minValue The minimal value, inclusive.
-     * @param  maxValue The maximal value, <strong>inclusive</strong>.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Byte> create(final byte minValue, final byte maxValue) {
-        return new NumberRange<>(Byte.class, Byte.valueOf(minValue), Byte.valueOf(maxValue));
-    }
-
-    /**
      * Constructs a range of {@code byte} values.
      *
      * @param  minValue       The minimal value.
@@ -97,17 +87,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@code short} values.
-     *
-     * @param  minValue The minimal value, inclusive.
-     * @param  maxValue The maximal value, <strong>inclusive</strong>.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Short> create(final short minValue, final short maxValue) {
-        return new NumberRange<>(Short.class, Short.valueOf(minValue), Short.valueOf(maxValue));
-    }
-
-    /**
      * Constructs a range of {@code short} values.
      *
      * @param  minValue       The minimal value.
@@ -125,17 +104,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@code int} values.
-     *
-     * @param  minValue The minimal value, inclusive.
-     * @param  maxValue The maximal value, <strong>inclusive</strong>.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Integer> create(final int minValue, final int maxValue) {
-        return new NumberRange<>(Integer.class, Integer.valueOf(minValue), Integer.valueOf(maxValue));
-    }
-
-    /**
      * Constructs a range of {@code int} values.
      *
      * @param  minValue       The minimal value.
@@ -153,17 +121,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@code long} values.
-     *
-     * @param  minValue The minimal value, inclusive.
-     * @param  maxValue The maximal value, <strong>inclusive</strong>.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Long> create(final long minValue, final long maxValue) {
-        return new NumberRange<>(Long.class, Long.valueOf(minValue), Long.valueOf(maxValue));
-    }
-
-    /**
      * Constructs a range of {@code long} values.
      *
      * @param  minValue       The minimal value.
@@ -181,20 +138,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@code float} values.
-     * The values can not be {@link Float#NaN}.
-     *
-     * @param  minValue The minimal value, inclusive, or {@link Float#NEGATIVE_INFINITY} if none..
-     * @param  maxValue The maximal value, <strong>inclusive</strong>, or {@link Float#POSITIVE_INFINITY} if none.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Float> create(final float minValue, final float maxValue) {
-        return new NumberRange<>(Float.class,
-                valueOf("minValue", minValue, Float.NEGATIVE_INFINITY),
-                valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY));
-    }
-
-    /**
      * Constructs a range of {@code float} values.
      * The values can not be {@link Float#NaN}.
      *
@@ -224,20 +167,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@code double} values.
-     * The values can not be {@link Double#NaN}.
-     *
-     * @param  minValue The minimal value, inclusive, or {@link Double#NEGATIVE_INFINITY} if none..
-     * @param  maxValue The maximal value, <strong>inclusive</strong>, or {@link Double#POSITIVE_INFINITY} if none.
-     * @return The new range of numeric values for the given bounds.
-     */
-    public static NumberRange<Double> create(final double minValue, final double maxValue) {
-        return new NumberRange<>(Double.class,
-                valueOf("minValue", minValue, Double.NEGATIVE_INFINITY),
-                valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY));
-    }
-
-    /**
      * Constructs a range of {@code double} values.
      * The values can not be {@link Double#NaN}.
      *
@@ -330,18 +259,6 @@ public class NumberRange<E extends Numbe
     }
 
     /**
-     * Constructs an inclusive range of {@link Number} objects.
-     *
-     * @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.
-     */
-    public NumberRange(final Class<E> type, final E minValue, final E maxValue) {
-        super(type, minValue, maxValue);
-    }
-
-    /**
      * Constructs a range of {@link Number} objects.
      *
      * @param type           The element type, usually one of {@link Byte}, {@link Short},

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=1446321&r1=1446320&r2=1446321&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 Thu Feb 14 20:52:27 2013
@@ -61,6 +61,7 @@ import java.util.Objects;
  * @module
  *
  * @see RangeFormat
+ * @see org.apache.sis.util.collection.RangeSet
  */
 @Immutable
 public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Serializable {
@@ -102,23 +103,6 @@ public class Range<E extends Comparable<
     }
 
     /**
-     * Creates a new range bounded by the given inclusive values.
-     *
-     * @param elementType  The class of the range elements.
-     * @param minValue     The minimal value (inclusive), or {@code null} if none.
-     * @param maxValue     The maximal value (inclusive), or {@code null} if none.
-     */
-    public Range(final Class<E> elementType, final E minValue, final E maxValue) {
-        ArgumentChecks.ensureNonNull("elementType", elementType);
-        this.elementType   = elementType;
-        this.minValue      = minValue;
-        this.isMinIncluded = (minValue != null);
-        this.maxValue      = maxValue;
-        this.isMaxIncluded = (maxValue != null);
-        assert validate();
-    }
-
-    /**
      * Creates a new range bounded by the given values.
      *
      * @param elementType    The base type of the range elements.
@@ -477,7 +461,7 @@ public class Range<E extends Comparable<
      * @param  position The position of {@code value} relative to the inclusive values of the other range.
      * @return Position (-, + or 0) of the inclusive values of this range compared to the other range.
      *
-     * @see #containsNC(Range)
+     * @see #contains(Range)
      */
     private int compareMinTo(final E value, int position) {
         /*

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java Thu Feb 14 20:52:27 2013
@@ -340,6 +340,11 @@ public final class Errors extends Indexe
         public static final int StalledThread_1 = 63;
 
         /**
+         * Ordering between “{0}” and “{1}” elements is undefined.
+         */
+        public static final int UndefinedOrderingForElements_2 = 70;
+
+        /**
          * Unexpected change in ‘{0}’.
          */
         public static final int UnexpectedChange_1 = 56;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties Thu Feb 14 20:52:27 2013
@@ -81,6 +81,7 @@ OddArrayLength_1                = Array 
 RecursiveCreateCallForKey_1     = Recursive call while creating an object for the \u201c{0}\u201d key.
 RequireDecimalSeparator         = A decimal separator is required.
 StalledThread_1                 = Thread \u201c{0}\u201d seems stalled.
+UndefinedOrderingForElements_2  = Ordering between \u201c{0}\u201d and \u201c{1}\u201d elements is undefined.
 UnexpectedChange_1              = Unexpected change in \u2018{0}\u2019.
 UnexpectedEndOfString_1         = More characters were expected at the end of \u201c{0}\u201d.
 UnmodifiableAffineTransform     = This affine transform is unmodifiable.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties Thu Feb 14 20:52:27 2013
@@ -69,6 +69,7 @@ OddArrayLength_1                = La lon
 RecursiveCreateCallForKey_1     = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u201c{0}\u201d.
 RequireDecimalSeparator         = Un s\u00e9parateur d\u00e9cimal est requis.
 StalledThread_1                 = La t\u00e2che \u201c{0}\u201d semble bloqu\u00e9e.
+UndefinedOrderingForElements_2  = L\u2019ordre entre les \u00e9l\u00e9ments \u201c{0}\u201d et \u201c{1}\u201d n\u2019est pas d\u00e9fini.
 UnexpectedChange_1              = Changement inattendu dans \u2018{0}\u2019.
 UnexpectedEndOfString_1         = D\u2019autres caract\u00e8res \u00e9taient attendus \u00e0 la fin du texte \u201c{0}\u201d.
 UnmodifiableAffineTransform     = Cette transformation affine n\u2019est pas modifiable.

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java Thu Feb 14 20:52:27 2013
@@ -46,8 +46,8 @@ public final strictfp class DateRangeTes
         final Date in1 = date("1998-05-12 11:00:00");
         final Date in2 = date("1998-06-08 14:00:00");
         final Date max = date("1998-07-01 19:00:00");
-        final Range<Date> r1 = new Range<>(Date.class, min, in2);
-        final Range<Date> r2 = new Range<>(Date.class, in1, max);
+        final Range<Date> r1 = new Range<>(Date.class, min, true, in2, true);
+        final Range<Date> r2 = new Range<>(Date.class, in1, true, max, true);
         final Range<Date> rt = r1.union(r2);
         assertEquals(min, rt.getMinValue());
         assertEquals(max, rt.getMaxValue());
@@ -55,8 +55,8 @@ public final strictfp class DateRangeTes
         /*
          * Test a range fully included in the other range.
          */
-        final Range<Date> outer = new Range<>(Date.class, min, max);
-        final Range<Date> inner = new Range<>(Date.class, in1, in2);
+        final Range<Date> outer = new Range<>(Date.class, min, true, max, true);
+        final Range<Date> inner = new Range<>(Date.class, in1, true, in2, true);
         assertSame(outer, outer.union(inner));
         assertSame(outer, inner.union(outer));
     }
@@ -70,8 +70,8 @@ public final strictfp class DateRangeTes
         final Date in1 = date("1998-05-12 11:00:00");
         final Date in2 = date("1998-06-08 14:00:00");
         final Date max = date("1998-07-01 19:00:00");
-        final Range<Date> r1 = new Range<>(Date.class, min, in2);
-        final Range<Date> r2 = new Range<>(Date.class, in1, max);
+        final Range<Date> r1 = new Range<>(Date.class, min, true, in2, true);
+        final Range<Date> r2 = new Range<>(Date.class, in1, true, max, true);
         final Range<Date> rt = r1.intersect(r2);
         assertEquals(in1, rt.getMinValue());
         assertEquals(in2, rt.getMaxValue());
@@ -79,8 +79,8 @@ public final strictfp class DateRangeTes
         /*
          * Test a range fully included in the other range.
          */
-        final Range<Date> outer = new Range<>(Date.class, min, max);
-        final Range<Date> inner = new Range<>(Date.class, in1, in2);
+        final Range<Date> outer = new Range<>(Date.class, min, true, max, true);
+        final Range<Date> inner = new Range<>(Date.class, in1, true, in2, true);
         assertSame(inner, outer.intersect(inner));
         assertSame(inner, inner.intersect(outer));
     }
@@ -94,8 +94,8 @@ public final strictfp class DateRangeTes
         final Date in1 = date("1998-05-12 11:00:00");
         final Date in2 = date("1998-06-08 14:00:00");
         final Date max = date("1998-07-01 19:00:00");
-        final Range<Date> outer = new Range<>(Date.class, min, max);
-        final Range<Date> inner = new Range<>(Date.class, in1, in2);
+        final Range<Date> outer = new Range<>(Date.class, min, true, max, true);
+        final Range<Date> inner = new Range<>(Date.class, in1, true, in2, true);
         final Range<Date>[] rt = outer.subtract(inner);
         assertEquals(2, rt.length);
         assertEquals(min, rt[0].getMinValue());

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java Thu Feb 14 20:52:27 2013
@@ -42,9 +42,9 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testConvertTo() throws ConversionException {
-        final MeasurementRange<Float> range = MeasurementRange.create(1000f, 2000f, SI.METRE);
+        final MeasurementRange<Float> range = MeasurementRange.create(1000f, true, 2000f, true, SI.METRE);
         assertSame(range, range.convertTo(SI.METRE));
-        assertEquals(MeasurementRange.create(1f, 2f, SI.KILOMETRE), range.convertTo(SI.KILOMETRE));
+        assertEquals(MeasurementRange.create(1f, true, 2f, true, SI.KILOMETRE), range.convertTo(SI.KILOMETRE));
     }
 
     /**
@@ -52,14 +52,14 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testAutoConversions() {
-        final MeasurementRange<Float> r1 = MeasurementRange.create(1000f, 2000f, SI.METRE);
-        final MeasurementRange<Float> r2 = MeasurementRange.create(1.5f, 3f, SI.KILOMETRE);
+        final MeasurementRange<Float> r1 = MeasurementRange.create(1000f, true, 2000f, true, SI.METRE);
+        final MeasurementRange<Float> r2 = MeasurementRange.create(1.5f, true, 3f, true, SI.KILOMETRE);
         assertEquals(Float.class, r1.getElementType());
         assertEquals(Float.class, r2.getElementType());
-        assertEquals(MeasurementRange.create(1000f, 3000f, SI.METRE ),    r1.union    (r2));
-        assertEquals(MeasurementRange.create(1f,    3f,    SI.KILOMETRE), r2.union    (r1));
-        assertEquals(MeasurementRange.create(1500f, 2000f, SI.METRE ),    r1.intersect(r2));
-        assertEquals(MeasurementRange.create(1.5f,  2f,    SI.KILOMETRE), r2.intersect(r1));
+        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, SI.METRE ),    r1.union    (r2));
+        assertEquals(MeasurementRange.create(   1f, true,    3f, true, SI.KILOMETRE), r2.union    (r1));
+        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, SI.METRE ),    r1.intersect(r2));
+        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, SI.KILOMETRE), r2.intersect(r1));
     }
 
     /**
@@ -67,12 +67,12 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testAutoConversionsOfAny() {
-        final MeasurementRange<?> r1 = MeasurementRange.create(1000f, 2000f, SI.METRE);
-        final MeasurementRange<?> r2 = MeasurementRange.create(1.5f, 3f, SI.KILOMETRE);
-        assertEquals(MeasurementRange.create(1000f, 3000f, SI.METRE ),    r1.unionAny    (r2));
-        assertEquals(MeasurementRange.create(1f,    3f,    SI.KILOMETRE), r2.unionAny    (r1));
-        assertEquals(MeasurementRange.create(1500f, 2000f, SI.METRE ),    r1.intersectAny(r2));
-        assertEquals(MeasurementRange.create(1.5f,  2f,    SI.KILOMETRE), r2.intersectAny(r1));
+        final MeasurementRange<?> r1 = MeasurementRange.create(1000f, true, 2000f, true, SI.METRE);
+        final MeasurementRange<?> r2 = MeasurementRange.create(1.5f, true, 3f, true, SI.KILOMETRE);
+        assertEquals(MeasurementRange.create(1000f, true, 3000f, true, SI.METRE ),    r1.unionAny    (r2));
+        assertEquals(MeasurementRange.create(   1f, true,    3f, true, SI.KILOMETRE), r2.unionAny    (r1));
+        assertEquals(MeasurementRange.create(1500f, true, 2000f, true, SI.METRE ),    r1.intersectAny(r2));
+        assertEquals(MeasurementRange.create( 1.5f, true,    2f, true, SI.KILOMETRE), r2.intersectAny(r1));
     }
 
     /**
@@ -80,7 +80,7 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testToString() {
-        final MeasurementRange<Float> range = MeasurementRange.create(10f, 20f, SI.KILOMETRE);
+        final MeasurementRange<Float> range = MeasurementRange.create(10f, true, 20f, true, SI.KILOMETRE);
         assertEquals("[10.0 … 20.0] km", range.toString());
     }
 
@@ -89,8 +89,8 @@ public final strictfp class MeasurementR
      */
     @Test
     public void testSerialization() {
-        NumberRange<Float> r1 = MeasurementRange.create(1000f, 2000f, SI.METRE);
-        NumberRange<Float> r2 = MeasurementRange.create(1.5f, 3f, SI.KILOMETRE);
+        NumberRange<Float> r1 = MeasurementRange.create(1000f, true, 2000f, true, SI.METRE);
+        NumberRange<Float> r2 = MeasurementRange.create(1.5f, true, 3f, true, SI.KILOMETRE);
         assertNotSame(r1, assertSerializedEquals(r1));
         assertNotSame(r2, assertSerializedEquals(r2));
     }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java Thu Feb 14 20:52:27 2013
@@ -38,7 +38,7 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testIntegerBounds() {
-        final NumberRange<Integer> range = NumberRange.create(10, 20);
+        final NumberRange<Integer> range = NumberRange.create(10, true, 20, true);
         assertEquals(10, range.getMinDouble(     ), 0);
         assertEquals(10, range.getMinDouble(true ), 0);
         assertEquals( 9, range.getMinDouble(false), 0);
@@ -52,15 +52,15 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testWithIntegers() {
-        NumberRange<Integer> r1 = NumberRange.create(10, 20);
-        NumberRange<Integer> r2 = NumberRange.create(15, 30);
+        NumberRange<Integer> r1 = NumberRange.create(10, true, 20, true);
+        NumberRange<Integer> r2 = NumberRange.create(15, true, 30, true);
         assertTrue (r1.equals(r1));
         assertTrue (r2.equals(r2));
         assertFalse(r1.equals(r2));
         assertEquals(Integer.class, r1.getElementType());
         assertEquals(Integer.class, r2.getElementType());
-        assertEquals(NumberRange.create(10, 30), r1.union(r2));
-        assertEquals(NumberRange.create(15, 20), r1.intersect(r2));
+        assertEquals(NumberRange.create(10, true, 30, true), r1.union(r2));
+        assertEquals(NumberRange.create(15, true, 20, true), r1.intersect(r2));
     }
 
     /**
@@ -68,12 +68,12 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testWithDoubles() {
-        NumberRange<Double> r1 = NumberRange.create(10.0, 20.0);
-        NumberRange<Double> r2 = NumberRange.create(15.0, 30.0);
+        NumberRange<Double> r1 = NumberRange.create(10.0, true, 20.0, true);
+        NumberRange<Double> r2 = NumberRange.create(15.0, true, 30.0, true);
         assertEquals(Double.class, r1.getElementType());
         assertEquals(Double.class, r2.getElementType());
-        assertEquals(NumberRange.create(10.0, 30.0), r1.union(r2));
-        assertEquals(NumberRange.create(15.0, 20.0), r1.intersect(r2));
+        assertEquals(NumberRange.create(10.0, true, 30.0, true), r1.union(r2));
+        assertEquals(NumberRange.create(15.0, true, 20.0, true), r1.intersect(r2));
     }
 
     /**
@@ -81,15 +81,15 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testIntegerWithDoubleArguments() {
-        NumberRange<Integer> r1 = NumberRange.create(10, 20);
-        NumberRange<Double>  r2 = NumberRange.create(15.0, 30.0);
+        NumberRange<Integer> r1 = NumberRange.create(10,   true, 20,   true);
+        NumberRange<Double>  r2 = NumberRange.create(15.0, true, 30.0, true);
         assertEquals(Integer.class, r1.getElementType());
         assertEquals(Double .class, r2.getElementType());
-        assertEquals(NumberRange.create(10.0, 30.0), r1.unionAny(r2));
-        assertEquals(NumberRange.create(15, 20), r1.intersectAny(r2));
+        assertEquals(NumberRange.create(10.0, true, 30.0, true), r1.unionAny(r2));
+        assertEquals(NumberRange.create(15,   true, 20,   true), r1.intersectAny(r2));
 
-        r2 = NumberRange.create(15.5, 30.0);
-        assertEquals(NumberRange.create(15.5f, 20.0f), r1.intersectAny(r2));
+        r2 = NumberRange.create(15.5, true, 30.0, true);
+        assertEquals(NumberRange.create(15.5f, true, 20.0f, true), r1.intersectAny(r2));
     }
 
     /**
@@ -97,15 +97,15 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testDoubleWithIntegerArguments() {
-        NumberRange<Double>  r1 = NumberRange.create(10.0, 20.0);
-        NumberRange<Integer> r2 = NumberRange.create(15, 30);
+        NumberRange<Double>  r1 = NumberRange.create(10.0, true, 20.0, true);
+        NumberRange<Integer> r2 = NumberRange.create(15,   true, 30,   true);
         assertEquals(Double .class, r1.getElementType());
         assertEquals(Integer.class, r2.getElementType());
-        assertEquals(NumberRange.create(10.0, 30.0), r1.unionAny(r2));
-        assertEquals(NumberRange.create(15, 20), r1.intersectAny(r2));
+        assertEquals(NumberRange.create(10.0, true, 30.0, true), r1.unionAny(r2));
+        assertEquals(NumberRange.create(15,   true, 20,   true), r1.intersectAny(r2));
 
-        r1 = NumberRange.create(10.0, 20.5);
-        assertEquals(NumberRange.create(15.0f, 20.5f), r1.intersectAny(r2));
+        r1 = NumberRange.create(10.0, true, 20.5, true);
+        assertEquals(NumberRange.create(15.0f, true, 20.5f, true), r1.intersectAny(r2));
     }
 
     /**
@@ -113,7 +113,7 @@ public final strictfp class NumberRangeT
      */
     @Test
     public void testCreateBestFit() {
-        assertEquals(NumberRange.create((short) 2, (short) 200),
+        assertEquals(NumberRange.create((short) 2, true, (short) 200, true),
                 NumberRange.createBestFit(2, true, 200.0, true));
     }
 }

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=1446321&r1=1446320&r2=1446321&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 Thu Feb 14 20:52:27 2013
@@ -102,7 +102,7 @@ public final strictfp class RangeFormatT
         maxPos = new FieldPosition(RangeFormat.Field.MAX_VALUE);
 
         // Closed range
-        assertEquals("[-10 … 20]", format(NumberRange.create(-10, 20)));
+        assertEquals("[-10 … 20]", format(NumberRange.create(-10, true, 20, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   4, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 7, maxPos.getBeginIndex());
@@ -130,7 +130,7 @@ public final strictfp class RangeFormatT
         assertEquals("maxPos.endIndex",   8, maxPos.getEndIndex());
 
         // Single value
-        assertEquals("300", format(NumberRange.create(300, 300)));
+        assertEquals("300", format(NumberRange.create(300, true, 300, true)));
         assertEquals("minPos.beginIndex", 0, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 0, maxPos.getBeginIndex());
@@ -144,49 +144,49 @@ public final strictfp class RangeFormatT
         assertEquals("maxPos.endIndex",   1, maxPos.getEndIndex());
 
         // Negative infinity
-        assertEquals("(-∞ … 30]", format(NumberRange.create(Double.NEGATIVE_INFINITY, 30)));
+        assertEquals("(-∞ … 30]", format(NumberRange.create(Double.NEGATIVE_INFINITY, true, 30, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   8, maxPos.getEndIndex());
 
         // Positive infinity
-        assertEquals("[50 … ∞)", format(NumberRange.create(50, Double.POSITIVE_INFINITY)));
+        assertEquals("[50 … ∞)", format(NumberRange.create(50, true, Double.POSITIVE_INFINITY, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   7, maxPos.getEndIndex());
 
         // Positive infinities
-        assertEquals("(-∞ … ∞)", format(NumberRange.create(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)));
+        assertEquals("(-∞ … ∞)", format(NumberRange.create(Double.NEGATIVE_INFINITY, true, Double.POSITIVE_INFINITY, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   7, maxPos.getEndIndex());
 
         // Positive infinity with integers
-        assertEquals("[50 … ∞)", format(new NumberRange<>(Integer.class, 50, null)));
+        assertEquals("[50 … ∞)", format(new NumberRange<>(Integer.class, 50, true, null, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   7, maxPos.getEndIndex());
 
         // Negative infinity with integers
-        assertEquals("(-∞ … 40]", format(new NumberRange<>(Integer.class, null, 40)));
+        assertEquals("(-∞ … 40]", format(new NumberRange<>(Integer.class, null, true, 40, true)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   3, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 6, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   8, maxPos.getEndIndex());
 
         // Measurement
-        assertEquals("[-10 … 20] m", format(MeasurementRange.create(-10, 20, SI.METRE)));
+        assertEquals("[-10 … 20] m", format(MeasurementRange.create(-10, true, 20, true, SI.METRE)));
         assertEquals("minPos.beginIndex", 1, minPos.getBeginIndex());
         assertEquals("minPos.endIndex",   4, minPos.getEndIndex());
         assertEquals("maxPos.beginIndex", 7, maxPos.getBeginIndex());
         assertEquals("maxPos.endIndex",   9, maxPos.getEndIndex());
 
         maxPos = new FieldPosition(RangeFormat.Field.UNIT);
-        assertEquals("[-1 … 2] km", format(MeasurementRange.create(-1, 2, SI.KILOMETRE)));
+        assertEquals("[-1 … 2] km", format(MeasurementRange.create(-1, true, 2, true, SI.KILOMETRE)));
         assertEquals("unitPos.beginIndex", 9, maxPos.getBeginIndex());
         assertEquals("unitPos.endIndex",  11, maxPos.getEndIndex());
     }
@@ -201,12 +201,12 @@ public final strictfp class RangeFormatT
         format   = new RangeFormat(Locale.CANADA, Integer.class);
         parsePos = new ParsePosition(0);
 
-        assertEquals(NumberRange.create(-10,         20       ), parse("[-10 … 20]" ));
+        assertEquals(NumberRange.create(-10, true,   20, true ), parse("[-10 … 20]" ));
         assertEquals(NumberRange.create( -3, false,   4, false), parse("( -3 …  4) "));
         assertEquals(NumberRange.create(  2, true,    8, false), parse("  [2 …  8) _"));
         assertEquals(NumberRange.create( 40, false,  90, true ), parse(" (40 … 90]_"));
-        assertEquals(NumberRange.create(300,        300       ), parse(" 300_"));
-        assertEquals(NumberRange.create(300,        300       ), parse("[300]"));
+        assertEquals(NumberRange.create(300, true,  300, true ), parse(" 300_"));
+        assertEquals(NumberRange.create(300, true,  300, true ), parse("[300]"));
         assertEquals(NumberRange.create(300, false, 300, false), parse("(300)"));
         assertEquals(NumberRange.create(  0, true,    0, false), parse("[]"));
     }
@@ -221,9 +221,9 @@ public final strictfp class RangeFormatT
         format   = new RangeFormat(Locale.CANADA, Double.class);
         parsePos = new ParsePosition(0);
 
-        assertEquals(NumberRange.create(-10.0,             20.0), parse("[-10 … 20]" ));
-        assertEquals(NumberRange.create(NEGATIVE_INFINITY, 30.0), parse("[-∞ … 30]"));
-        assertEquals(NumberRange.create(50.0, POSITIVE_INFINITY), parse("[50 … ∞]"));
+        assertEquals(NumberRange.create(-10.0, true,             20.0, true), parse("[-10 … 20]" ));
+        assertEquals(NumberRange.create(NEGATIVE_INFINITY, true, 30.0, true), parse("[-∞ … 30]"));
+        assertEquals(NumberRange.create(50.0, true, POSITIVE_INFINITY, true), parse("[50 … ∞]"));
     }
 
     /**
@@ -235,11 +235,11 @@ public final strictfp class RangeFormatT
         format   = new RangeFormat(Locale.CANADA);
         parsePos = new ParsePosition(0);
 
-        assertEquals(NumberRange.create((byte)    -10, (byte)    20), parse("[  -10 …    20]" ));
-        assertEquals(NumberRange.create((short) -1000, (short) 2000), parse("[-1000 …  2000]" ));
-        assertEquals(NumberRange.create((int)      10, (int)  40000), parse("[   10 … 40000]" ));
-        assertEquals(NumberRange.create((int)       1, (int)  50000), parse("[ 1.00 … 50000]" ));
-        assertEquals(NumberRange.create((float)   8.5, (float)    4), parse("[ 8.50 …     4]" ));
+        assertEquals(NumberRange.create((byte)    -10, true, (byte)    20, true), parse("[  -10 …    20]" ));
+        assertEquals(NumberRange.create((short) -1000, true, (short) 2000, true), parse("[-1000 …  2000]" ));
+        assertEquals(NumberRange.create((int)      10, true, (int)  40000, true), parse("[   10 … 40000]" ));
+        assertEquals(NumberRange.create((int)       1, true, (int)  50000, true), parse("[ 1.00 … 50000]" ));
+        assertEquals(NumberRange.create((float)   8.5, true, (float)    4, true), parse("[ 8.50 …     4]" ));
     }
 
     /**
@@ -290,7 +290,9 @@ public final strictfp class RangeFormatT
         final long DAY  = 24L * HOUR;
         final long YEAR = round(365.25 * DAY);
 
-        Range<Date> range = new Range<>(Date.class, new Date(15*DAY + 18*HOUR), new Date(20*YEAR + 15*DAY + 9*HOUR));
+        Range<Date> range = new Range<>(Date.class,
+                new Date(15*DAY + 18*HOUR), true,
+                new Date(20*YEAR + 15*DAY + 9*HOUR), true);
         AttributedCharacterIterator it = format.formatToCharacterIterator(range);
         String text = it.toString();
         findYears(it, RangeFormat.Field.MIN_VALUE, minPos);
@@ -304,7 +306,7 @@ public final strictfp class RangeFormatT
         /*
          * Try again with the infinity symbol in one bounds.
          */
-        range = new Range<>(Date.class, (Date) null, new Date(20*YEAR));
+        range = new Range<>(Date.class, (Date) null, true, new Date(20*YEAR), true);
         it    = format.formatToCharacterIterator(range);
         text  = it.toString();
         findYears(it, RangeFormat.Field.MAX_VALUE, maxPos);
@@ -313,7 +315,7 @@ public final strictfp class RangeFormatT
         assertEquals(14, maxPos.getEndIndex());
         assertEquals(range, parse(text));
 
-        range = new Range<>(Date.class, new Date(20*YEAR), (Date) null);
+        range = new Range<>(Date.class, new Date(20*YEAR), true, (Date) null, true);
         it    = format.formatToCharacterIterator(range);
         text  = it.toString();
         findYears(it, RangeFormat.Field.MIN_VALUE, minPos);

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java?rev=1446321&r1=1446320&r2=1446321&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java Thu Feb 14 20:52:27 2013
@@ -37,7 +37,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testConstructor() {
-        Range<Integer> range = new Range<>(Integer.class, 3, 5);
+        Range<Integer> range = new Range<>(Integer.class, 3, true, 5, true);
         assertEquals(Integer.valueOf(3), range.getMinValue());
         assertEquals(Integer.valueOf(5), range.getMaxValue());
         assertTrue  (range.isMaxIncluded());
@@ -65,7 +65,7 @@ public final strictfp class RangeTest ex
         assertFalse (range.isMinIncluded());
         assertFalse (range.isEmpty());
 
-        range = new Range<>(Integer.class, 10, 2);
+        range = new Range<>(Integer.class, 10, true, 2, true);
         assertEquals(Integer.valueOf(10), range.getMinValue());
         assertEquals(Integer.valueOf( 2), range.getMaxValue());
         assertTrue (range.isEmpty());
@@ -83,7 +83,7 @@ public final strictfp class RangeTest ex
     @SuppressWarnings({"unchecked", "rawtypes"})
     public void testConstructorErrors00() {
         assumeTrue(Range.class.desiredAssertionStatus());
-        new Range(Double.class, "error", "blast");
+        new Range(Double.class, "error", true, "blast", true);
     }
 
     /**
@@ -98,7 +98,7 @@ public final strictfp class RangeTest ex
     @SuppressWarnings({"unchecked", "rawtypes"})
     public void testConstructorErrors01() {
         assumeTrue(Range.class.desiredAssertionStatus());
-        new Range(String.class, 123.233, 8740.09);
+        new Range(String.class, 123.233, true, 8740.09, true);
     }
 
     /**
@@ -106,7 +106,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContains() {
-        final Range<Integer> range = new Range<>(Integer.class, 3, 5);
+        final Range<Integer> range = new Range<>(Integer.class, 3, true, 5, true);
         assertTrue (range.contains(4));
         assertFalse(range.contains(6));
         assertFalse(range.contains(2));
@@ -146,7 +146,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsNoLowerBound() {
-        final Range<Integer> range = new Range<>(Integer.class, null, 5);
+        final Range<Integer> range = new Range<>(Integer.class, null, true, 5, true);
         assertTrue (range.contains(-555));
         assertTrue (range.contains(5));
         assertFalse(range.contains(6));
@@ -157,7 +157,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsNoUpperBound() {
-        final Range<Integer> range = new Range<>(Integer.class, 3, null);
+        final Range<Integer> range = new Range<>(Integer.class, 3, true, null, true);
         assertFalse(range.contains(1));
         assertTrue (range.contains(3));
         assertTrue (range.contains(10000));
@@ -168,7 +168,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsNoBounds() {
-        final Range<Integer> range = new Range<>(Integer.class, null, null);
+        final Range<Integer> range = new Range<>(Integer.class, null, true, null, true);
         assertTrue(range.contains(-55555));
         assertTrue(range.contains(100000));
     }
@@ -178,8 +178,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsRange() {
-        final Range<Integer> range  = new Range<>(Integer.class, -10, 10);
-        final Range<Integer> inside = new Range<>(Integer.class,  -5,  5);
+        final Range<Integer> range  = new Range<>(Integer.class, -10, true, 10, true);
+        final Range<Integer> inside = new Range<>(Integer.class,  -5, true,  5, true);
 
         assertTrue(range.contains(inside));
         assertFalse(inside.contains(range));
@@ -190,8 +190,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsRangeNoLowerBound() {
-        final Range<Integer> range  = new Range<>(Integer.class,  null, 500);
-        final Range<Integer> inside = new Range<>(Integer.class, -2500, 305);
+        final Range<Integer> range  = new Range<>(Integer.class,  null, true, 500, true);
+        final Range<Integer> inside = new Range<>(Integer.class, -2500, true, 305, true);
 
         assertTrue (range.contains(inside));
         assertFalse(inside.contains(range));
@@ -202,8 +202,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testContainsRangeNoUpperBound() {
-        final Range<Integer> range  = new Range<>(Integer.class, -2500, null);
-        final Range<Integer> inside = new Range<>(Integer.class,    17,  305);
+        final Range<Integer> range  = new Range<>(Integer.class, -2500, true, null, true);
+        final Range<Integer> inside = new Range<>(Integer.class,    17, true,  305, true);
 
         assertTrue(range.contains(inside));
         assertFalse(inside.contains(range));
@@ -214,9 +214,9 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testIntersects() {
-        final Range<Character> range1 = new Range<>(Character.class, 'a', 'g');
-        final Range<Character> range2 = new Range<>(Character.class, 'c', 'm');
-        final Range<Character> range3 = new Range<>(Character.class, 'o', 'z');
+        final Range<Character> range1 = new Range<>(Character.class, 'a', true, 'g', true);
+        final Range<Character> range2 = new Range<>(Character.class, 'c', true, 'm', true);
+        final Range<Character> range3 = new Range<>(Character.class, 'o', true, 'z', true);
 
         assertTrue (range1.intersects(range2));
         assertTrue (range2.intersects(range1));
@@ -229,8 +229,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testIntersection() {
-        final Range<Integer> range1 = new Range<>(Integer.class, 1, 5);
-        final Range<Integer> range2 = new Range<>(Integer.class, 4, 6);
+        final Range<Integer> range1 = new Range<>(Integer.class, 1, true, 5, true);
+        final Range<Integer> range2 = new Range<>(Integer.class, 4, true, 6, true);
 
         final Range<?> intersection = range1.intersect(range2);
         assertEquals(Integer.class, intersection.getElementType());
@@ -243,8 +243,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testIntersectionOfNonIntersectingRanges() {
-        final Range<Integer> range1 = new Range<>(Integer.class, 1,  5);
-        final Range<Integer> range2 = new Range<>(Integer.class, 8, 10);
+        final Range<Integer> range1 = new Range<>(Integer.class, 1, true,  5, true);
+        final Range<Integer> range2 = new Range<>(Integer.class, 8, true, 10, true);
 
         final Range<?> intersection = range1.intersect(range2);
         assertEquals(Integer.class, intersection.getElementType());
@@ -256,8 +256,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testUnion() {
-        final Range<Character> range1 = new Range<>(Character.class, 'a', 'f');
-        final Range<Character> range2 = new Range<>(Character.class, 'd', 'h');
+        final Range<Character> range1 = new Range<>(Character.class, 'a', true, 'f', true);
+        final Range<Character> range2 = new Range<>(Character.class, 'd', true, 'h', true);
 
         final Range<?> union = range1.union(range2);
         assertFalse(union.isEmpty());
@@ -270,8 +270,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testDisjointUnion() {
-        final Range<Character> range1 = new Range<>(Character.class, 'a', 'f');
-        final Range<Character> range2 = new Range<>(Character.class, 'm', 'v');
+        final Range<Character> range1 = new Range<>(Character.class, 'a', true, 'f', true);
+        final Range<Character> range2 = new Range<>(Character.class, 'm', true, 'v', true);
 
         final Range<?> unionRange = range1.union(range2);
         assertFalse(unionRange.isEmpty());
@@ -284,8 +284,8 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testSubtract() {
-        final Range<Integer> range1 = new Range<>(Integer.class, 10, 40);
-        final Range<Integer> range2 = new Range<>(Integer.class, 20, 25);
+        final Range<Integer> range1 = new Range<>(Integer.class, 10, true, 40, true);
+        final Range<Integer> range2 = new Range<>(Integer.class, 20, true, 25, true);
         final Range<Integer>[] subtract = range1.subtract(range2);
         assertEquals(2, subtract.length);
         assertEquals(new Range<>(Integer.class, 10, true,  20, false), subtract[0]);
@@ -298,20 +298,20 @@ public final strictfp class RangeTest ex
     @Test
     public void testEquality() {
         // Positive test - success case
-        final Range<Character> range1 = new Range<>(Character.class, 'a', 'f');
-        final Range<Character> range2 = new Range<>(Character.class, 'a', 'f');
+        final Range<Character> range1 = new Range<>(Character.class, 'a', true, 'f', true);
+        final Range<Character> range2 = new Range<>(Character.class, 'a', true, 'f', true);
         assertTrue(range1.equals(range2));
 
         // Positive test - failure case
-        final Range<Character> range3 = new Range<>(Character.class, 'a', 'g');
+        final Range<Character> range3 = new Range<>(Character.class, 'a', true, 'g', true);
         assertFalse(range1.equals(range3));
 
         // Failure due to type incompatibility
-        final Range<String> range4 = new Range<>(String.class, "a", "g");
+        final Range<String> range4 = new Range<>(String.class, "a", true, "g", true);
         assertFalse(range3.equals(range4));
 
-        final Range<Character> range5 = new Range<>(Character.class, 'g', 'a');
-        final Range<Character> range6 = new Range<>(Character.class, 'g', 'a');
+        final Range<Character> range5 = new Range<>(Character.class, 'g', true, 'a', true);
+        final Range<Character> range6 = new Range<>(Character.class, 'g', true, 'a', true);
         assertTrue(range5.isEmpty());
         assertTrue(range6.isEmpty());
         assertTrue(range5.equals(range6));
@@ -322,7 +322,7 @@ public final strictfp class RangeTest ex
      */
     @Test
     public void testSerialization() {
-        final Range<Integer> range  = new Range<>(Integer.class, -10, 10);
+        final Range<Integer> range  = new Range<>(Integer.class, -10, true, 10, true);
         assertNotSame(range, assertSerializedEquals(range));
     }
 }



Mime
View raw message