sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1441572 - in /sis/branches/JDK7: sis-referencing/src/main/java/org/apache/sis/geometry/ sis-utility/src/main/java/org/apache/sis/internal/util/ sis-utility/src/main/java/org/apache/sis/io/ sis-utility/src/main/java/org/apache/sis/math/ sis...
Date Fri, 01 Feb 2013 18:27:38 GMT
Author: desruisseaux
Date: Fri Feb  1 18:27:37 2013
New Revision: 1441572

URL: http://svn.apache.org/viewvc?rev=1441572&view=rev
Log:
Renamed Arrays as ArraysExt because the risk of confusion with java.util.Arrays was too high,
since those two classes are used often together in practice.

Added:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java
      - copied, changed from r1440559, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Arrays.java
Removed:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Arrays.java
Modified:
    sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
    sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/SystemListener.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Units.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Classes.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Locales.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/ArraysTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java

Modified: sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
(original)
+++ sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
Fri Feb  1 18:27:37 2013
@@ -29,12 +29,12 @@ import org.opengis.referencing.crs.Coord
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.RangeMeaning;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
 
 import static java.lang.Double.doubleToLongBits;
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.StringBuilders.trimFractionalPart;
 import static org.apache.sis.util.ArgumentChecks.ensureDimensionMatches;
 
@@ -342,7 +342,7 @@ parse:  while (i < length) {
                 c = Character.codePointAt(wkt, i);
             }
         }
