Package ucar.ma2
Class ArrayBoolean
java.lang.Object
ucar.ma2.Array
ucar.ma2.ArrayBoolean
- Direct Known Subclasses:
ArrayBoolean.D0,ArrayBoolean.D1,ArrayBoolean.D2,ArrayBoolean.D3,ArrayBoolean.D4,ArrayBoolean.D5,ArrayBoolean.D6,ArrayBoolean.D7
Concrete implementation of Array specialized for booleans.
Data storage is with 1D java array of booleans.
issues: what should we do if a conversion loses accuracy? nothing ? Exception ?
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConcrete implementation of Array specialized for byte, rank 0.static classConcrete implementation of Array specialized for boolean, rank 1.static classConcrete implementation of Array specialized for boolean, rank 2.static classConcrete implementation of Array specialized for boolean, rank 3.static classConcrete implementation of Array specialized for boolean, rank 4.static classConcrete implementation of Array specialized for boolean, rank 5.static classConcrete implementation of Array specialized for boolean, rank 6.static classConcrete implementation of Array specialized for boolean, rank 7. -
Constructor Summary
ConstructorsConstructorDescriptionArrayBoolean(int[] dimensions) Create a new Array of type boolean and the given shape. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget the value at the specified index.booleangetBoolean(int index) booleangetBoolean(Index i) Get the array element at the current element of ima, as a boolean.bytegetByte(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.voidset the value at the sepcified index.voidsetBoolean(int index, boolean value) voidsetBoolean(Index i, boolean value) Set the array element at the current element of ima.voidsetByte(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, copy, 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, isVlen, 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
-
ArrayBoolean
public ArrayBoolean(int[] dimensions) Create a new Array of type boolean and the given shape. dimensions.length determines the rank of the new Array.- Parameters:
dimensions- the shape of the Array.
-
-
Method Details
-
getStorage
Description copied from class:ArrayGet underlying primitive array storage. Exposed for efficiency, use at your own risk.- 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
-
get
get the value at the specified index. -
set
set the value at the sepcified index. -
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
Description copied from class:ArrayGet the array element at the current element of ima, as a boolean.- Specified by:
getBooleanin classArray- Parameters:
i- Index with current element set- Returns:
- value at
indexcast to boolean if necessary.
-
setBoolean
Description copied from class:ArraySet the array element at the current element of ima.- 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
-