| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object | +--ncsa.horizon.arrayND.ArrayND
This abstract class provides a standard interface for accessing data in a virtual N-D array, regardless of how it is actually stored. This class does not assume that it has sole possesion of the array storage and therefore can not restrict updates to the data. ArrayND subclasses can store the data in different ways to optimize certain types of access.
The subclass may also implement a particular SingleObjectStorage interface that allows one to get a reference to the actual storage object. This can be used to allow objects to efficiently manipulate the data. The specific interface should specify exactly what that object is.
| Field Summary | |
| java.lang.Class | elemClass
the array element type |
| int[] | size
the size of the array |
| Constructor Summary | |
| ArrayND(java.lang.Object array)
create an array with a copy of this array |
|
| ArrayND(java.lang.Class type,
int[] size)
create an array with default values. |
|
| ArrayND()
create an array whose type and size will be set by the subclass constructor |
|
| Method Summary | |
| void | checkBounds(int[] p)
throw an NDArrayIndexOutOfBoundsException if the given index is out of the bounds of this array. |
| void | checkBounds(int[] p,
int[] sz)
throw an NDArrayIndexOutOfBoundsException if the any index in the given subset is out of the bounds of this array. |
| void | checkBounds(int[] p,
int[] sz,
int[] st)
throw an NDArrayIndexOutOfBoundsException if the any index in the given subset is out of the bounds of this array. |
| void | checkBounds(int[] p,
int xaxis,
int yaxis,
int width,
int height,
int xstride,
int ystride)
throw an NDArrayIndexOutOfBoundsException if the any index in the given 2D subset is out of the bounds of this array. |
| void | checkBounds(int[] p,
int xaxis,
int yaxis,
int width,
int height)
throw an NDArrayIndexOutOfBoundsException if the any index in the given 2D subset is out of the bounds of this array. |
| java.lang.Object | clone()
create a mostly-deep clone of this array (elements of the array are not cloned). |
| static void | copy(java.lang.Object src,
int sstart,
int slen,
java.lang.Object dst,
int dstart,
int dlen,
java.lang.Object defval)
copy values from one 1-D array to another, filling missing values a given default. |
| void | copyInto1DArray(int[] coordinate,
int[] size,
int[] stride,
java.lang.Object array)
copy a subset of the data into a raw, 1-dimensional array. |
| void | copyInto1DArray(int[] coordinate,
int[] size,
java.lang.Object array)
copy a subset of the data into a raw, multidimensional array. |
| void | copyInto2DArray(int xaxis,
int yaxis,
int[] coord,
int width,
int height,
int xstride,
int ystride,
java.lang.Object array)
copy a 2-d subset of the data into a raw, 2-d array. |
| void | copyInto2DArray(int xaxis,
int yaxis,
int[] coord,
int width,
int height,
java.lang.Object array)
copy a 2-d subset of the data into a raw, 2-d array. |
| void | copyIntoArray(int[] coordinate,
int[] size,
int[] stride,
java.lang.Object array)
copy a subset of the data into a raw, multidimensional array |
| void | copyIntoArray(int[] coordinate,
int[] size,
java.lang.Object array)
copy a subset of the data into a raw, multidimensional array |
| java.lang.Object | getArray(int[] coordinate,
int[] size,
int[] stride)
return a multidimensional array containing a subset of the data |
| java.lang.Object | getArray(int[] coordinate,
int[] size)
return a multidimensional array containing a subset of the data |
| java.lang.Object | getArray()
return a copy of the entire array as a multidimensional array |
| static java.lang.Object | get(java.lang.Object array,
int[] index)
return an element from a raw multidimensional array. |
| ArrayND | getArrayND(int[] coordinate,
int[] size,
int[] stride)
return an ArrayND object containing a subset of the array data |
| ArrayND | getArrayND(int[] coordinate,
int[] size)
return a multidimensional array containing a subset of the data |
| static int[] | getArraySize(java.lang.Object array)
calculate the size of a multidimensional array. |
| int | getDimensionality()
return the number of dimensions or axes in this multidimensional array. |
| static int | getDimensionality(java.lang.Object array)
determine the number dimensions covered by an array |
| static int | getDimensionality(java.lang.String classname)
determine the number dimensions covered by an array |
| java.lang.Object | getElement(int[] coordinate)
return an element from the array at a given coordinate. |
| static java.lang.Class | getElementType(java.lang.Object array)
determine the Class of the element of a multi-dimensional array |
| int | getLength(int axis)
return the length of the array along a given axis |
| static char | getNameByPrimitiveClass(java.lang.Class cl)
Converts the numeric Class into a char |
| static java.lang.Class | getPrimitiveClassByName(char c)
|
| int[] | getSize()
return the number of elements along each axis of the array |
| int | getTotalSize()
return the total number of elements in this multidimensional array |
| java.lang.Class | getType()
return the class type of the array elements |
| static void | initialize(java.lang.Object array,
java.lang.Object val)
initialize a 1-D array with a given value |
| static void | initialize(java.lang.Object array,
int start,
int length,
java.lang.Object val)
initialize a 1-D array with a given value |
| static void | set(java.lang.Object array,
int[] index,
java.lang.Object value)
set an element within a raw multidimensional array. |
| void | setElement(int[] coordinate,
java.lang.Object value)
set an element of the array. |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
protected transient java.lang.Class elemClass
protected int[] size
| Constructor Detail |
protected ArrayND(java.lang.Object array)
protected ArrayND(java.lang.Class type,
int[] size)
protected ArrayND()
| Method Detail |
protected static char getNameByPrimitiveClass(java.lang.Class cl)
protected static java.lang.Class getPrimitiveClassByName(char c)
public final java.lang.Class getType()
public final int getDimensionality()
public final int[] getSize()
public final int getTotalSize()
protected final void checkBounds(int[] p)
throws NDArrayIndexOutOfBoundsException
protected final void checkBounds(int[] p,
int[] sz)
throws NDArrayIndexOutOfBoundsException
and
+
p
- origin of subset
sz
- size of subset
protected final void checkBounds(int[] p,
int[] sz,
int[] st)
throws NDArrayIndexOutOfBoundsException
and
+
p
- origin of subset
sz
- size of subset
protected final void checkBounds(int[] p,
int xaxis,
int yaxis,
int width,
int height,
int xstride,
int ystride)
throws NDArrayIndexOutOfBoundsException
and
+
p
- origin of subset
xaxis
- the index of the axis to be copied to the first dimension
yaxis
- the index of the axis to be copied to the second dimension
width
- the size of the array in the first direction
height
- the size of the array in the second direction
xstride
- the sampling to use along the first axis
ystride
- the sampling to use along the second axis
protected final void checkBounds(int[] p,
int xaxis,
int yaxis,
int width,
int height)
throws NDArrayIndexOutOfBoundsException
and
+
p
- origin of subset
xaxis
- the index of the axis to be copied to the first dimension
yaxis
- the index of the axis to be copied to the second dimension
width
- the size of the array in the first direction
height
- the size of the array in the second direction
public final int getLength(int axis)
public abstract java.lang.Object getElement(int[] coordinate)
throws NDArrayIndexOutOfBoundsException
public abstract void setElement(int[] coordinate,
java.lang.Object value)
throws NDArrayIndexOutOfBoundsException
public final java.lang.Object getArray(int[] coordinate,
int[] size,
int[] stride)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
stride
- the sampling along each dimension.
public final java.lang.Object getArray(int[] coordinate,
int[] size)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimensionpublic final java.lang.Object getArray()
public abstract ArrayND getArrayND(int[] coordinate,
int[] size,
int[] stride)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
stride
- the sampling along each dimension.
public abstract ArrayND getArrayND(int[] coordinate,
int[] size)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
public abstract void copyIntoArray(int[] coordinate,
int[] size,
int[] stride,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
stride
- the sampling along each dimension.
array
- the array to copy data into. This should be
sufficient size and dimensionality to hold
requested data.
public abstract void copyIntoArray(int[] coordinate,
int[] size,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
array
- the array to copy data into. This should be
sufficient size and dimensionality to hold
requested data.
public abstract void copyInto1DArray(int[] coordinate,
int[] size,
int[] stride,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
stride
- the sampling along each dimension.
array
- the 1-D array to copy data into. This should be
sufficient size to hold requested data.
public abstract void copyInto1DArray(int[] coordinate,
int[] size,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
coordinate
- the origin of the array subset
size
- the length of the subset along each dimension
array
- the array to copy data into. This should be
sufficient size and dimensionality to hold
requested data.
public abstract void copyInto2DArray(int xaxis,
int yaxis,
int[] coord,
int width,
int height,
int xstride,
int ystride,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
xaxis
- the index of the axis to be copied to the first dimension
yaxis
- the index of the axis to be copied to the second dimension
coord
- the start position
width
- the size of the array in the first direction
height
- the size of the array in the second direction
xstride
- the sampling to use along the first axis
ystride
- the sampling to use along the second axis
public abstract void copyInto2DArray(int xaxis,
int yaxis,
int[] coord,
int width,
int height,
java.lang.Object array)
throws NDArrayIndexOutOfBoundsException
xaxis
- the index of the axis to be copied to the first dimension
yaxis
- the index of the axis to be copied to the second dimension
coord
- the start position
width
- the size of the array in the first direction
height
- the size of the array in the second directionpublic java.lang.Object clone()
public static final int getDimensionality(java.lang.Object array)
array
- the array in questionpublic static final int getDimensionality(java.lang.String classname)
classname
- the string representation of classpublic static final java.lang.Class getElementType(java.lang.Object array)
public static final int[] getArraySize(java.lang.Object array)
public static final java.lang.Object get(java.lang.Object array,
int[] index)
array
- the multidimensional array
index
- the multidimensional index. The number of
elements must equal that of the dimensionality
of array. The indices should be in the order
that one would give to an array-type object
using [], e.g. an index of { 1, 2, 3 } corresponds
to array[1][2][3].
public static final void set(java.lang.Object array,
int[] index,
java.lang.Object value)
throws NDArrayIndexOutOfBoundsException
array
- the multidimensional array
index
- the multidimensional index. The number of
elements must equal that of the dimensionality
of array. The indices should be in the order
that one would give to an array-type object
using [], e.g. an index of { 1, 2, 3 } corresponds
to array[1][2][3].
value
- the value to set the element to. If the array holds
values of a primitive type, this value should be
of its corresponding wrapper type.
public static final void initialize(java.lang.Object array,
java.lang.Object val)
throws java.lang.IllegalArgumentException
public static final void initialize(java.lang.Object array,
int start,
int length,
java.lang.Object val)
throws java.lang.IllegalArgumentException
public static final void copy(java.lang.Object src,
int sstart,
int slen,
java.lang.Object dst,
int dstart,
int dlen,
java.lang.Object defval)
throws java.lang.IllegalArgumentException
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||