|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnom.tam.util.ArrayFuncs
public class ArrayFuncs
This is a package of static functions which perform computations on arrays. Generally these routines attempt to complete without throwing errors by ignoring data they cannot understand.
Constructor Summary | |
---|---|
ArrayFuncs()
|
Method Summary | |
---|---|
static String |
arrayDescription(Object o)
Generate a description of an array (presumed rectangular). |
static int |
computeSize(Object o)
Compute the size of an object. |
static Object |
convertArray(Object array,
Class newType)
Convert an array to a specified type. |
static void |
copyArray(Object original,
Object copy)
Copy one array into another. |
static Object |
curl(Object input,
int[] dimens)
Curl an input array up into a multi-dimensional array. |
static Object |
deepClone(Object o)
Try to create a deep clone of an Array or a standard clone of a scalar. |
protected static int |
doCurl(Object input,
Object output,
int[] dimens,
int offset)
Do the curling of the 1-d to multi-d array. |
protected static int |
doFlatten(Object input,
Object output,
int offset)
This routine does the actually flattening of multi-dimensional arrays. |
static void |
examinePrimitiveArray(Object o)
Examine the structure of an array in detail. |
static Object |
flatten(Object input)
Given an array of arbitrary dimensionality return the array flattened into a single dimension. |
static Object |
generateArray(Class baseType,
int[] dims)
Create an array and populate it with a test pattern. |
static Object |
genericClone(Object o)
Clone an Object if possible. |
static Class |
getBaseClass(Object o)
This routine returns the base class of an object. |
static int |
getBaseLength(Object o)
This routine returns the size of the base element of an array. |
static int[] |
getDimensions(Object o)
Find the dimensions of an object. |
static void |
main(String[] args)
Test and demonstrate the ArrayFuncs methods. |
static byte |
testPattern(Object o,
byte start)
Just create a simple pattern cycling through valid byte values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayFuncs()
Method Detail |
---|
public static int computeSize(Object o)
o
- The object whose size is desired.public static Object deepClone(Object o)
o
- The object to be copied.public static Object genericClone(Object o)
o
- The object to be cloned.public static void copyArray(Object original, Object copy)
original
- The array to be copied.copy
- The array to be copied into. This
array must already be fully allocated.public static int[] getDimensions(Object o)
o
- The object to get the dimensions of.public static Class getBaseClass(Object o)
public static int getBaseLength(Object o)
o
- The array object whose base length is desired.
public static Object generateArray(Class baseType, int[] dims)
baseType
- The base type of the array. This is expected to
be a numeric type, but this is not checked.dims
- The desired dimensions.
public static byte testPattern(Object o, byte start)
o
- The array in which the test pattern is to be set.start
- The value for the first element.public static String arrayDescription(Object o)
o
- The array to be described.public static void examinePrimitiveArray(Object o)
o
- The array to be examined.public static Object flatten(Object input)
input
- The input array.protected static int doFlatten(Object input, Object output, int offset)
input
- The input array to be flattened.output
- The flattened array.offset
- The current offset within the output array.
public static Object curl(Object input, int[] dimens)
input
- The one dimensional array to be curled.dimens
- The desired dimensions
protected static int doCurl(Object input, Object output, int[] dimens, int offset)
input
- The 1-d array to be curled.output
- The multi-dimensional array to be filled.dimens
- The desired output dimensions.offset
- The current offset in the input array.
public static Object convertArray(Object array, Class newType)
array
- A possibly multidimensional array to be converted.newType
- The desired output type. This should be one of the
class descriptors for primitive numeric data, e.g., double.type.public static void main(String[] args)
args
- Unused.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |