|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.util.ArrayUtil
public class ArrayUtil
Provides static utility methods to resize and test arrays.
Method Summary | ||
---|---|---|
static boolean |
allDifferent(byte... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static boolean |
allDifferent(double... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static boolean |
allDifferent(float... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static boolean |
allDifferent(int... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static boolean |
allDifferent(long... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static boolean |
allDifferent(short... a)
Determines if the elements in the array a are all different, and returns the result of the test. |
|
static void |
checkRectangularMatrix(Object m)
Determines if the given object m is a rectangular matrix. |
|
static double[][] |
copy(double[][] M)
Copies the array M and returns the copy. |
|
static
|
deepClone(T array)
Equivalent to boolean) deepClone (array, false)
. |
|
static
|
deepClone(T array,
boolean cloneElements)
Constructs and returns a deep clone of the array array. |
|
static int |
getMinDigits(double... a)
Returns the minimal number of digits after the decimal point required for the numbers in the array a to be rounded without different values becoming equal. |
|
static int |
getMinDigits(float... a)
Returns the minimal number of digits after the decimal point required for the numbers in the array a to be rounded without different values becoming equal. |
|
static boolean[][] |
getTranspose(boolean[][] m)
Returns the transpose of a matrix m. |
|
static byte[][] |
getTranspose(byte[][] m)
Returns the transpose of a matrix m. |
|
static char[][] |
getTranspose(char[][] m)
Returns the transpose of a matrix m. |
|
static double[][] |
getTranspose(double[][] m)
Returns the transpose of a matrix m. |
|
static float[][] |
getTranspose(float[][] m)
Returns the transpose of a matrix m. |
|
static int[][] |
getTranspose(int[][] m)
Returns the transpose of a matrix m. |
|
static long[][] |
getTranspose(long[][] m)
Returns the transpose of a matrix m. |
|
static short[][] |
getTranspose(short[][] m)
Returns the transpose of a matrix m. |
|
static
|
getTranspose(T[][] m)
Returns the transpose of a matrix m. |
|
static byte |
max(byte... a)
Returns the value of the greatest element in the array a. |
|
static double |
max(double... a)
Returns the value of the greatest element in the array a. |
|
static float |
max(float... a)
Returns the value of the greatest element in the array a. |
|
static int |
max(int... a)
Returns the value of the greatest element in the array a. |
|
static long |
max(long... a)
Returns the value of the greatest element in the array a. |
|
static short |
max(short... a)
Returns the value of the greatest element in the array a. |
|
static
|
max(T... a)
Returns the value of the greatest element in the array a. |
|
static boolean[] |
merge(boolean[]... arrays)
|
|
static byte[] |
merge(byte[]... arrays)
|
|
static char[] |
merge(char[]... arrays)
|
|
static double[] |
merge(double[]... arrays)
|
|
static float[] |
merge(float[]... arrays)
|
|
static int[] |
merge(int[]... arrays)
Merges the given arrays into a single array, and returned the constructed array. |
|
static long[] |
merge(long[]... arrays)
|
|
static short[] |
merge(short[]... arrays)
|
|
static
|
merge(T[]... arrays)
|
|
static byte |
min(byte... a)
Returns the value of the smallest element in the array a. |
|
static double |
min(double... a)
Returns the value of the smallest element in the array a. |
|
static float |
min(float... a)
Returns the value of the smallest element in the array a. |
|
static int |
min(int... a)
Returns the value of the smallest element in the array a. |
|
static long |
min(long... a)
Returns the value of the smallest element in the array a. |
|
static short |
min(short... a)
Returns the value of the smallest element in the array a. |
|
static
|
min(T... a)
Returns the value of the smallest element in the array a. |
|
static boolean[] |
resizeArray(boolean[] oldArray,
int newLength)
|
|
static byte[] |
resizeArray(byte[] oldArray,
int newLength)
|
|
static char[] |
resizeArray(char[] oldArray,
int newLength)
|
|
static double[][] |
resizeArray(double[][] oldArray,
int newRowLen,
int newColLen,
double x)
Resize array oldArray to newRowLen rows and newColLen columns. |
|
static double[] |
resizeArray(double[] oldArray,
int newLength)
|
|
static float[] |
resizeArray(float[] oldArray,
int newLength)
|
|
static int[][] |
resizeArray(int[][] oldArray,
int newRowLen,
int newColLen)
Resize array oldArray to newRowLen rows and newColLen columns. |
|
static int[] |
resizeArray(int[] oldArray,
int newLength)
|
|
static long[] |
resizeArray(long[] oldArray,
int newLength)
|
|
static short[] |
resizeArray(short[] oldArray,
int newLength)
|
|
static
|
resizeArray(T[] oldArray,
int newLength)
Resizes an array oldArray to the length newLength, and returns a reference to an array with the appropriate length. |
|
static double[][] |
resizeRow(double[][] array,
int row,
int len)
Resize row row of array array to have len elements. |
|
static int[][] |
resizeRow(int[][] array,
int row,
int len)
Resize row row of array array to have len elements. |
|
static double[] |
round(int maxDigits,
double... a)
Roudns each number in a to maxDigits digits. |
|
static float[] |
round(int maxDigits,
float... a)
Roudns each number in a to maxDigits digits. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static byte[] resizeArray(byte[] oldArray, int newLength)
public static short[] resizeArray(short[] oldArray, int newLength)
public static int[] resizeArray(int[] oldArray, int newLength)
public static int[][] resizeArray(int[][] oldArray, int newRowLen, int newColLen)
oldArray
- old arraynewRowLen
- new number of rowsnewColLen
- new number of columns
public static int[][] resizeRow(int[][] array, int row, int len)
Returns a reference to the resized array.
array
- old arrayrow
- row indexlen
- new length of row row
public static long[] resizeArray(long[] oldArray, int newLength)
public static char[] resizeArray(char[] oldArray, int newLength)
public static boolean[] resizeArray(boolean[] oldArray, int newLength)
public static float[] resizeArray(float[] oldArray, int newLength)
public static double[] resizeArray(double[] oldArray, int newLength)
public static double[][] resizeArray(double[][] oldArray, int newRowLen, int newColLen, double x)
oldArray
- old arraynewRowLen
- new number of rowsnewColLen
- new number of columnsx
- default value of the new elements
public static double[][] resizeRow(double[][] array, int row, int len)
Returns a reference to the resized array.
array
- old arrayrow
- row indexlen
- new length of row row
public static <T> T[] resizeArray(T[] oldArray, int newLength)
System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)
. If
the new length is smaller than the old length, the last elements of the
array are lost. If the new length is greater than the old length, new
elements having the default value (null, 0, or
false, depending on the type of array) are appended to the array.
oldArray
- the old array to be resized.newLength
- the required length of the returned array.
NullPointerException
- if oldArray is null.
IllegalArgumentException
- if oldArray does not correspond to an array.
NegativeArraySizeException
- if newLength is negative.public static void checkRectangularMatrix(Object m)
m
- the object to be tested.
NullPointerException
- if m or one of its elements are null.
IllegalArgumentException
- if the object is not a rectangular matrix.public static <T> T deepClone(T array, boolean cloneElements)
If cloneElements is true, the elements in the given
array must be arrays, primitive elements, or objects implementing the
Cloneable
interface.
This method is equivalent to array.clone() if the given array is one-dimensional, and cloneElements is false.
T
- the type of the array.array
- the array to clone.cloneElements
- determines if elements in the array are cloned.
IllegalArgumentException
- if the class of the given object is not an array.public static <T> T deepClone(T array)
boolean) deepClone (array, false)
.
T
- the type of the array.array
- the array to clone.
public static byte[][] getTranspose(byte[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static short[][] getTranspose(short[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static int[][] getTranspose(int[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static long[][] getTranspose(long[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static float[][] getTranspose(float[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static double[][] getTranspose(double[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static char[][] getTranspose(char[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static boolean[][] getTranspose(boolean[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static <T> T[][] getTranspose(T[][] m)
m
- the matrix to be transposed.
NullPointerException
- if m is null, or m[i] is
null for at least one index i.public static byte min(byte... a)
a
- the tested array.
public static short min(short... a)
a
- the tested array.
public static int min(int... a)
a
- the tested array.
public static long min(long... a)
a
- the tested array.
public static float min(float... a)
a
- the tested array.
public static double min(double... a)
a
- the tested array.
public static <T extends Comparable<T>> T min(T... a)
a
- the tested array.
public static byte max(byte... a)
a
- the tested array.
public static short max(short... a)
a
- the tested array.
public static int max(int... a)
a
- the tested array.
public static long max(long... a)
a
- the tested array.
public static float max(float... a)
a
- the tested array.
public static double max(double... a)
a
- the tested array.
public static <T extends Comparable<T>> T max(T... a)
a
- the tested array.
public static boolean allDifferent(byte... a)
a
- the tested array.
public static boolean allDifferent(short... a)
a
- the tested array.
public static boolean allDifferent(int... a)
a
- the tested array.
public static boolean allDifferent(long... a)
a
- the tested array.
public static boolean allDifferent(float... a)
a
- the tested array.
public static boolean allDifferent(double... a)
a
- the tested array.
public static float[] round(int maxDigits, float... a)
maxDigits
- the maximal number of digits.a
- the array.
public static double[] round(int maxDigits, double... a)
maxDigits
- the maximal number of digits.a
- the array.
public static int getMinDigits(float... a)
a
- the tested array.
public static int getMinDigits(double... a)
a
- the tested array.
public static int[] merge(int[]... arrays)
arrays
- the arrays to be merged together.
public static byte[] merge(byte[]... arrays)
public static short[] merge(short[]... arrays)
public static long[] merge(long[]... arrays)
public static float[] merge(float[]... arrays)
public static double[] merge(double[]... arrays)
public static char[] merge(char[]... arrays)
public static boolean[] merge(boolean[]... arrays)
public static <T> T[] merge(T[]... arrays)
public static double[][] copy(double[][] M)
M
-
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |