public final class ArrayUtil
extends java.lang.Object
Constructor and Description |
---|
ArrayUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean[] |
arrayCopyBool(boolean[] array,
int newLength) |
static byte[] |
arrayCopyByte(byte[] array,
int newLength) |
static float[] |
arrayCopyF(float[] array,
int newLength) |
static int[] |
arrayCopyI(int[] array,
int newLength) |
static int[][] |
arrayCopyII(int[][] array,
int newLength) |
static java.lang.Object |
arrayCopyObject(java.lang.Object array,
int newLength)
note -- cannot copy if array is null!
|
static P3[] |
arrayCopyPt(P3[] array,
int newLength) |
static int[] |
arrayCopyRangeI(int[] array,
int i0,
int n)
a specialized method that allows copying from a starting point either
to the end or to the middle (color schemes, especially)
|
static int[] |
arrayCopyRangeRevI(int[] array,
int i0,
int n) |
static java.lang.String[] |
arrayCopyS(java.lang.String[] array,
int newLength) |
static short[] |
arrayCopyShort(short[] array,
int newLength) |
static <T> JmolList<T>[] |
createArrayOfArrayList(int size)
Helper method for creating a JmolList
|
static <K,V> java.util.Map<K,V>[] |
createArrayOfHashtable(int size)
Helper method for creating a Map
|
static java.lang.Object |
deleteElements(java.lang.Object array,
int firstElement,
int nElements) |
static java.lang.Object |
doubleLength(java.lang.Object array)
Very important that this not be used with Int32Array or Float32Array,
because it is not initialized to all zeros in MSIE 9.
|
static boolean[] |
doubleLengthBool(boolean[] array) |
static byte[] |
doubleLengthByte(byte[] array) |
static float[] |
doubleLengthF(float[] array) |
static int[] |
doubleLengthI(int[] array) |
static java.lang.String[] |
doubleLengthS(java.lang.String[] array) |
static short[] |
doubleLengthShort(short[] array) |
static java.lang.String |
dumpArray(java.lang.String msg,
float[][] A,
int x1,
int x2,
int y1,
int y2) |
static java.lang.String |
dumpIntArray(int[] A,
int n) |
static java.lang.Object |
ensureLength(java.lang.Object array,
int minimumLength)
Very important that this not be used with Int32Array or Float32Array,
because it is not initialized to all zeros in MSIE 9.
|
static float[] |
ensureLengthA(float[] array,
int minimumLength) |
static byte[] |
ensureLengthByte(byte[] array,
int minimumLength) |
static int[] |
ensureLengthI(int[] array,
int minimumLength) |
static java.lang.String[] |
ensureLengthS(java.lang.String[] array,
int minimumLength) |
static short[] |
ensureLengthShort(short[] array,
int minimumLength) |
private static int |
getLength(java.lang.Object array) |
static byte[][] |
newByte2(int n) |
static double[][] |
newDouble2(int n) |
static float[][] |
newFloat2(int n) |
static float[][][] |
newFloat3(int nx,
int ny) |
private static java.lang.Object |
newInstanceO(java.lang.Object array,
int n)
Very important that this not be used with Int32Array or Float32Array,
because those need to be initialized to all zeros in MSIE 9, and
MSIE 9 cannot distinguish Int32Array or Float32Array from Array.
|
static int[][] |
newInt2(int n) |
static int[][][] |
newInt3(int nx,
int ny) |
static int[][][][] |
newInt4(int n) |
static short[][] |
newShort2(int n) |
static java.lang.String |
sortedItem(JmolList<java.lang.String> v,
int n) |
static void |
swap(java.lang.Object[] o,
int i,
int j) |
static void |
swapInt(int[] array,
int indexA,
int indexB) |
public static java.lang.Object ensureLength(java.lang.Object array, int minimumLength)
array
- minimumLength
- public static java.lang.String[] ensureLengthS(java.lang.String[] array, int minimumLength)
public static float[] ensureLengthA(float[] array, int minimumLength)
public static int[] ensureLengthI(int[] array, int minimumLength)
public static short[] ensureLengthShort(short[] array, int minimumLength)
public static byte[] ensureLengthByte(byte[] array, int minimumLength)
public static java.lang.Object doubleLength(java.lang.Object array)
array
- public static java.lang.String[] doubleLengthS(java.lang.String[] array)
public static float[] doubleLengthF(float[] array)
public static int[] doubleLengthI(int[] array)
public static short[] doubleLengthShort(short[] array)
public static byte[] doubleLengthByte(byte[] array)
public static boolean[] doubleLengthBool(boolean[] array)
public static java.lang.Object deleteElements(java.lang.Object array, int firstElement, int nElements)
public static java.lang.Object arrayCopyObject(java.lang.Object array, int newLength)
array
- newLength
- private static java.lang.Object newInstanceO(java.lang.Object array, int n)
array
- n
- private static int getLength(java.lang.Object array)
public static java.lang.String[] arrayCopyS(java.lang.String[] array, int newLength)
public static int[][] arrayCopyII(int[][] array, int newLength)
public static float[] arrayCopyF(float[] array, int newLength)
public static int[] arrayCopyI(int[] array, int newLength)
public static int[] arrayCopyRangeI(int[] array, int i0, int n)
array
- i0
- n
- public static int[] arrayCopyRangeRevI(int[] array, int i0, int n)
public static short[] arrayCopyShort(short[] array, int newLength)
public static byte[] arrayCopyByte(byte[] array, int newLength)
public static boolean[] arrayCopyBool(boolean[] array, int newLength)
public static void swapInt(int[] array, int indexA, int indexB)
public static java.lang.String dumpArray(java.lang.String msg, float[][] A, int x1, int x2, int y1, int y2)
public static java.lang.String dumpIntArray(int[] A, int n)
public static java.lang.String sortedItem(JmolList<java.lang.String> v, int n)
public static <T> JmolList<T>[] createArrayOfArrayList(int size)
T
- Type of objects in the list.size
- Array size.public static <K,V> java.util.Map<K,V>[] createArrayOfHashtable(int size)
K
- Type of object for the keys in the map.V
- Type of object for the values in the map.size
- Array size.public static void swap(java.lang.Object[] o, int i, int j)
public static float[][] newFloat2(int n)
public static int[][] newInt2(int n)
public static int[][][] newInt3(int nx, int ny)
public static float[][][] newFloat3(int nx, int ny)
public static int[][][][] newInt4(int n)
public static short[][] newShort2(int n)
public static byte[][] newByte2(int n)
public static double[][] newDouble2(int n)