Package ucar.ma2
Class ArrayObject
- java.lang.Object
-
- ucar.ma2.Array
-
- ucar.ma2.ArrayObject
-
- Direct Known Subclasses:
ArrayObject.D0,ArrayObject.D1,ArrayObject.D2,ArrayObject.D3,ArrayObject.D4,ArrayObject.D5,ArrayObject.D6,ArrayObject.D7
public class ArrayObject extends Array
Concrete implementation of Array specialized for Objects. Data storage is with 1D java array of Objects.- See Also:
Array
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArrayObject.D0Concrete implementation of Array specialized for Objects, rank 0.static classArrayObject.D1Concrete implementation of Array specialized for Objects, rank 1.static classArrayObject.D2Concrete implementation of Array specialized for Objects, rank 2.static classArrayObject.D3Concrete implementation of Array specialized for Objects, rank 3.static classArrayObject.D4Concrete implementation of Array specialized for Objects, rank 4.static classArrayObject.D5Concrete implementation of Array specialized for Objects, rank 5.static classArrayObject.D6Concrete implementation of Array specialized for Objects, rank 6.static classArrayObject.D7Concrete implementation of Array specialized for Objects, rank 7.
-
Constructor Summary
Constructors Constructor Description ArrayObject(DataType dtype, Class elementType, boolean isVlen, int[] shape)Create a new Array of type Object and the given shape.ArrayObject(DataType dtype, Class elementType, boolean isVlen, int[] shape, Object[] storage)Create a new Array of type Object and the given shape and storage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Arraycopy()Create a copy of this Array, copying the data so that physical order is the same as logical orderprotected voidcopyFrom1DJavaArray(IndexIterator iter, Object javaArray)protected voidcopyTo1DJavaArray(IndexIterator iter, Object javaArray)protected ArraycreateView(Index index)create new Array with given indexImpl and the same backing storebooleangetBoolean(int index)booleangetBoolean(Index i)not legal, throw ForbiddenConversionExceptionbytegetByte(int index)bytegetByte(Index i)not legal, throw ForbiddenConversionExceptionchargetChar(int index)chargetChar(Index i)not legal, throw ForbiddenConversionExceptiondoublegetDouble(int index)doublegetDouble(Index i)not legal, throw ForbiddenConversionExceptionClassgetElementType()Return the element class typefloatgetFloat(int index)floatgetFloat(Index i)not legal, throw ForbiddenConversionExceptionintgetInt(int index)intgetInt(Index i)not legal, throw ForbiddenConversionExceptionlonggetLong(int index)longgetLong(Index i)not legal, throw ForbiddenConversionExceptionObjectgetObject(int index)ObjectgetObject(Index i)Get the array element at index as an Object.shortgetShort(int index)shortgetShort(Index i)not legal, throw ForbiddenConversionExceptionObjectgetStorage()Get underlying primitive array storage.booleanisVlen()voidsetBoolean(int index, boolean value)voidsetBoolean(Index i, boolean value)not legal, throw ForbiddenConversionExceptionvoidsetByte(int index, byte value)voidsetByte(Index i, byte value)not legal, throw ForbiddenConversionExceptionvoidsetChar(int index, char value)voidsetChar(Index i, char value)not legal, throw ForbiddenConversionExceptionvoidsetDouble(int index, double value)voidsetDouble(Index i, double value)not legal, throw ForbiddenConversionExceptionvoidsetFloat(int index, float value)voidsetFloat(Index i, float value)not legal, throw ForbiddenConversionExceptionvoidsetInt(int index, int value)voidsetInt(Index i, int value)not legal, throw ForbiddenConversionExceptionvoidsetLong(int index, long value)voidsetLong(Index i, long value)not legal, throw ForbiddenConversionExceptionvoidsetObject(int index, Object value)voidsetObject(Index i, Object value)Set the array element at index to the specified value.voidsetShort(int index, short value)voidsetShort(Index i, short value)not legal, throw ForbiddenConversionException-
Methods inherited from class ucar.ma2.Array
arraycopy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factoryConstant, factoryCopy, flip, get1DJavaArray, get1DJavaArray, getDataAsByteBuffer, getDataAsByteBuffer, getDataAsByteBuffer, getDataType, getIndex, getIndexIterator, getRangeIterator, getRank, getShape, getSize, getSizeBytes, hasNext, isConstant, isUnsigned, makeArray, makeArray, makeArray, makeArrayRankPlusOne, makeFromJavaArray, makeFromJavaArray, makeObjectArray, makeVlenArray, next, nextBoolean, nextByte, nextChar, nextDouble, nextFloat, nextInt, nextLong, nextShort, permute, reduce, reduce, resetLocalIterator, reshape, reshapeNoCopy, section, section, section, sectionNoReduce, sectionNoReduce, shapeToString, slice, toString, transpose
-
-
-
-
Constructor Detail
-
ArrayObject
public ArrayObject(DataType dtype, Class elementType, boolean isVlen, int[] shape)
Create a new Array of type Object and the given shape. dimensions.length determines the rank of the new Array.- Parameters:
elementType- the type of element, eg Stringshape- the shape of the Array.
-
ArrayObject
public ArrayObject(DataType dtype, Class elementType, boolean isVlen, int[] shape, Object[] storage)
Create a new Array of type Object and the given shape and storage. dimensions.length determines the rank of the new Array.- Parameters:
elementType- the type of element, eg Stringshape- the shape of the Array.
-
-
Method Detail
-
createView
protected Array createView(Index index)
create new Array with given indexImpl and the same backing store- Specified by:
createViewin classArray- Parameters:
index- use this Index- Returns:
- a view of the Array using the given Index
-
copy
public Array copy()
Description copied from class:ArrayCreate a copy of this Array, copying the data so that physical order is the same as logical order
-
getStorage
public Object getStorage()
Get underlying primitive array storage. CAUTION! You may invalidate your warrentee!- Specified by:
getStoragein classArray- Returns:
- underlying primitive array storage
-
copyFrom1DJavaArray
protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyFrom1DJavaArrayin classArray
-
copyTo1DJavaArray
protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyTo1DJavaArrayin classArray
-
getElementType
public Class getElementType()
Return the element class type- Specified by:
getElementTypein classArray- Returns:
- the class of the element
-
getDouble
public double getDouble(Index i)
not legal, throw ForbiddenConversionException
-
setDouble
public void setDouble(Index i, double value)
not legal, throw ForbiddenConversionException
-
getFloat
public float getFloat(Index i)
not legal, throw ForbiddenConversionException
-
setFloat
public void setFloat(Index i, float value)
not legal, throw ForbiddenConversionException
-
getLong
public long getLong(Index i)
not legal, throw ForbiddenConversionException
-
setLong
public void setLong(Index i, long value)
not legal, throw ForbiddenConversionException
-
getInt
public int getInt(Index i)
not legal, throw ForbiddenConversionException
-
setInt
public void setInt(Index i, int value)
not legal, throw ForbiddenConversionException
-
getShort
public short getShort(Index i)
not legal, throw ForbiddenConversionException
-
setShort
public void setShort(Index i, short value)
not legal, throw ForbiddenConversionException
-
getByte
public byte getByte(Index i)
not legal, throw ForbiddenConversionException
-
setByte
public void setByte(Index i, byte value)
not legal, throw ForbiddenConversionException
-
getBoolean
public boolean getBoolean(Index i)
not legal, throw ForbiddenConversionException- Specified by:
getBooleanin classArray- Parameters:
i- Index with current element set- Returns:
- value at
indexcast to boolean if necessary.
-
setBoolean
public void setBoolean(Index i, boolean value)
not legal, throw ForbiddenConversionException- Specified by:
setBooleanin classArray- Parameters:
i- Index with current element setvalue- the new value; cast to underlying data type if necessary.
-
getChar
public char getChar(Index i)
not legal, throw ForbiddenConversionException
-
setChar
public void setChar(Index i, char value)
not legal, throw ForbiddenConversionException
-
getObject
public Object getObject(Index i)
Description copied from class:ArrayGet the array element at index as an Object. The returned value is wrapped in an object, eg Double for double
-
setObject
public void setObject(Index i, Object value)
Description copied from class:ArraySet the array element at index to the specified value. the value must be passed wrapped in the appropriate Object (eg Double for double)
-
getBoolean
public boolean getBoolean(int index)
- Specified by:
getBooleanin classArray
-
setBoolean
public void setBoolean(int index, boolean value)- Specified by:
setBooleanin classArray
-
-