1) Fixed issue #844: Short form of ternary operator (since PHP 5.3).
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / compiler / CharOperation.java
index 75fe787..13acddc 100644 (file)
@@ -179,19 +179,19 @@ public final class CharOperation {
         * @return the concatenation of the two arrays, or null if the two arrays
         *         are null.
         */
-       public static final char[][] arrayConcat(char[][] first, char[][] second) {
-               if (first == null)
-                       return second;
-               if (second == null)
-                       return first;
-
-               int length1 = first.length;
-               int length2 = second.length;
-               char[][] result = new char[length1 + length2][];
-               System.arraycopy(first, 0, result, 0, length1);
-               System.arraycopy(second, 0, result, length1, length2);
-               return result;
-       }
+//     public static final char[][] arrayConcat(char[][] first, char[][] second) {
+//             if (first == null)
+//                     return second;
+//             if (second == null)
+//                     return first;
+//
+//             int length1 = first.length;
+//             int length2 = second.length;
+//             char[][] result = new char[length1 + length2][];
+//             System.arraycopy(first, 0, result, 0, length1);
+//             System.arraycopy(second, 0, result, length1, length2);
+//             return result;
+//     }
 
        /**
         * Answers a new array adding the second array at the end of first array. It
@@ -638,34 +638,34 @@ public final class CharOperation {
         *         separator between each part and appending the given name at the
         *         end
         */
-       public static final char[] concatWith(char[] name, char[][] array,
-                       char separator) {
-               int nameLength = name == null ? 0 : name.length;
-               if (nameLength == 0)
-                       return concatWith(array, separator);
-
-               int length = array == null ? 0 : array.length;
-               if (length == 0)
-                       return name;
-
-               int size = nameLength;
-               int index = length;
-               while (--index >= 0)
-                       if (array[index].length > 0)
-                               size += array[index].length + 1;
-               char[] result = new char[size];
-               index = size;
-               for (int i = length - 1; i >= 0; i--) {
-                       int subLength = array[i].length;
-                       if (subLength > 0) {
-                               index -= subLength;
-                               System.arraycopy(array[i], 0, result, index, subLength);
-                               result[--index] = separator;
-                       }
-               }
-               System.arraycopy(name, 0, result, 0, nameLength);
-               return result;
-       }
+//     public static final char[] concatWith(char[] name, char[][] array,
+//                     char separator) {
+//             int nameLength = name == null ? 0 : name.length;
+//             if (nameLength == 0)
+//                     return concatWith(array, separator);
+//
+//             int length = array == null ? 0 : array.length;
+//             if (length == 0)
+//                     return name;
+//
+//             int size = nameLength;
+//             int index = length;
+//             while (--index >= 0)
+//                     if (array[index].length > 0)
+//                             size += array[index].length + 1;
+//             char[] result = new char[size];
+//             index = size;
+//             for (int i = length - 1; i >= 0; i--) {
+//                     int subLength = array[i].length;
+//                     if (subLength > 0) {
+//                             index -= subLength;
+//                             System.arraycopy(array[i], 0, result, index, subLength);
+//                             result[--index] = separator;
+//                     }
+//             }
+//             System.arraycopy(name, 0, result, 0, nameLength);
+//             return result;
+//     }
 
        /**
         * Answers the concatenation of the given array parts using the given
@@ -844,15 +844,15 @@ public final class CharOperation {
         * @return true if the array contains an occurrence of character, false
         *         otherwise.
         */
-       public static final boolean contains(char character, char[][] array) {
-               for (int i = array.length; --i >= 0;) {
-                       char[] subarray = array[i];
-                       for (int j = subarray.length; --j >= 0;)
-                               if (subarray[j] == character)
-                                       return true;
-               }
-               return false;
-       }
+//     public static final boolean contains(char character, char[][] array) {
+//             for (int i = array.length; --i >= 0;) {
+//                     char[] subarray = array[i];
+//                     for (int j = subarray.length; --j >= 0;)
+//                             if (subarray[j] == character)
+//                                     return true;
+//             }
+//             return false;
+//     }
 
        /**
         * Answers true if the array contains an occurrence of character, false
@@ -1090,24 +1090,24 @@ public final class CharOperation {
         * @return true if the two arrays are identical character by character
         *         according to the value of isCaseSensitive, otherwise false
         */
-       public static final boolean equals(char[][] first, char[][] second,
-                       boolean isCaseSensitive) {
-
-               if (isCaseSensitive) {
-                       return equals(first, second);
-               }
-               if (first == second)
-                       return true;
-               if (first == null || second == null)
-                       return false;
-               if (first.length != second.length)
-                       return false;
-
-               for (int i = first.length; --i >= 0;)
-                       if (!equals(first[i], second[i], false))
-                               return false;
-               return true;
-       }
+//     public static final boolean equals(char[][] first, char[][] second,
+//                     boolean isCaseSensitive) {
+//
+//             if (isCaseSensitive) {
+//                     return equals(first, second);
+//             }
+//             if (first == second)
+//                     return true;
+//             if (first == null || second == null)
+//                     return false;
+//             if (first.length != second.length)
+//                     return false;
+//
+//             for (int i = first.length; --i >= 0;)
+//                     if (!equals(first[i], second[i], false))
+//                             return false;
+//             return true;
+//     }
 
        /**
         * Answers true if the two arrays are identical character by character,
@@ -2181,13 +2181,13 @@ public final class CharOperation {
         * @exception ArrayIndexOutOfBoundsException
         *                if start is lower than 0
         */
-       public static final int occurencesOf(char toBeFound, char[] array, int start) {
-               int count = 0;
-               for (int i = start; i < array.length; i++)
-                       if (toBeFound == array[i])
-                               count++;
-               return count;
-       }
+//     public static final int occurencesOf(char toBeFound, char[] array, int start) {
+//             int count = 0;
+//             for (int i = start; i < array.length; i++)
+//                     if (toBeFound == array[i])
+//                             count++;
+//             return count;
+//     }
 
        /**
         * Answers true if the given name starts with the given prefix, false
@@ -2277,27 +2277,27 @@ public final class CharOperation {
         * @exception NullPointerException
         *                if the given name is null or if the given prefix is null
         */
-       public static final boolean prefixEquals(char[] prefix, char[] name,
-                       boolean isCaseSensitive) {
-
-               int max = prefix.length;
-               if (name.length < max)
-                       return false;
-               if (isCaseSensitive) {
-                       for (int i = max; --i >= 0;)
-                               // assumes the prefix is not larger than the name
-                               if (prefix[i] != name[i])
-                                       return false;
-                       return true;
-               }
-
-               for (int i = max; --i >= 0;)
-                       // assumes the prefix is not larger than the name
-                       if (Character.toLowerCase(prefix[i]) != Character
-                                       .toLowerCase(name[i]))
-                               return false;
-               return true;
-       }
+//     public static final boolean prefixEquals(char[] prefix, char[] name,
+//                     boolean isCaseSensitive) {
+//
+//             int max = prefix.length;
+//             if (name.length < max)
+//                     return false;
+//             if (isCaseSensitive) {
+//                     for (int i = max; --i >= 0;)
+//                             // assumes the prefix is not larger than the name
+//                             if (prefix[i] != name[i])
+//                                     return false;
+//                     return true;
+//             }
+//
+//             for (int i = max; --i >= 0;)
+//                     // assumes the prefix is not larger than the name
+//                     if (Character.toLowerCase(prefix[i]) != Character
+//                                     .toLowerCase(name[i]))
+//                             return false;
+//             return true;
+//     }
 
        /**
         * Replace all occurrence of the character to be replaced with the