sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1627537 - in /sis/branches/JDK7: ./ core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
Date Thu, 25 Sep 2014 13:25:43 GMT
Author: desruisseaux
Date: Thu Sep 25 13:25:43 2014
New Revision: 1627537

URL: http://svn.apache.org/r1627537
Log:
Merge the NullPointerException fix.

Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1627514-1627536

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java?rev=1627537&r1=1627536&r2=1627537&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
[UTF-8] Thu Sep 25 13:25:43 2014
@@ -408,6 +408,9 @@ public class RangeSet<E extends Comparab
      */
     @SuppressWarnings("unchecked")
     private boolean isSorted() {
+        if (array == null) {
+            return true;
+        }
         final boolean strict = isMinIncluded | isMaxIncluded;
         switch (elementCode) {
             case DOUBLE:    return ArraysExt.isSorted((double[]) array, strict);
@@ -665,7 +668,7 @@ public class RangeSet<E extends Comparab
                 removeAt(i0, i1);
             } else {
                 /*
-                 * i0 is pair and i1 is odd.
+                 * i0 is even and i1 is odd.
                  * Case where minValue is outside any existing range and maxValue is inside
a specific range.
                  *
                  *   index :      A0    B0       A1       B1        An      Bn     A(n+1)
  B(n+1)
@@ -681,13 +684,13 @@ public class RangeSet<E extends Comparab
                  * index :      A0    B0       i1  Bn     A(n+1)   B(n+1)
                  * range :      ███████        █████      ██████████
 ◾◾◾
                  */
-                removeAt(i0, i1 & ~1); // i1 - 1
+                removeAt(i0, i1 & ~1); // equivalent to (i0, i1 - 1)
                 Array.set(array, i0, maxValue);
             }
         } else {
             if ((i1 & 1) == 0) {
                 /*
-                 * i0 is odd and i1 is pair.
+                 * i0 is odd and i1 is even.
                  * Case where minValue is inside a specific range and maxValue is outside
any range.
                  *
                  *  index :      A0    B0     A1       B1        An      Bn        A(n+1)
  B(n+1)
@@ -744,7 +747,7 @@ public class RangeSet<E extends Comparab
                     final int di = i1 - i0;
                     assert di >= 2 : di;
                     if (di > 2) {
-                        removeAt(i0 + 1, i1 & ~1); // i0 + 1, i1 - 1
+                        removeAt(i0 + 1, i1 & ~1); // equivalent to (i0 + 1, i1 - 1)
                     }
                     Array.set(array, i0,     minValue);
                     Array.set(array, i0 + 1, maxValue);



Mime
View raw message