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
Concrete implementation of Array specialized for Objects.
Data storage is with 1D java array of Objects.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConcrete implementation of Array specialized for Objects, rank 0.static classConcrete implementation of Array specialized for Objects, rank 1.static classConcrete implementation of Array specialized for Objects, rank 2.static classConcrete implementation of Array specialized for Objects, rank 3.static classConcrete implementation of Array specialized for Objects, rank 4.static classConcrete implementation of Array specialized for Objects, rank 5.static classConcrete implementation of Array specialized for Objects, rank 6.static classConcrete implementation of Array specialized for Objects, rank 7. -
Constructor Summary
ConstructorsConstructorDescriptionArrayObject(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
Modifier and TypeMethodDescriptioncopy()Create a copy of this Array, copying the data so that physical order is the same as logical orderbooleangetBoolean(int index) booleangetBoolean(Index i) not legal, throw ForbiddenConversionExceptionbytegetByte(int index) bytenot legal, throw ForbiddenConversionExceptionchargetChar(int index) charnot legal, throw ForbiddenConversionExceptiondoublegetDouble(int index) doublenot legal, throw ForbiddenConversionExceptionReturn the element class typefloatgetFloat(int index) floatnot legal, throw ForbiddenConversionExceptionintgetInt(int index) intnot legal, throw ForbiddenConversionExceptionlonggetLong(int index) longnot legal, throw ForbiddenConversionExceptiongetObject(int index) Get the array element at index as an Object.shortgetShort(int index) shortnot legal, throw ForbiddenConversionExceptionGet underlying primitive array storage.booleanisVlen()voidsetBoolean(int index, boolean value) voidsetBoolean(Index i, boolean value) not legal, throw ForbiddenConversionExceptionvoidsetByte(int index, byte value) voidnot legal, throw ForbiddenConversionExceptionvoidsetChar(int index, char value) voidnot legal, throw ForbiddenConversionExceptionvoidsetDouble(int index, double value) voidnot legal, throw ForbiddenConversionExceptionvoidsetFloat(int index, float value) voidnot legal, throw ForbiddenConversionExceptionvoidsetInt(int index, int value) voidnot legal, throw ForbiddenConversionExceptionvoidsetLong(int index, long value) voidnot legal, throw ForbiddenConversionExceptionvoidvoidSet the array element at index to the specified value.voidsetShort(int index, short value) voidnot legal, throw ForbiddenConversionExceptionMethods 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 Details
-
ArrayObject
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 Details
-
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
Get underlying primitive array storage. CAUTION! You may invalidate your warrentee!- Specified by:
getStoragein classArray- Returns:
- underlying primitive array storage
-
getElementType
Return the element class type- Specified by:
getElementTypein classArray- Returns:
- the class of the element
-
isVlen
public boolean isVlen() -
getDouble
not legal, throw ForbiddenConversionException -
setDouble
not legal, throw ForbiddenConversionException -
getFloat
not legal, throw ForbiddenConversionException -
setFloat
not legal, throw ForbiddenConversionException -
getLong
not legal, throw ForbiddenConversionException -
setLong
not legal, throw ForbiddenConversionException -
getInt
not legal, throw ForbiddenConversionException -
setInt
not legal, throw ForbiddenConversionException -
getShort
not legal, throw ForbiddenConversionException -
setShort
not legal, throw ForbiddenConversionException -
getByte
not legal, throw ForbiddenConversionException -
setByte
not legal, throw ForbiddenConversionException -
getBoolean
not legal, throw ForbiddenConversionException- Specified by:
getBooleanin classArray- Parameters:
i- Index with current element set- Returns:
- value at
indexcast to boolean if necessary.
-
setBoolean
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
not legal, throw ForbiddenConversionException -
setChar
not legal, throw ForbiddenConversionException -
getObject
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
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) -
getDouble
public double getDouble(int index) -
setDouble
public void setDouble(int index, double value) -
getFloat
public float getFloat(int index) -
setFloat
public void setFloat(int index, float value) -
getLong
public long getLong(int index) -
setLong
public void setLong(int index, long value) -
getInt
public int getInt(int index) -
setInt
public void setInt(int index, int value) -
getShort
public short getShort(int index) -
setShort
public void setShort(int index, short value) -
getByte
public byte getByte(int index) -
setByte
public void setByte(int index, byte value) -
getChar
public char getChar(int index) -
setChar
public void setChar(int index, char value) -
getBoolean
public boolean getBoolean(int index) - Specified by:
getBooleanin classArray
-
setBoolean
public void setBoolean(int index, boolean value) - Specified by:
setBooleanin classArray
-
getObject
-
setObject
-