Package ucar.ma2
Class ArrayFloat
- java.lang.Object
-
- ucar.ma2.Array
-
- ucar.ma2.ArrayFloat
-
- Direct Known Subclasses:
ArrayFloat.D0,ArrayFloat.D1,ArrayFloat.D2,ArrayFloat.D3,ArrayFloat.D4,ArrayFloat.D5,ArrayFloat.D6,ArrayFloat.D7
public class ArrayFloat extends Array
Concrete implementation of Array specialized for floats. Data storage is with 1D java array of floats. issues: what should we do if a conversion loses accuracy? nothing ? Exception ?- See Also:
Array
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArrayFloat.D0Concrete implementation of Array specialized for floats, rank 0.static classArrayFloat.D1Concrete implementation of Array specialized for floats, rank 1.static classArrayFloat.D2Concrete implementation of Array specialized for floats, rank 2.static classArrayFloat.D3Concrete implementation of Array specialized for floats, rank 3.static classArrayFloat.D4Concrete implementation of Array specialized for floats, rank 4.static classArrayFloat.D5Concrete implementation of Array specialized for floats, rank 5.static classArrayFloat.D6Concrete implementation of Array specialized for floats, rank 6.static classArrayFloat.D7Concrete implementation of Array specialized for floats, rank 7.
-
Constructor Summary
Constructors Constructor Description ArrayFloat(int[] dimensions)Create a new Array of type float and the given shape.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyFrom1DJavaArray(IndexIterator iter, Object javaArray)protected voidcopyTo1DJavaArray(IndexIterator iter, Object javaArray)protected ArraycreateView(Index index)create new Array with given indexImpl and same backing storefloatget(Index i)get the value at the specified index.booleangetBoolean(int index)booleangetBoolean(Index i)not legal, throw ForbiddenConversionExceptionbytegetByte(int index)bytegetByte(Index i)Get the array element at the current element of ima, as a byte.chargetChar(int index)chargetChar(Index i)Get the array element at the current element of ima, as a char.ByteBuffergetDataAsByteBuffer()This gets the data as a ByteBuffer, in correct order.doublegetDouble(int index)doublegetDouble(Index i)Get the array element at the current element of ima, as a double.ClassgetElementType()Return the element class typefloatgetFloat(int index)floatgetFloat(Index i)Get the array element at the current element of ima, as a float.intgetInt(int index)intgetInt(Index i)Get the array element at the current element of ima, as a int.longgetLong(int index)longgetLong(Index i)Get the array element at the current element of ima, as a long.ObjectgetObject(int index)ObjectgetObject(Index i)Get the array element at index as an Object.shortgetShort(int index)shortgetShort(Index i)Get the array element at the current element of ima, as a short.ObjectgetStorage()Get underlying primitive array storage.voidset(Index i, float value)set the value at the sepcified index.voidsetBoolean(int index, boolean value)voidsetBoolean(Index i, boolean value)not legal, throw ForbiddenConversionExceptionvoidsetByte(int index, byte value)voidsetByte(Index i, byte value)Set the array element at the current element of ima.voidsetChar(int index, char value)voidsetChar(Index i, char value)Set the array element at the current element of ima.voidsetDouble(int index, double value)voidsetDouble(Index i, double value)Set the array element at the current element of ima.voidsetFloat(int index, float value)voidsetFloat(Index i, float value)Set the array element at the current element of ima.voidsetInt(int index, int value)voidsetInt(Index i, int value)Set the array element at the current element of ima.voidsetLong(int index, long value)voidsetLong(Index i, long value)Set the array element at the current element of ima.voidsetObject(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)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, flip, get1DJavaArray, get1DJavaArray, 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
-
-
-
-
Method Detail
-
createView
protected Array createView(Index index)
create new Array with given indexImpl and same backing store- Specified by:
createViewin classArray- Parameters:
index- use this Index- Returns:
- a view of the Array using the given Index
-
getStorage
public Object 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
-
copyFrom1DJavaArray
protected void copyFrom1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyFrom1DJavaArrayin classArray
-
copyTo1DJavaArray
protected void copyTo1DJavaArray(IndexIterator iter, Object javaArray)
- Specified by:
copyTo1DJavaArrayin classArray
-
getDataAsByteBuffer
public ByteBuffer getDataAsByteBuffer()
Description copied from class:ArrayThis gets the data as a ByteBuffer, in correct order. It avoids copying if possible. Only for numeric types (byte, short, int, long, double, float)- Overrides:
getDataAsByteBufferin classArray- Returns:
- equivilent data in a ByteBuffer
-
getElementType
public Class getElementType()
Return the element class type- Specified by:
getElementTypein classArray- Returns:
- the class of the element
-
get
public float get(Index i)
get the value at the specified index.
-
set
public void set(Index i, float value)
set the value at the sepcified index.
-
getDouble
public double getDouble(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a double.
-
setDouble
public void setDouble(Index i, double value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getFloat
public float getFloat(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a float.
-
setFloat
public void setFloat(Index i, float value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getLong
public long getLong(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a long.
-
setLong
public void setLong(Index i, long value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getInt
public int getInt(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a int.
-
setInt
public void setInt(Index i, int value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getShort
public short getShort(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a short.
-
setShort
public void setShort(Index i, short value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getByte
public byte getByte(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a byte.
-
setByte
public void setByte(Index i, byte value)
Description copied from class:ArraySet the array element at the current element of ima.
-
getChar
public char getChar(Index i)
Description copied from class:ArrayGet the array element at the current element of ima, as a char.
-
setChar
public void setChar(Index i, char value)
Description copied from class:ArraySet the array element at the current element of ima.
-
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.
-
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
-
-