CDMA client API  3.1.0
CDMA core library
org.gumtree.data.interfaces.IArray Interface Reference

The IArray interface manages multiple types of data. More...

Inherits IModelObject.

List of all members.

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)

Detailed Description

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:

  • a type info which gives the type of its elements,
  • a shape which describes the number of elements in each dimension
  • a size that is the total number of elements
  • a rank that is the number of dimension
    A scalar IArray has a rank = 0, an IArray may have arbitrary rank.

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.

See also:
org.gumtree.data.interfaces.IIndex
Author:
nxi

Member Function Documentation

Create a copy of this Array, copying the data so that physical order is the same as logical order.

Returns:
the new IArray

Create a copy of this IArray. Whether to copy the data so that physical order is the same as logical order, it will share it. So both arrays reference the same backing storage.

Parameters:
dataif true the backing storage will be copied too, else it will be shared
Returns:
the new IArray

Get an IArrayMath that permits math calculations on arrays

Returns:
new IArrayMath object

Get an IArrayUtils that permits shape manipulations on arrays

Returns:
new IArrayUtils object

Get the array element at the current element offset of ima, as a boolean.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to boolean if necessary.

Get the array element at the current element offset of ima, as a byte.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to float if necessary.

Get the array element at the current element offset of ima, as a char.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to char if necessary.

Get the array element at the current element offset of ima, as a double.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to double if necessary.

Get the element class type of this IArray.

Returns:
Class object

Get the array element at the current element offset of ima, as a float.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to float if necessary.

Get an IIndex object used for indexed access of this IArray.

Returns:
the IIndex object currently used by the IArray
See also:
IIndex

Get the array element at the current element offset of ima, as a int.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to int if necessary.

Get Iterator to traverse the IArray.

Returns:
ArrayIterator

Get the array element at the current element offset of ima, as a long.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to long if necessary.

Get the array element at index as an Object. The returned value is wrapped in an object, eg Double for double

Parameters:
imaelement Index
Returns:
Object value at index

Get the number of dimensions of the array.

Returns:
number of dimensions of the array

Get an iterator over a region of the IArray. The region is described by the reference and range parameters.

Parameters:
referenceinteger array of starting position for each dimension
rangeinteger array of length for each dimension
Returns:
IArrayIterator
Exceptions:
InvalidRangeException

Get the register ID of the array.

Returns:
long value

Get the shape: length of array in each dimension.

Returns:
array whose length is the rank of this IArray and whose elements represent the length of each of its indices.

Get the array element at the current element offset of ima, as a short.

Parameters:
imaIIndex with current element set
Returns:
value at index cast to short if necessary.

Get the total number of elements in the array.

Returns:
total number of elements in the array

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.

Parameters:
rankan integer value, this will be the rank of the slice
Returns:
SliceIterator object
Exceptions:
ShapeNotMatchExceptionmismatching shape
InvalidRangeExceptioninvalid range

Get the underlying primitive array storage. Exposed for efficiency, use at your own risk.

Returns:
Object that is plug-in and format dependent

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.

Release the back storage of this IArray. It will trigger backup routine, which saves the data into the file system that can be load back when this IArray is accessed next time.

Exceptions:
BackupExceptionfailed to put in storage
void org.gumtree.data.interfaces.IArray.setBoolean ( IIndex  ima,
boolean  value 
)

Set the array element at the current element offset of ima.

Parameters:
imaIIndex with current element set
valuethe 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.

Parameters:
imaIIndex with current element set
valuethe 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.

Parameters:
imaIIndex with current element set
valuethe new value; cast to underlying data type if necessary.

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.

Parameters:
imaIIndex with current element set
valuethe new value; cast to underlying data type if necessary.

Set double value to all values of the IArray.

Parameters:
valuedouble value
Returns:
this
void org.gumtree.data.interfaces.IArray.setFloat ( IIndex  ima,
float  value 
)

Set the array element at the current element offset of ima.

Parameters:
imaIIndex with current element set
valuethe new value; cast to underlying data type if necessary.

Set the given index as the current one for this array. Defines a viewable part of this array.

Parameters:
indexof 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.

Parameters:
imaIIndex with current element set
valuethe 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.

Parameters:
imaIIndex with current element set
valuethe 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)

Parameters:
imaIIndex with current element set
valuethe new value.
void org.gumtree.data.interfaces.IArray.setShort ( IIndex  ima,
short  value 
)

Set the array element at the current element offset of ima.

Parameters:
imaIIndex with current element set
valuethe new value; cast to underlying data type if necessary.

Convert the shape information to String type.

Returns:
String type

Release the lock of the array from loading data from backup storage.


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