public final class ArrayFuncs extends Object
Modifier and Type | Method and Description |
---|---|
static String |
arrayDescription(Object o) |
static long |
computeLSize(Object o) |
static int |
computeSize(Object o)
Deprecated.
May silently underestimate the size if the size > 2 GB.
|
static Object |
convertArray(Object array,
Class<?> newType) |
static Object |
convertArray(Object array,
Class<?> newType,
boolean reuse) |
static void |
copyArray(Object original,
Object copy)
Copy one array into another.
|
static void |
copyInto(Object array,
Object mimic)
Copy an array into an array of a different type.
|
static Object |
curl(Object input,
int[] dimens)
Curl an input array up into a multi-dimensional array.
|
static Object |
deepClone(Object o) |
static Object |
flatten(Object input)
Given an array of arbitrary dimensionality .
|
static Object |
genericClone(Object o)
Clone an Object if possible.
|
static Object |
getBaseArray(Object o)
This routine returns the base array of a multi-dimensional array.
|
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 Object |
mimicArray(Object array,
Class<?> newType)
Create an array of a type given by new type with the dimensionality given
in array.
|
static int |
nElements(Object o)
Deprecated.
May silently underestimate size if number is > 2 G.
|
static Object |
newInstance(Class<?> cl,
int dim)
Allocate an array dynamically.
|
static Object |
newInstance(Class<?> cl,
int[] dims)
Allocate an array dynamically.
|
static long |
nLElements(Object o)
Deprecated.
May silently underestimate size if number is > 2 G.
|
static int[] |
reverseIndices(int[] indices)
Reverse an integer array.
|
public static String arrayDescription(Object o)
o
- The array to be described.public static long computeLSize(Object o)
@Deprecated public static int computeSize(Object o)
o
- The object whose size is desired.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 Object convertArray(Object array, Class<?> newType, boolean reuse)
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.reuse
- If set, and the requested type is the same as the original,
then the original is returned.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 void copyInto(Object array, Object mimic)
array
- The original array.mimic
- The array mimicking the original.public static Object curl(Object input, int[] dimens)
input
- The one dimensional array to be curled.dimens
- The desired dimensionspublic static Object deepClone(Object o)
o
- The object to be copied.public static Object flatten(Object input)
input
- The input array.public static Object genericClone(Object o)
o
- The object to be cloned.public static Object getBaseArray(Object o)
o
- the multi-dimensional arraypublic static Class<?> getBaseClass(Object o)
o
- array to get the base class frompublic static int getBaseLength(Object o)
o
- The array object whose base length is desired.public static int[] getDimensions(Object o)
int[][][] x = new
int[100][][];
should return [100,-1,-1].o
- The object to get the dimensions of.public static Object mimicArray(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.@Deprecated public static int nElements(Object o)
o
- the array to count the elementspublic static Object newInstance(Class<?> cl, int dim)
cl
- The class of the array.dim
- The dimension of the array.public static Object newInstance(Class<?> cl, int[] dims)
cl
- The class of the array.dims
- The dimensions of the array.@Deprecated public static long nLElements(Object o)
o
- the array to count elements inpublic static int[] reverseIndices(int[] indices)
indices
- the array to reverseCopyright © 1996–2016 nom-tam-fits. All rights reserved.