-        return resize(ordinates, dimension);
+        return ArraysExt.resize(ordinates, dimension);
     }
 
     /**

Modified: sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
(original)
+++ sis/branches/JDK7/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
Fri Feb  1 18:27:37 2013
@@ -31,11 +31,11 @@ import org.opengis.metadata.extent.Geogr
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.util.FactoryException;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.referencing.CRS;
 
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.ArgumentChecks.*;
 import static org.apache.sis.math.MathFunctions.isNegative;
 import static org.apache.sis.internal.referencing.Utilities.isPoleToPole;
@@ -280,7 +280,7 @@ scanNumber: while ((i += Character.charC
         }
         if (levelParenth != 0) fail(wkt, ')');
         if (levelBracket != 0) fail(wkt, ']');
-        ordinates = resize(minimum, maxDimension << 1);
+        ordinates = ArraysExt.resize(minimum, maxDimension << 1);
         System.arraycopy(maximum, 0, ordinates, maxDimension, maxDimension);
     }
 

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/SystemListener.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/SystemListener.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/SystemListener.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/SystemListener.java
Fri Feb  1 18:27:37 2013
@@ -17,7 +17,7 @@
 package org.apache.sis.internal.util;
 
 import java.util.EventListener;
-import org.apache.sis.util.Arrays;
+import org.apache.sis.util.ArraysExt;
 
 import static java.util.Arrays.copyOf;
 
@@ -46,7 +46,7 @@ public abstract class SystemListener imp
      * @param listener The listener to add. Can not be {@code null}.
      */
     public static synchronized void add(final SystemListener listener) {
-        assert (listener != null) && !Arrays.contains(listeners, listener);
+        assert (listener != null) && !ArraysExt.contains(listeners, listener);
         SystemListener[] list = listeners;
         if (list == null) {
             list = new SystemListener[1];
@@ -73,7 +73,7 @@ public abstract class SystemListener imp
         if (list != null) {
             for (int i=list.length; --i>=0;) {
                 if (list[i] == listener) {
-                    list = Arrays.remove(list, i, 1);
+                    list = ArraysExt.remove(list, i, 1);
                 }
             }
             listeners = list;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java Fri Feb
 1 18:27:37 2013
@@ -21,13 +21,13 @@ import java.util.Arrays;
 import java.util.List;
 import java.io.Flushable;
 import java.io.IOException;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Decorator;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.X364;
 
-import static org.apache.sis.util.Arrays.EMPTY_INT;
 import static org.apache.sis.util.Characters.isLineOrParagraphSeparator;
 
 
@@ -169,7 +169,7 @@ public class TableAppender extends Appen
      * Maximum width for each columns. This array length must
      * be equal to the number of columns in this table.
      */
-    private int[] maximalColumnWidths = EMPTY_INT;
+    private int[] maximalColumnWidths = ArraysExt.EMPTY_INT;
 
     /**
      * The line separator. We will use the first line separator found in the

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java Fri
Feb  1 18:27:37 2013
@@ -18,6 +18,7 @@ package org.apache.sis.math;
 
 import java.util.Arrays;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
@@ -26,9 +27,6 @@ import static java.lang.Float.intBitsToF
 import static java.lang.Float.floatToRawIntBits;
 import static java.lang.Double.longBitsToDouble;
 import static java.lang.Double.doubleToRawLongBits;
-import static org.apache.sis.util.Arrays.resize;
-import static org.apache.sis.util.Arrays.isSorted;
-import static org.apache.sis.util.Arrays.EMPTY_INT;
 import static org.apache.sis.internal.util.Utilities.SIGN_BIT_MASK;
 
 
@@ -727,7 +725,7 @@ testNextNumber:         while (true) { /
      */
     public static int[] divisors(int number) {
         if (number == 0) {
-            return EMPTY_INT;
+            return ArraysExt.EMPTY_INT;
         }
         number = Math.abs(number);
         int[] divisors = new int[16];
@@ -788,8 +786,8 @@ testNextNumber:         while (true) { /
                 }
             }
         }
-        divisors = resize(divisors, count);
-        assert isSorted(divisors, true);
+        divisors = ArraysExt.resize(divisors, count);
+        assert ArraysExt.isSorted(divisors, true);
         return divisors;
     }
 
@@ -801,7 +799,7 @@ testNextNumber:         while (true) { /
      */
     public static int[] commonDivisors(final int... numbers) {
         if (numbers.length == 0) {
-            return EMPTY_INT;
+            return ArraysExt.EMPTY_INT;
         }
         /*
          * Get the smallest value. We will compute the divisors only for this value,
@@ -831,6 +829,6 @@ testNextNumber:         while (true) { /
                 }
             }
         }
-        return resize(divisors, count);
+        return ArraysExt.resize(divisors, count);
     }
 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Units.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Units.java Fri Feb
 1 18:27:37 2013
@@ -31,7 +31,7 @@ import javax.measure.quantity.Quantity;
 import javax.measure.converter.UnitConverter;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Workaround;
-import org.apache.sis.util.Arrays;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
@@ -448,7 +448,7 @@ public final class Units extends Static 
             s = Math.max(uom.lastIndexOf(' '), uom.lastIndexOf('_'));
             if (s >= 1) {
                 final String suffix = (String) trimWhitespaces(uom, s+1, length);
-                if (Arrays.containsIgnoreCase(DEGREE_SUFFIXES, suffix) || (isTemperature
= isCelsius(suffix))) {
+                if (ArraysExt.containsIgnoreCase(DEGREE_SUFFIXES, suffix) || (isTemperature
= isCelsius(suffix))) {
                     prefix = (String) trimWhitespaces(uom, 0, s); // Remove the suffix only
if we recognized it.
                 }
             }

Copied: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java (from
r1440559, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Arrays.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java?p2=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Arrays.java&r1=1440559&r2=1441572&rev=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Arrays.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/ArraysExt.java Fri Feb
 1 18:27:37 2013
@@ -16,24 +16,24 @@
  */
 package org.apache.sis.util;
 
+import java.util.Arrays;
 import java.util.Comparator;
 import java.lang.reflect.Array;
-import static java.util.Arrays.copyOf;
 
 // Related to JDK7
 import java.util.Objects;
 
 
 /**
- * Static methods for simple operations on arrays and array elements. This class provides
methods
- * for inserting and deleting elements in an array, as well as resizing the array. Some worthy
- * methods are:
+ * Static methods for simple operations on arrays and array elements.
+ * This is an extension to the standard {@link Arrays} utility class.
+ * Some worthy methods are:
  *
  * <ul>
  *   <li>The {@link #resize(Object[], int) resize} methods, which are very similar
to the
- *       {@link java.util.Arrays#copyOf(Object[], int) Arrays.copyOf} methods except that
- *       they accept {@code null} arrays and do not copy anything if the given array already
- *       has the requested length.</li>
+ *       {@link Arrays#copyOf(Object[], int) Arrays.copyOf} methods except that they accept
+ *       {@code null} arrays and do not copy anything if the given array already has the
+ *       requested length.</li>
  *   <li>The {@link #insert(Object[], int, Object[], int, int) insert} and {@link #remove(Object[],
  *       int, int) remove} methods for adding and removing elements in the middle of an
array.</li>
  *   <li>The {@link #isSorted(Object[], Comparator, boolean) isSorted} methods for
verifying
@@ -72,9 +72,9 @@ import java.util.Objects;
  * @version 0.3
  * @module
  *
- * @see java.util.Arrays
+ * @see Arrays
  */
-public final class Arrays extends Static {
+public final class ArraysExt extends Static {
     /**
      * An empty array of {@code double} primitive type.
      * Such arrays are immutable and can be safely shared.
@@ -126,7 +126,7 @@ public final class Arrays extends Static
     /**
      * Do not allow instantiation of this class.
      */
-    private Arrays() {
+    private ArraysExt() {
     }
 
     /**
@@ -145,7 +145,7 @@ public final class Arrays extends Static
      *
      *   <li>If the given {@code length} is equal to the length of the given {@code
array},
      *       then {@code array} is returned unchanged. <strong>No copy</strong>
is performed.
-     *       This behavior is different than the {@link java.util.Arrays#copyOf} one.</li>
+     *       This behavior is different than the {@link Arrays#copyOf(Object[], int)} one.</li>
      * </ul>
      *
      * Note that if the given array is {@code null}, then this method unconditionally returns
@@ -158,10 +158,10 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(Object[], int)
+     * @see Arrays#copyOf(Object[], int)
      */
     public static <E> E[] resize(final E[] array, final int length) throws NegativeArraySizeException
{
-        return (array == null || array.length == length) ? array : copyOf(array, length);
+        return (array == null || array.length == length) ? array : Arrays.copyOf(array, length);
     }
 
     /**
@@ -177,7 +177,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(double[], int)
+     * @see Arrays#copyOf(double[], int)
      */
     public static double[] resize(final double[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -185,7 +185,7 @@ public final class Arrays extends Static
                 return EMPTY_DOUBLE;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -204,7 +204,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(float[], int)
+     * @see Arrays#copyOf(float[], int)
      */
     public static float[] resize(final float[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -212,7 +212,7 @@ public final class Arrays extends Static
                 return EMPTY_FLOAT;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -231,7 +231,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(long[], int)
+     * @see Arrays#copyOf(long[], int)
      */
     public static long[] resize(final long[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -239,7 +239,7 @@ public final class Arrays extends Static
                 return EMPTY_LONG;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -258,7 +258,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(int[], int)
+     * @see Arrays#copyOf(int[], int)
      */
     public static int[] resize(final int[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -266,7 +266,7 @@ public final class Arrays extends Static
                 return EMPTY_INT;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -285,7 +285,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(short[], int)
+     * @see Arrays#copyOf(short[], int)
      */
     public static short[] resize(final short[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -293,7 +293,7 @@ public final class Arrays extends Static
                 return EMPTY_SHORT;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -312,7 +312,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(byte[], int)
+     * @see Arrays#copyOf(byte[], int)
      */
     public static byte[] resize(final byte[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -320,7 +320,7 @@ public final class Arrays extends Static
                 return EMPTY_BYTE;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -339,7 +339,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(char[], int)
+     * @see Arrays#copyOf(char[], int)
      */
     public static char[] resize(final char[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -347,7 +347,7 @@ public final class Arrays extends Static
                 return EMPTY_CHAR;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -366,7 +366,7 @@ public final class Arrays extends Static
      *         array is {@code null} or already have the requested length.
      * @throws NegativeArraySizeException If {@code length} is negative.
      *
-     * @see java.util.Arrays#copyOf(boolean[], int)
+     * @see Arrays#copyOf(boolean[], int)
      */
     public static boolean[] resize(final boolean[] array, final int length) throws NegativeArraySizeException
{
         if (array != null) {
@@ -374,7 +374,7 @@ public final class Arrays extends Static
                 return EMPTY_BOOLEAN;
             }
             if (array.length != length) {
-                return copyOf(array, length);
+                return Arrays.copyOf(array, length);
             }
         }
         return array;
@@ -1301,7 +1301,7 @@ public final class Arrays extends Static
      */
     public static <T> T[] append(final T[] array, final T element) throws NullArgumentException{
         ArgumentChecks.ensureNonNull("array", array);
-        final T[] copy = copyOf(array, array.length + 1);
+        final T[] copy = Arrays.copyOf(array, array.length + 1);
         copy[array.length] = element;
         return copy;
     }
@@ -1819,7 +1819,7 @@ public final class Arrays extends Static
                         if (array.length == length) {
                             return array;
                         }
-                        result = copyOf(array, length);
+                        result = Arrays.copyOf(array, length);
                     } else {
                         System.arraycopy(array, 0, result, offset, array.length);
                     }
@@ -1837,8 +1837,7 @@ public final class Arrays extends Static
      *
      * {@section Recommended assertions}
      * Callers are encouraged to place the following assertions before calls to this method,
-     * using the {@link #isSorted(int[], boolean)} and {@link java.util.Arrays#toString(int[])}
-     * methods:
+     * using the {@link #isSorted(int[], boolean)} and {@link Arrays#toString(int[])} methods:
      *
      * {@preformat java
      *   assert isSorted(array1, true) : toString(array1);

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java Fri
Feb  1 18:27:37 2013
@@ -16,12 +16,10 @@
  */
 package org.apache.sis.util;
 
+import java.util.Arrays;
 import java.nio.CharBuffer;
 
 import static java.lang.Character.*;
-import static java.util.Arrays.fill;
-import static java.util.Arrays.copyOf;
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.StringBuilders.replace;
 
 
@@ -101,7 +99,7 @@ public final class CharSequences extends
         // this strategy and build the char[] array on the fly.
         final int last = SPACES.length - 1;
         final char[] spaces = new char[last+1];
-        fill(spaces, ' ');
+        Arrays.fill(spaces, ' ');
         SPACES[last] = new String(spaces).intern();
     }
 
@@ -168,7 +166,7 @@ public final class CharSequences extends
 
             @Override public String toString() {
                 final char[] array = new char[length];
-                fill(array, ' ');
+                Arrays.fill(array, ' ');
                 return new String(array);
             }
         };
@@ -651,7 +649,7 @@ search:     for (; fromIndex <= toIndex;
             final CharSequence item = trimWhitespaces(text, last, i);
             if (!excludeEmpty || item.length() != 0) {
                 if (count == strings.length) {
-                    strings = copyOf(strings, count << 1);
+                    strings = Arrays.copyOf(strings, count << 1);
                 }
                 strings[count++] = item;
             }
@@ -661,11 +659,11 @@ search:     for (; fromIndex <= toIndex;
         final CharSequence item = trimWhitespaces(text, last, length);
         if (!excludeEmpty || item.length() != 0) {
             if (count == strings.length) {
-                strings = copyOf(strings, count + 1);
+                strings = Arrays.copyOf(strings, count + 1);
             }
             strings[count++] = item;
         }
-        return resize(strings, count);
+        return ArraysExt.resize(strings, count);
     }
 
     /**
@@ -747,7 +745,7 @@ search:     for (; fromIndex <= toIndex;
                 }
             }
             if (count >= splitted.length) {
-                splitted = copyOf(splitted, count*2);
+                splitted = Arrays.copyOf(splitted, count*2);
             }
             splitted[count++] = text.subSequence(last, splitAt);
             last = splitAt + skip;
@@ -756,10 +754,10 @@ search:     for (; fromIndex <= toIndex;
          * Add the remaining string and we are done.
          */
         if (count >= splitted.length) {
-            splitted = copyOf(splitted, count+1);
+            splitted = Arrays.copyOf(splitted, count+1);
         }
         splitted[count++] = text.subSequence(last, text.length());
-        return resize(splitted, count);
+        return ArraysExt.resize(splitted, count);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Classes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Classes.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Classes.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Classes.java Fri Feb 
1 18:27:37 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.util;
 
 import java.util.Set;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,9 +29,6 @@ import java.lang.reflect.WildcardType;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 
-import static java.util.Arrays.copyOf;
-import static org.apache.sis.util.Arrays.resize;
-import static org.apache.sis.util.Arrays.contains;
 import static org.apache.sis.util.collection.Collections.hashMapCapacity;
 
 
@@ -377,14 +375,14 @@ next:       for (final Class<?> candidat
                         types = candidates;
                     }
                     if (count >= types.length) {
-                        types = copyOf(types, types.length + candidates.length);
+                        types = Arrays.copyOf(types, types.length + candidates.length);
                     }
                     types[count++] = candidate;
                 }
             }
             type = type.getSuperclass();
         }
-        return (Class[]) resize(types, count);
+        return (Class[]) ArraysExt.resize(types, count);
     }
 
     /**
@@ -669,6 +667,6 @@ cmp:    for (final Class<?> c : c1) {
                method.getParameterTypes().length == 0 &&
               !method.isSynthetic() &&
               !method.isAnnotationPresent(Deprecated.class) &&
-              !contains(EXCLUDES, method.getName());
+              !ArraysExt.contains(EXCLUDES, method.getName());
     }
 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Locales.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Locales.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Locales.java Fri Feb 
1 18:27:37 2013
@@ -28,7 +28,6 @@ import java.lang.reflect.Modifier;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
 import static org.apache.sis.util.collection.Collections.hashMapCapacity;
 
@@ -141,7 +140,7 @@ public final class Locales extends Stati
                 locales[count++] = unique(locale);
             }
         }
-        locales = resize(locales, count);
+        locales = ArraysExt.resize(locales, count);
         return locales;
     }
 

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTables.java
Fri Feb  1 18:27:37 2013
@@ -25,11 +25,9 @@ import java.nio.file.Path;
 import java.text.ParseException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.ArgumentChecks;
 
-import static org.apache.sis.util.Arrays.resize;
-import static org.apache.sis.util.Arrays.insert;
-
 
 /**
  * Static methods working on {@link TreeTable} objects and their nodes.
@@ -208,7 +206,7 @@ public final class TreeTables extends St
                 filtered[count++] = (TableColumn<? super String>) column;
             }
         }
-        filtered = resize(filtered, count);
+        filtered = ArraysExt.resize(filtered, count);
         return valuesAsStrings(table.getRoot(), filtered, locale, new HashMap<String,String>());
     }
 
@@ -286,7 +284,7 @@ public final class TreeTables extends St
         ArgumentChecks.ensureNonNull("nodes", nodes);
         TableColumn<?>[] columns = null; // Default to singleton(NAME).
         if (values.length != 0 || nodes != TableColumn.NAME) {
-            columns = insert(values, 0, 1);
+            columns = ArraysExt.insert(values, 0, 1);
             columns[0] = nodes;
         }
         final TreeTableFormat format = TreeTableFormat.INSTANCE;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakHashSet.java
Fri Feb  1 18:27:37 2013
@@ -23,12 +23,12 @@ import java.lang.reflect.Array;
 import net.jcip.annotations.ThreadSafe;
 
 import org.apache.sis.util.Debug;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.NullArgumentException;
 
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.collection.WeakEntry.*;
 
 // Related to JDK7
@@ -377,7 +377,7 @@ public class WeakHashSet<E> extends Abst
                 }
             }
         }
-        return resize(elements, index);
+        return ArraysExt.resize(elements, index);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
Fri Feb  1 18:27:37 2013
@@ -27,12 +27,12 @@ import java.lang.ref.WeakReference;
 import net.jcip.annotations.ThreadSafe;
 
 import org.apache.sis.util.Debug;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.NullArgumentException;
 
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.collection.WeakEntry.*;
 
 // Related to JDK7
@@ -465,7 +465,7 @@ public class WeakValueHashMap<K,V> exten
                         }
                     }
                 }
-                return resize(elements, index);
+                return ArraysExt.resize(elements, index);
             }
         }
 

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java Fri
Feb  1 18:27:37 2013
@@ -25,11 +25,11 @@ import java.util.logging.LogRecord;
 
 import org.apache.sis.util.Configuration;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Classes;
 
 import static java.util.Arrays.binarySearch;
-import static org.apache.sis.util.Arrays.insert;
 
 
 /**
@@ -259,7 +259,7 @@ public final class Logging extends Stati
                         break;
                     }
                     i = ~i;
-                    children = insert(children, i, 1);
+                    children = ArraysExt.insert(children, i, 1);
                     children[i] = new Logging(logging, name);
                     logging.children = children;
                 }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
(original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
Fri Feb  1 18:27:37 2013
@@ -19,10 +19,9 @@ package org.apache.sis.util.resources;
 import java.util.Arrays;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.CharSequences;
 
-import static org.apache.sis.util.Arrays.resize;
-
 
 /**
  * Base class of {@code Keys} inner classes declaring key constants.
@@ -92,7 +91,7 @@ class KeyConstants {
             } catch (ReflectiveOperationException e) {
                 names = CharSequences.EMPTY_ARRAY;
             }
-            keys = resize(names, length);
+            keys = ArraysExt.resize(names, length);
         }
         return keys;
     }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
(original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
Fri Feb  1 18:27:37 2013
@@ -23,7 +23,7 @@ import org.apache.sis.test.DependsOnMeth
 
 import static org.junit.Assert.*;
 import static org.apache.sis.math.MathFunctions.*;
-import static org.apache.sis.util.Arrays.isSorted;
+import static org.apache.sis.util.ArraysExt.isSorted;
 
 
 /**

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java Fri Feb
 1 18:27:37 2013
@@ -37,7 +37,8 @@ import org.junit.runners.model.Initializ
 import org.junit.runners.model.Statement;
 import org.junit.runners.model.TestClass;
 
-import static org.apache.sis.util.Arrays.resize;
+import org.apache.sis.util.ArraysExt;
+
 import static org.apache.sis.util.collection.Collections.isNullOrEmpty;
 import static org.apache.sis.util.collection.Collections.hashMapCapacity;
 
@@ -247,7 +248,7 @@ public final class TestRunner extends Bl
         if (count == 0) {
             throw new NoTestsRemainException();
         }
-        filteredChildren = resize(children, count);
+        filteredChildren = ArraysExt.resize(children, count);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/ArraysTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/ArraysTest.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/ArraysTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/ArraysTest.java Fri Feb
 1 18:27:37 2013
@@ -39,7 +39,7 @@ public final strictfp class ArraysTest e
     public void testRemoveDuplicated() {
         final Integer[] array = new Integer[] {2, 8, 4, 8, 1, 2, 8};
         assertArrayEquals(new Integer[] {2, 8, 4, 1},
-                Arrays.resize(array, Arrays.removeDuplicated(array)));
+                ArraysExt.resize(array, ArraysExt.removeDuplicated(array)));
     }
 
     /**
@@ -49,11 +49,11 @@ public final strictfp class ArraysTest e
     @Test
     public void testReverse() {
         int[] array = new int[] {2, 4, 8, 10};
-        Arrays.reverse(array);
+        ArraysExt.reverse(array);
         assertArrayEquals(new int[] {10, 8, 4, 2}, array);
 
         array = new int[] {2, 4, 8, 10, 11};
-        Arrays.reverse(array);
+        ArraysExt.reverse(array);
         assertArrayEquals(new int[] {11, 10, 8, 4, 2}, array);
     }
 
@@ -64,7 +64,7 @@ public final strictfp class ArraysTest e
     public void testUnionOfSorted() {
         final int[] array1 = new int[] {2, 4, 6, 9, 12};
         final int[] array2 = new int[] {1, 2, 3, 12, 13, 18, 22};
-        final int[] union = Arrays.unionOfSorted(array1, array2);
+        final int[] union = ArraysExt.unionOfSorted(array1, array2);
         assertArrayEquals(new int[] {1, 2, 3, 4, 6, 9, 12, 13, 18, 22}, union);
     }
 }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java Fri Feb
 1 18:27:37 2013
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
  * @version 0.3
  * @module
  */
-@DependsOn(Arrays.class)
+@DependsOn(ArraysExt.class)
 public final strictfp class LocalesTest extends TestCase {
     /**
      * Tests the {@link Locales#getAvailableLanguages()} method.
@@ -40,8 +40,8 @@ public final strictfp class LocalesTest 
     @Test
     public void testGetAvailableLanguages() {
         final Locale[] locales = Locales.ALL.getAvailableLanguages();
-        assertTrue ("Expected English locale.",         Arrays.contains(locales, Locale.ENGLISH));
-        assertFalse("US is a country, not a language.", Arrays.contains(locales, Locale.US));
+        assertTrue ("Expected English locale.",         ArraysExt.contains(locales, Locale.ENGLISH));
+        assertFalse("US is a country, not a language.", ArraysExt.contains(locales, Locale.US));
     }
 
     /**
@@ -50,11 +50,11 @@ public final strictfp class LocalesTest 
     @Test
     public void testGetAvailableLocales() {
         final Locale[] locales = Locales.SIS.getAvailableLocales();
-        assertTrue(Arrays.contains(locales, Locale.ENGLISH));
-        assertTrue(Arrays.contains(locales, Locale.US));
-        assertTrue(Arrays.contains(locales, Locale.CANADA));
-        assertTrue(Arrays.contains(locales, Locale.FRANCE));
-        assertTrue(Arrays.contains(locales, Locale.CANADA_FRENCH));
+        assertTrue(ArraysExt.contains(locales, Locale.ENGLISH));
+        assertTrue(ArraysExt.contains(locales, Locale.US));
+        assertTrue(ArraysExt.contains(locales, Locale.CANADA));
+        assertTrue(ArraysExt.contains(locales, Locale.FRANCE));
+        assertTrue(ArraysExt.contains(locales, Locale.CANADA_FRENCH));
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java?rev=1441572&r1=1441571&r2=1441572&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java Fri
Feb  1 18:27:37 2013
@@ -21,7 +21,7 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Arrays;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.test.TestCase;
 import org.junit.*;
 
@@ -50,8 +50,8 @@ public final strictfp class NilReasonTes
         assertSame(NilReason.MISSING,  NilReason.valueOf("  missing "));
 
         final NilReason[] reasons = NilReason.values();
-        assertTrue(Arrays.contains(reasons, NilReason.TEMPLATE));
-        assertTrue(Arrays.contains(reasons, NilReason.MISSING));
+        assertTrue(ArraysExt.contains(reasons, NilReason.TEMPLATE));
+        assertTrue(ArraysExt.contains(reasons, NilReason.MISSING));
     }
 
     /**
@@ -70,9 +70,9 @@ public final strictfp class NilReasonTes
         assertNull   ("NilReason.getURI()", other.getURI());
 
         final NilReason[] reasons = NilReason.values();
-        assertTrue(Arrays.contains(reasons, NilReason.TEMPLATE));
-        assertTrue(Arrays.contains(reasons, NilReason.MISSING));
-        assertTrue(Arrays.contains(reasons, other));
+        assertTrue(ArraysExt.contains(reasons, NilReason.TEMPLATE));
+        assertTrue(ArraysExt.contains(reasons, NilReason.MISSING));
+        assertTrue(ArraysExt.contains(reasons, other));
     }
 
     /**
@@ -88,9 +88,9 @@ public final strictfp class NilReasonTes
         assertEquals("NilReason.getURI()", "http://www.nilreasons.org", String.valueOf(other.getURI()));
 
         final NilReason[] reasons = NilReason.values();
-        assertTrue(Arrays.contains(reasons, NilReason.TEMPLATE));
-        assertTrue(Arrays.contains(reasons, NilReason.MISSING));
-        assertTrue(Arrays.contains(reasons, other));
+        assertTrue(ArraysExt.contains(reasons, NilReason.TEMPLATE));
+        assertTrue(ArraysExt.contains(reasons, NilReason.MISSING));
+        assertTrue(ArraysExt.contains(reasons, other));
     }
 
     /**



Mime
View raw message