Static Public Member Functions

cern.gp.util.ArrayUtil Class Reference

List of all members.

Static Public Member Functions

static Object concatArrays (final Object[] one, final Object[] two, Class componentType)
static Object concatArrays (final Object[] one, final Object[] two, final Object[] three, Class componentType)
static Object concatArrays (final Object[][] origMatrix)
static Object concatArrays (final Object[][] origMatrix, final int totalLength)
static void printArray (final Object[] array, int indent)
static String toString (final Object[] array, int indent, boolean oneLine, boolean numbered)
static Object pruneNullElements (Object[] array)
static Object pruneNullElements (Object[] array, boolean onlyAtEnd)
static boolean allElementsSameType (Object[] array)
static void sleep (long millis)

Detailed Description

Utility methods for manipulating and displaying Arrays

Author:
Vito Baggiolini
Version:
Revision:
1.2
Date:
2006/09/25 08:52:36

Member Function Documentation

static boolean cern.gp.util.ArrayUtil.allElementsSameType ( Object[]  array  )  [static]

An utility method that checks whether all the elements in the array are of the same type it returns false if the array contains a mix of classes and sub-classes of the Array component type.

Parameters:
array the array to be checked
Returns:
true if all array elements are of the same class
static Object cern.gp.util.ArrayUtil.concatArrays ( final Object[]  one,
final Object[]  two,
Class  componentType 
) [static]

An utility method that concatenates two arrays to one

Parameters:
one the first array
two the second array
componentType the class of the component of the array to be returned
Returns:
an array of type componentType with the concatenation of the two arrays
static Object cern.gp.util.ArrayUtil.concatArrays ( final Object[]  one,
final Object[]  two,
final Object[]  three,
Class  componentType 
) [static]

An utility method that concatenates three arrays to one

Parameters:
one the first array
two the second array
three the third array
componentType the class of the component of the array to be returned
Returns:
an array of type componentType with the concatenation of the two arrays
static Object cern.gp.util.ArrayUtil.concatArrays ( final Object  origMatrix[][],
final int  totalLength 
) [static]

An utility method that concatenates many arrays to one. The type of the returned array are derived from the type of the origMatrix parameter, the length is specified.

Parameters:
origMatrix an array of arrays (a Matrix), can contain null elements
totalLength the length of the resulting array, must be large enough
Returns:
an array with the concatenated values
static Object cern.gp.util.ArrayUtil.concatArrays ( final Object  origMatrix[][]  )  [static]

An utility method that concatenates many arrays to one. The type and the length of the returned array are derived from the type of the origMatrix parameter

Parameters:
origMatrix an array of arrays (a Matrix)
Returns:
an array with the concatenated values
static void cern.gp.util.ArrayUtil.printArray ( final Object[]  array,
int  indent 
) [static]

utility method, prints out an array using the toString() method of the members.

Parameters:
array can be null
indent the level of indents (tabs) that precede the output, can be negative
static Object cern.gp.util.ArrayUtil.pruneNullElements ( Object[]  array,
boolean  onlyAtEnd 
) [static]

prunes the null elements at the tail of an array. In the present implementation, onlyAtEnd must be true

Parameters:
array the array to be pruned
onlyAtEnd -- must be true
static Object cern.gp.util.ArrayUtil.pruneNullElements ( Object[]  array  )  [static]

A utility method that cuts off null-elements at the end of an array.

Returns:
a new array with only the non-null elements and the corresponding length
static void cern.gp.util.ArrayUtil.sleep ( long  millis  )  [static]

Utility method, sleeps for the indicated millis. Useful because it can be called in user programs without need to code the try/catch clauses.

Parameters:
millis the milliseconds to sleep
static String cern.gp.util.ArrayUtil.toString ( final Object[]  array,
int  indent,
boolean  oneLine,
boolean  numbered 
) [static]

utility method, transforms the array into a String that can either be multi-line or on one line.

Parameters:
array the array to be transformed, can be null
indent the number of tabs to be used for indenting
oneLine if true, a String containing a single line is returned, if false, return characters ("\n") are integrated into the returned string.
numbered if true, each element is preceded by its index in the array
Returns:
a string with the array contents, formated as requested

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties