org.netbeans.modules.editor.util/1 1.26

org.netbeans.lib.editor.util
Class ArrayUtilities

java.lang.Object
  extended by org.netbeans.lib.editor.util.ArrayUtilities

public final class ArrayUtilities
extends Object

Utility methods related to arrays.


Method Summary
static void appendBracketedIndex(StringBuffer sb, int index, int maxDigitCount)
           
static void appendBracketedIndex(StringBuilder sb, int index, int maxDigitCount)
           
static void appendIndex(StringBuffer sb, int index, int maxDigitCount)
           
static void appendIndex(StringBuilder sb, int index, int maxDigitCount)
           
static void appendSpaces(StringBuffer sb, int spaceCount)
           
static void appendSpaces(StringBuilder sb, int spaceCount)
           
static int binarySearch(int[] array, int key)
          Searches for the key in the array.
static int binarySearch(int[] array, int start, int end, int key)
          Searches for the key in the array in the area between start and end.
static boolean[] booleanArray(boolean[] oldArray)
           
static boolean[] booleanArray(boolean[] oldArray, int newSize)
           
static boolean[] booleanArray(boolean[] oldArray, int newSize, int copyLen, boolean forwardFill)
           
static char[] charArray(char[] oldArray)
           
static char[] charArray(char[] oldArray, int newSize)
           
static char[] charArray(char[] oldArray, int newSize, int copyLen, boolean forwardFill)
           
static char[] charArray(char[] oldArray, int newSize, int gapStart, int gapLength)
           
static int digitCount(int number)
           
static boolean[] emptyBooleanArray()
           
static char[] emptyCharArray()
           
static int[] emptyIntArray()
           
static int[] intArray(int[] oldArray)
           
static int[] intArray(int[] oldArray, int newSize)
           
static int[] intArray(int[] oldArray, int newSize, int copyLen, boolean forwardFill)
           
static int[] intArray(int[] oldArray, int newSize, int gapStart, int gapLength)
           
static String toString(int[] array)
           
static String toString(Object[] array)
           
static
<E> List<E>
unmodifiableList(E[] array)
          Return unmodifiable list for the given array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

booleanArray

public static boolean[] booleanArray(boolean[] oldArray)

booleanArray

public static boolean[] booleanArray(boolean[] oldArray,
                                     int newSize)

booleanArray

public static boolean[] booleanArray(boolean[] oldArray,
                                     int newSize,
                                     int copyLen,
                                     boolean forwardFill)

charArray

public static char[] charArray(char[] oldArray)

charArray

public static char[] charArray(char[] oldArray,
                               int newSize)

charArray

public static char[] charArray(char[] oldArray,
                               int newSize,
                               int copyLen,
                               boolean forwardFill)

charArray

public static char[] charArray(char[] oldArray,
                               int newSize,
                               int gapStart,
                               int gapLength)

intArray

public static int[] intArray(int[] oldArray)

intArray

public static int[] intArray(int[] oldArray,
                             int newSize)

intArray

public static int[] intArray(int[] oldArray,
                             int newSize,
                             int copyLen,
                             boolean forwardFill)

intArray

public static int[] intArray(int[] oldArray,
                             int newSize,
                             int gapStart,
                             int gapLength)

emptyBooleanArray

public static boolean[] emptyBooleanArray()

emptyCharArray

public static char[] emptyCharArray()

emptyIntArray

public static int[] emptyIntArray()

digitCount

public static int digitCount(int number)

appendIndex

public static void appendIndex(StringBuilder sb,
                               int index,
                               int maxDigitCount)

appendIndex

public static void appendIndex(StringBuffer sb,
                               int index,
                               int maxDigitCount)

appendSpaces

public static void appendSpaces(StringBuilder sb,
                                int spaceCount)

appendSpaces

public static void appendSpaces(StringBuffer sb,
                                int spaceCount)

appendBracketedIndex

public static void appendBracketedIndex(StringBuilder sb,
                                        int index,
                                        int maxDigitCount)

appendBracketedIndex

public static void appendBracketedIndex(StringBuffer sb,
                                        int index,
                                        int maxDigitCount)

unmodifiableList

public static <E> List<E> unmodifiableList(E[] array)
Return unmodifiable list for the given array.
Unlike Collections.unmodifiableList() this method does not use any extra wrappers etc.

Since:
1.14

toString

public static String toString(Object[] array)

toString

public static String toString(int[] array)

binarySearch

public static int binarySearch(int[] array,
                               int key)
Searches for the key in the array.

Parameters:
array - the array to search in
key - the number to search for
Returns:
The index of the key in the array. For details see binarySearch(int[], int, int, int).
Since:
1.18

binarySearch

public static int binarySearch(int[] array,
                               int start,
                               int end,
                               int key)
Searches for the key in the array in the area between start and end.

Parameters:
array - the array to search in
start - the first index to look at
end - the last index to look at
key - the number to search for
Returns:
The index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or array.length, if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.
Since:
1.18

org.netbeans.modules.editor.util/1 1.26

Built on December 3 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.