Package ucar.ma2
Class ArrayScalar
- java.lang.Object
-
- ucar.ma2.Array
-
- ucar.ma2.ArrayScalar
-
@Immutable public class ArrayScalar extends Array
Helper class for StructureDataAscii
-
-
Constructor Summary
Constructors Constructor Description ArrayScalar(Object value, boolean isUnsigned)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
copyFrom1DJavaArray(IndexIterator iter, Object javaArray)
protected void
copyTo1DJavaArray(IndexIterator iter, Object javaArray)
protected Array
createView(Index index)
create new Array with given Index and the same backing storeboolean
getBoolean(int elem)
boolean
getBoolean(Index ima)
Get the array element at the current element of ima, as a boolean.byte
getByte(int elem)
byte
getByte(Index ima)
Get the array element at the current element of ima, as a byte.char
getChar(int elem)
char
getChar(Index ima)
Get the array element at the current element of ima, as a char.double
getDouble(int elem)
double
getDouble(Index ima)
Get the array element at the current element of ima, as a double.Class
getElementType()
Get the element class type of this Arrayfloat
getFloat(int elem)
float
getFloat(Index ima)
Get the array element at the current element of ima, as a float.int
getInt(int elem)
int
getInt(Index ima)
Get the array element at the current element of ima, as a int.long
getLong(int elem)
long
getLong(Index ima)
Get the array element at the current element of ima, as a long.Object
getObject(int elem)
Object
getObject(Index ima)
Get the array element at index as an Object.short
getShort(int elem)
short
getShort(Index ima)
Get the array element at the current element of ima, as a short.Object
getStorage()
Get underlying primitive array storage.void
setBoolean(int elem, boolean value)
void
setBoolean(Index ima, boolean value)
Set the array element at the current element of ima.void
setByte(int elem, byte value)
void
setByte(Index ima, byte value)
Set the array element at the current element of ima.void
setChar(int elem, char value)
void
setChar(Index ima, char value)
Set the array element at the current element of ima.void
setDouble(int elem, double val)
void
setDouble(Index ima, double value)
Set the array element at the current element of ima.void
setFloat(int elem, float val)
void
setFloat(Index ima, float value)
Set the array element at the current element of ima.void
setInt(int elem, int value)
void
setInt(Index ima, int value)
Set the array element at the current element of ima.void
setLong(int elem, long value)
void
setLong(Index ima, long value)
Set the array element at the current element of ima.void
setObject(int elem, Object value)
void
setObject(Index ima, Object value)
Set the array element at index to the specified value.void
setShort(int elem, short value)
void
setShort(Index ima, short value)
Set the array element at the current element of ima.-
Methods 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 Detail
-
ArrayScalar
public ArrayScalar(Object value, boolean isUnsigned)
-
-
Method Detail
-
getElementType
public Class getElementType()
Description copied from class:Array
Get the element class type of this Array- Specified by:
getElementType
in classArray
- Returns:
- the class of the element
-
createView
protected Array createView(Index index)
Description copied from class:Array
create new Array with given Index and the same backing store- Specified by:
createView
in classArray
- Parameters:
index
- use this Index- Returns:
- a view of the Array using the given Index
-
getStorage
public Object getStorage()
Description copied from class:Array
Get underlying primitive array storage. Exposed for efficiency, use at your own risk.- Specified by:
getStorage
in classArray
- Returns:
- underlying primitive array storage
-
copyFrom1DJavaArray
protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyFrom1DJavaArray
in classArray
-
copyTo1DJavaArray
protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyTo1DJavaArray
in classArray
-
getDouble
public double getDouble(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a double.
-
setDouble
public void setDouble(Index ima, double value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getFloat
public float getFloat(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a float.
-
setFloat
public void setFloat(Index ima, float value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getLong
public long getLong(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a long.
-
setLong
public void setLong(Index ima, long value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getInt
public int getInt(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a int.
-
setInt
public void setInt(Index ima, int value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getShort
public short getShort(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a short.
-
setShort
public void setShort(Index ima, short value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getByte
public byte getByte(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a byte.
-
setByte
public void setByte(Index ima, byte value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getChar
public char getChar(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a char.
-
setChar
public void setChar(Index ima, char value)
Description copied from class:Array
Set the array element at the current element of ima.
-
getBoolean
public boolean getBoolean(Index ima)
Description copied from class:Array
Get the array element at the current element of ima, as a boolean.- Specified by:
getBoolean
in classArray
- Parameters:
ima
- Index with current element set- Returns:
- value at
index
cast to boolean if necessary.
-
setBoolean
public void setBoolean(Index ima, boolean value)
Description copied from class:Array
Set the array element at the current element of ima.- Specified by:
setBoolean
in classArray
- Parameters:
ima
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.
-
getObject
public Object getObject(Index ima)
Description copied from class:Array
Get 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 ima, Object value)
Description copied from class:Array
Set 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 elem)
- Specified by:
getBoolean
in classArray
-
setBoolean
public void setBoolean(int elem, boolean value)
- Specified by:
setBoolean
in classArray
-
-