|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.ma2.Array
ucar.ma2.ArrayChar
public class ArrayChar
Concrete implementation of Array specialized for chars. Data storage is with 1D java array of chars.
issues: what should we do if a conversion loses accuracy? nothing ? Exception ?
Array
Nested Class Summary | |
---|---|
static class |
ArrayChar.D0
Concrete implementation of Array specialized for char, rank 0. |
static class |
ArrayChar.D1
Concrete implementation of Array specialized for char, rank 1. |
static class |
ArrayChar.D2
Concrete implementation of Array specialized for char, rank 2. |
static class |
ArrayChar.D3
Concrete implementation of Array specialized for char, rank 3. |
static class |
ArrayChar.D4
Concrete implementation of Array specialized for char, rank 4. |
static class |
ArrayChar.D5
Concrete implementation of Array specialized for char, rank 5. |
static class |
ArrayChar.D6
Concrete implementation of Array specialized for char, rank 6. |
static class |
ArrayChar.D7
Concrete implementation of Array specialized for char, rank 7. |
class |
ArrayChar.StringIterator
rank must be > 0 |
Constructor Summary | |
---|---|
ArrayChar(int[] dimensions)
Create a new Array of type char and the given shape. |
Method Summary | |
---|---|
char |
get(Index i)
get the value at the specified index. |
boolean |
getBoolean(Index i)
not legal, throw ForbiddenConversionException |
boolean |
getBoolean(int index)
|
byte |
getByte(Index i)
Get the array element at the current element of ima, as a byte. |
byte |
getByte(int index)
|
char |
getChar(Index i)
Get the array element at the current element of ima, as a char. |
char |
getChar(int index)
|
java.nio.ByteBuffer |
getDataAsByteBuffer()
Trasfer data to a ByteBuffer. |
double |
getDouble(Index i)
Get the array element at the current element of ima, as a double. |
double |
getDouble(int index)
|
java.lang.Class |
getElementType()
Return the element class type |
float |
getFloat(Index i)
Get the array element at the current element of ima, as a float. |
float |
getFloat(int index)
|
int |
getInt(Index i)
Get the array element at the current element of ima, as a int. |
int |
getInt(int index)
|
long |
getLong(Index i)
Get the array element at the current element of ima, as a long. |
long |
getLong(int index)
|
java.lang.Object |
getObject(Index i)
Get the array element at index as an Object. |
java.lang.Object |
getObject(int index)
|
short |
getShort(Index i)
Get the array element at the current element of ima, as a short. |
short |
getShort(int index)
|
java.lang.Object |
getStorage()
Get underlying primitive array storage. |
java.lang.String |
getString()
Create a String out of this rank one ArrayChar object. |
java.lang.String |
getString(Index ima)
Create a String out of this ArrayChar object. |
java.lang.String |
getString(int index)
Create a String out of this rank two ArrayChar object. |
ArrayChar.StringIterator |
getStringIterator()
Treat this Variable as an array of Strings, and iterate over all the strings in the array. |
ArrayObject |
make1DStringArray()
Make this into the equivilent 1D ArrayObject of Strings. |
static ArrayChar |
makeFromString(java.lang.String s,
int max)
Create an ArrayChar from a String |
static ArrayChar |
makeFromStringArray(ArrayObject values)
Create an ArrayChar from an ArrayObject of Strings. |
static ArrayChar |
makeFromStringArray(ArrayObject values,
int strlen)
Create an ArrayChar from an ArrayObject of Strings. |
void |
set(Index i,
char value)
set the value at the sepcified index. |
void |
setBoolean(Index i,
boolean value)
not legal, throw ForbiddenConversionException |
void |
setBoolean(int index,
boolean value)
|
void |
setByte(Index i,
byte value)
Set the array element at the current element of ima. |
void |
setByte(int index,
byte value)
|
void |
setChar(Index i,
char value)
Set the array element at the current element of ima. |
void |
setChar(int index,
char value)
|
void |
setDouble(Index i,
double value)
Set the array element at the current element of ima. |
void |
setDouble(int index,
double value)
|
void |
setFloat(Index i,
float value)
Set the array element at the current element of ima. |
void |
setFloat(int index,
float value)
|
void |
setInt(Index i,
int value)
Set the array element at the current element of ima. |
void |
setInt(int index,
int value)
|
void |
setLong(Index i,
long value)
Set the array element at the current element of ima. |
void |
setLong(int index,
long value)
|
void |
setObject(Index i,
java.lang.Object value)
Set the array element at index to the specified value. |
void |
setObject(int index,
java.lang.Object value)
|
void |
setShort(Index i,
short value)
Set the array element at the current element of ima. |
void |
setShort(int index,
short value)
|
void |
setString(Index ima,
java.lang.String val)
Set the ArrayChar values from the characters in the String. |
void |
setString(int index,
java.lang.String val)
Set the ArrayChar values from the characters in the String. |
void |
setString(java.lang.String val)
Set the ArrayChar values from the characters in the String. |
java.lang.String |
toString()
|
Methods inherited from class ucar.ma2.Array |
---|
arraycopy, copy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factory, factory, factoryConstant, flip, get1DJavaArray, getIndex, getIndexIterator, getIndexIteratorFast, getIndexPrivate, getRangeIterator, getRank, getShape, getSize, getSizeBytes, hasNext, isUnsigned, makeArray, makeArray, makeArray, next, nextBoolean, nextByte, nextChar, nextDouble, nextFloat, nextInt, nextLong, nextShort, permute, reduce, reduce, resetLocalIterator, reshape, section, section, section, sectionNoReduce, sectionNoReduce, setUnsigned, shapeToString, slice, transpose |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArrayChar(int[] dimensions)
dimensions
- the shape of the Array.Method Detail |
---|
public java.lang.Object getStorage()
Array
getStorage
in class Array
public java.nio.ByteBuffer getDataAsByteBuffer()
getDataAsByteBuffer
in class Array
public java.lang.Class getElementType()
getElementType
in class Array
public char get(Index i)
public void set(Index i, char value)
public double getDouble(Index i)
Array
getDouble
in class Array
i
- Index with current element set
index
cast to double if necessary.public void setDouble(Index i, double value)
Array
setDouble
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public float getFloat(Index i)
Array
getFloat
in class Array
i
- Index with current element set
index
cast to float if necessary.public void setFloat(Index i, float value)
Array
setFloat
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public long getLong(Index i)
Array
getLong
in class Array
i
- Index with current element set
index
cast to long if necessary.public void setLong(Index i, long value)
Array
setLong
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public int getInt(Index i)
Array
getInt
in class Array
i
- Index with current element set
index
cast to int if necessary.public void setInt(Index i, int value)
Array
setInt
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public short getShort(Index i)
Array
getShort
in class Array
i
- Index with current element set
index
cast to short if necessary.public void setShort(Index i, short value)
Array
setShort
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public byte getByte(Index i)
Array
getByte
in class Array
i
- Index with current element set
index
cast to float if necessary.public void setByte(Index i, byte value)
Array
setByte
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public char getChar(Index i)
Array
getChar
in class Array
i
- Index with current element set
index
cast to char if necessary.public void setChar(Index i, char value)
Array
setChar
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public boolean getBoolean(Index i)
getBoolean
in class Array
i
- Index with current element set
index
cast to boolean if necessary.public void setBoolean(Index i, boolean value)
setBoolean
in class Array
i
- Index with current element setvalue
- the new value; cast to underlying data type if necessary.public java.lang.Object getObject(Index i)
Array
getObject
in class Array
i
- element Index
index
public void setObject(Index i, java.lang.Object value)
Array
setObject
in class Array
i
- Index with current element setvalue
- the new value.public java.lang.String getString()
java.lang.IllegalArgumentException
- if rank != 1public java.lang.String getString(int index)
index
- index into 1D String array, must be < getShape(0).
java.lang.IllegalArgumentException
- if rank != 2public java.lang.String getString(Index ima)
ArrayChar ca;
Index ima = ca.getIndex();
for (int i=0; i
ima
- the Index of where in the Array to start.
java.lang.IllegalArgumentException
- if rank != 1
public void setString(java.lang.String val)
val
- set characters from this String
java.lang.IllegalArgumentException
- if rank != 2public void setString(int index, java.lang.String val)
String[] val = new String[n];
ArrayChar ca;
Index ima = ca.getIndex();
for (int i=0; i
index
- index into 1D String array, must be < getShape(0).val
- set chars from this sString
public void setString(Index ima, java.lang.String val)
String[][] val;
ArrayChar ca;
Index ima = ca.getIndex();
int rank0 = ca.getShape()[0];
int rank1 = ca.getShape()[1];
for (int i=0; i
ima
- the Index of where in the Array to start.val
- set to this value
public double getDouble(int index)
getDouble
in class Array
public void setDouble(int index, double value)
setDouble
in class Array
public float getFloat(int index)
getFloat
in class Array
public void setFloat(int index, float value)
setFloat
in class Array
public long getLong(int index)
getLong
in class Array
public void setLong(int index, long value)
setLong
in class Array
public int getInt(int index)
getInt
in class Array
public void setInt(int index, int value)
setInt
in class Array
public short getShort(int index)
getShort
in class Array
public void setShort(int index, short value)
setShort
in class Array
public byte getByte(int index)
getByte
in class Array
public void setByte(int index, byte value)
setByte
in class Array
public char getChar(int index)
getChar
in class Array
public void setChar(int index, char value)
setChar
in class Array
public boolean getBoolean(int index)
getBoolean
in class Array
public void setBoolean(int index, boolean value)
setBoolean
in class Array
public java.lang.Object getObject(int index)
getObject
in class Array
public void setObject(int index, java.lang.Object value)
setObject
in class Array
public java.lang.String toString()
toString
in class Array
public ArrayChar.StringIterator getStringIterator()
public ArrayObject make1DStringArray()
public static ArrayChar makeFromString(java.lang.String s, int max)
s
- Stringmax
- maximum length
public static ArrayChar makeFromStringArray(ArrayObject values)
values
- ArrayObject of String
public static ArrayChar makeFromStringArray(ArrayObject values, int strlen)
values
- ArrayObject of Stringstrlen
- string length dimension size
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |