|
CDMA client API
3.1.0
CDMA core library
|
The IArray interface manages multiple types of data. More...
Inherits IModelObject.
Public Member Functions | |
| IArray | copy () |
| IArray | copy (boolean data) |
| IArrayUtils | getArrayUtils () |
| IArrayMath | getArrayMath () |
| boolean | getBoolean (IIndex ima) |
| byte | getByte (IIndex ima) |
| char | getChar (IIndex ima) |
| double | getDouble (IIndex ima) |
| Class<?> | getElementType () |
| float | getFloat (IIndex ima) |
| IIndex | getIndex () |
| int | getInt (IIndex ima) |
| IArrayIterator | getIterator () |
| long | getLong (IIndex ima) |
| Object | getObject (IIndex ima) |
| int | getRank () |
| IArrayIterator | getRegionIterator (int[] reference, int[] range) throws InvalidRangeException |
| int[] | getShape () |
| short | getShort (IIndex ima) |
| long | getSize () |
| Object | getStorage () |
| void | setBoolean (IIndex ima, boolean value) |
| void | setByte (IIndex ima, byte value) |
| void | setChar (IIndex ima, char value) |
| void | setDouble (IIndex ima, double value) |
| void | setFloat (IIndex ima, float value) |
| void | setInt (IIndex ima, int value) |
| void | setLong (IIndex ima, long value) |
| void | setObject (IIndex ima, Object value) |
| void | setShort (IIndex ima, short value) |
| String | shapeToString () |
| void | setIndex (IIndex index) |
| ISliceIterator | getSliceIterator (int rank) throws ShapeNotMatchException, InvalidRangeException |
| void | releaseStorage () throws BackupException |
| long | getRegisterId () |
| void | lock () |
| void | unlock () |
| boolean | isDirty () |
| void | setDirty (boolean dirty) |
| IArray | setDouble (final double value) |
The IArray interface manages multiple types of data.
A IArray can be a matrix or a single scalar it carries the underlying data and provide a standardized way to access it.
An array has:
The data storage is done by the plug-in as stride index calculations. However a 1D array of object should always be a possible storage for those data. This makes our IArray rectangular, i.e. no "ragged arrays" where different elements can have different lengths as multidimensional arrays, which are arrays of arrays.
For efficiency, each IArray should use primitive Java type (boolean, byte, char, int, float, ...) for the underlying storage.
The stride index calculations allows logical views (IIndex) of the underlying data. To be efficiently implemented, eg subset, transpose, slice, etc. Those views use the same data storage as the original array they are derived from. The index stride calculations are equally efficient for any chain of logical views.
The type, shape and backing storage of an IArray are immutable. The data itself is read or written using a IIndex or a IArrayIterator, which stores any needed state information for efficient traversal. This makes use of Arrays thread-safe (as long as you don't share the IIndex or IArrayIterator) except for the possibility of non-atomic read/write on long/doubles. If this is the case, you should probably synchronize your calls.
Create a copy of this Array, copying the data so that physical order is the same as logical order.
| IArray org.gumtree.data.interfaces.IArray.copy | ( | boolean | data | ) |
Get an IArrayMath that permits math calculations on arrays
Get an IArrayUtils that permits shape manipulations on arrays
| boolean org.gumtree.data.interfaces.IArray.getBoolean | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a boolean.
| ima | IIndex with current element set |
index cast to boolean if necessary. | byte org.gumtree.data.interfaces.IArray.getByte | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a byte.
| ima | IIndex with current element set |
index cast to float if necessary. | char org.gumtree.data.interfaces.IArray.getChar | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a char.
| ima | IIndex with current element set |
index cast to char if necessary. | double org.gumtree.data.interfaces.IArray.getDouble | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a double.
| ima | IIndex with current element set |
index cast to double if necessary. | Class<?> org.gumtree.data.interfaces.IArray.getElementType | ( | ) |
Get the element class type of this IArray.
| float org.gumtree.data.interfaces.IArray.getFloat | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a float.
| ima | IIndex with current element set |
index cast to float if necessary. | int org.gumtree.data.interfaces.IArray.getInt | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a int.
| ima | IIndex with current element set |
index cast to int if necessary. Get Iterator to traverse the IArray.
| long org.gumtree.data.interfaces.IArray.getLong | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a long.
| ima | IIndex with current element set |
index cast to long if necessary. | Object org.gumtree.data.interfaces.IArray.getObject | ( | IIndex | ima | ) |
Get the array element at index as an Object. The returned value is wrapped in an object, eg Double for double
| ima | element Index |
index Get the number of dimensions of the array.
| IArrayIterator org.gumtree.data.interfaces.IArray.getRegionIterator | ( | int[] | reference, |
| int[] | range | ||
| ) | throws InvalidRangeException |
Get an iterator over a region of the IArray. The region is described by the reference and range parameters.
| reference | integer array of starting position for each dimension |
| range | integer array of length for each dimension |
| InvalidRangeException |
Get the register ID of the array.
| int [] org.gumtree.data.interfaces.IArray.getShape | ( | ) |
Get the shape: length of array in each dimension.
| short org.gumtree.data.interfaces.IArray.getShort | ( | IIndex | ima | ) |
Get the array element at the current element offset of ima, as a short.
| ima | IIndex with current element set |
index cast to short if necessary. Get the total number of elements in the array.
| ISliceIterator org.gumtree.data.interfaces.IArray.getSliceIterator | ( | int | rank | ) | throws ShapeNotMatchException, InvalidRangeException |
Get a slice iterator with certain rank. The rank of the slice must be equal or smaller than the array itself. Otherwise throw ShapeNotMatchException.
For example, for an array with the shape of [2x3x4x5]. If the rank of the slice is 1, there will be 2x3x4=24 slices of 5 elements each. If the rank of slice is 2, there will be 2x3=6 slices. If the rank of the slice is 3, there will be 2 slices. If the rank of slice is 4, which is not recommended, there will be just 1 slices. If the rank of slice is 0, in which case it is pretty costly, there will be 120 slices of 1 element each.
| rank | an integer value, this will be the rank of the slice |
| ShapeNotMatchException | mismatching shape |
| InvalidRangeException | invalid range |
Get the underlying primitive array storage. Exposed for efficiency, use at your own risk.
| boolean org.gumtree.data.interfaces.IArray.isDirty | ( | ) |
Return true if the array has been changed since last read out from the backup storage.
Lock the array from loading data from backup storage. If the data is not backed up, this will not affecting reading out the data.
| void org.gumtree.data.interfaces.IArray.releaseStorage | ( | ) | throws BackupException |
| void org.gumtree.data.interfaces.IArray.setBoolean | ( | IIndex | ima, |
| boolean | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setByte | ( | IIndex | ima, |
| byte | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setChar | ( | IIndex | ima, |
| char | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setDirty | ( | boolean | dirty | ) |
Set the array to indicate changes since last read out from the backup storage.
| void org.gumtree.data.interfaces.IArray.setDouble | ( | IIndex | ima, |
| double | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| IArray org.gumtree.data.interfaces.IArray.setDouble | ( | final double | value | ) |
| void org.gumtree.data.interfaces.IArray.setFloat | ( | IIndex | ima, |
| float | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setIndex | ( | IIndex | index | ) |
Set the given index as the current one for this array. Defines a viewable part of this array.
| index | of the viewable part |
| void org.gumtree.data.interfaces.IArray.setInt | ( | IIndex | ima, |
| int | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setLong | ( | IIndex | ima, |
| long | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
| void org.gumtree.data.interfaces.IArray.setObject | ( | IIndex | ima, |
| Object | value | ||
| ) |
Set the array element at index to the specified value. the value must be passed wrapped in the appropriate Object (eg Double for double)
| ima | IIndex with current element set |
| value | the new value. |
| void org.gumtree.data.interfaces.IArray.setShort | ( | IIndex | ima, |
| short | value | ||
| ) |
Set the array element at the current element offset of ima.
| ima | IIndex with current element set |
| value | the new value; cast to underlying data type if necessary. |
Convert the shape information to String type.
Release the lock of the array from loading data from backup storage.