类 ArrayChar
- java.lang.Object
-
- org.meteoinfo.ndarray.Array
-
- org.meteoinfo.ndarray.ArrayChar
-
- 直接已知子类:
ArrayChar.D0,ArrayChar.D1,ArrayChar.D2,ArrayChar.D3,ArrayChar.D4,ArrayChar.D5,ArrayChar.D6,ArrayChar.D7
public class ArrayChar extends Array
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 ?- 作者:
- caron
- 另请参阅:
Array
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classArrayChar.D0Concrete implementation of Array specialized for char, rank 0.static classArrayChar.D1Concrete implementation of Array specialized for char, rank 1.static classArrayChar.D2Concrete implementation of Array specialized for char, rank 2.static classArrayChar.D3Concrete implementation of Array specialized for char, rank 3.static classArrayChar.D4Concrete implementation of Array specialized for char, rank 4.static classArrayChar.D5Concrete implementation of Array specialized for char, rank 5.static classArrayChar.D6Concrete implementation of Array specialized for char, rank 6.static classArrayChar.D7Concrete implementation of Array specialized for char, rank 7.classArrayChar.StringIteratorrank must be > 0
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected voidcopyFrom1DJavaArray(IndexIterator iter, java.lang.Object javaArray)protected voidcopyTo1DJavaArray(IndexIterator iter, java.lang.Object javaArray)protected ArraycreateView(Index index)create new Array with given indexImpl and same backing storecharget(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.ComplexgetComplex(int index)ComplexgetComplex(Index i)not legal, throw ForbiddenConversionExceptionjava.nio.ByteBuffergetDataAsByteBuffer()Trasfer data to a ByteBuffer.doublegetDouble(int index)doublegetDouble(Index i)Get the array element at the current element of ima, as a double.java.lang.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.java.lang.ObjectgetObject(int index)java.lang.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.java.lang.ObjectgetStorage()Get underlying primitive array storage.java.lang.StringgetString()Create a String out of this rank one ArrayChar object.java.lang.StringgetString(int index)Create a String out of this rank two ArrayChar object.java.lang.StringgetString(Index ima)Create a String out of this ArrayChar object.ArrayChar.StringIteratorgetStringIterator()Treat this Variable as an array of Strings, and iterate over all the strings in the array.ArrayObjectmake1DStringArray()Make this into the equivilent 1D ArrayObject of Strings.static ArrayCharmakeFromString(java.lang.String s, int max)Create an ArrayChar from a Stringstatic ArrayCharmakeFromStringArray(ArrayObject values)Create an ArrayChar from an ArrayObject of Strings.static ArrayCharmakeFromStringArray(ArrayObject values, int strlen)Create an ArrayChar from an ArrayObject of Strings.voidset(Index i, char 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.voidsetComplex(int index, Complex value)voidsetComplex(Index i, Complex value)not legal, throw ForbiddenConversionExceptionvoidsetDouble(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, java.lang.Object value)voidsetObject(Index i, java.lang.Object value)Set the array element at index to the specified value. the value must be passed wrapped in the appropriate Object (eg Double for double)voidsetShort(int index, short value)voidsetShort(Index i, short value)Set the array element at the current element of ima.voidsetString(int index, java.lang.String val)Set the ArrayChar values from the characters in the String.voidsetString(java.lang.String val)Set the ArrayChar values from the characters in the String.voidsetString(Index ima, java.lang.String val)Set the ArrayChar values from the characters in the String.java.lang.StringtoString()-
从类继承的方法 org.meteoinfo.ndarray.Array
arraycopy, copy, copyIfView, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factory, factory, factory, factoryConstant, flip, get1DJavaArray, getDataAsByteBuffer, getDataAsByteBuffer, getDataType, getIndex, getIndexIterator, getIndexIteratorFast, getIndexPrivate, getRangeIterator, getRank, getShape, getSize, getSizeBytes, hasNext, isConstant, isUnsigned, isView, makeArray, makeArray, makeArray, makeArray, makeArrayRankPlusOne, next, nextBoolean, nextByte, nextChar, nextDouble, nextFloat, nextInt, nextLong, nextShort, permute, reduce, reduce, resetLocalIterator, reshape, reshapeNoCopy, reshapeVLen, section, section, section, sectionNoReduce, sectionNoReduce, setUnsigned, shapeToString, slice, transpose
-
-
-
-
方法详细资料
-
createView
protected Array createView(Index index)
create new Array with given indexImpl and same backing store- 指定者:
createView在类中Array- 参数:
index- use this Index- 返回:
- a view of the Array using the given Index
-
getStorage
public java.lang.Object getStorage()
从类复制的说明:ArrayGet underlying primitive array storage. Exposed for efficiency, use at your own risk.- 指定者:
getStorage在类中Array- 返回:
- underlying primitive array storage
-
copyFrom1DJavaArray
protected void copyFrom1DJavaArray(IndexIterator iter, java.lang.Object javaArray)
- 指定者:
copyFrom1DJavaArray在类中Array
-
copyTo1DJavaArray
protected void copyTo1DJavaArray(IndexIterator iter, java.lang.Object javaArray)
- 指定者:
copyTo1DJavaArray在类中Array
-
getDataAsByteBuffer
public java.nio.ByteBuffer getDataAsByteBuffer()
Trasfer data to a ByteBuffer. Note we cast char to byte, discarding top byte, if any. This is because CDM char is really a byte, not a java char.- 覆盖:
getDataAsByteBuffer在类中Array- 返回:
- data in a ByteBuffer
-
getElementType
public java.lang.Class getElementType()
Return the element class type- 指定者:
getElementType在类中Array- 返回:
- the class of the element
-
get
public char get(Index i)
get the value at the specified index.
-
set
public void set(Index i, char value)
set the value at the sepcified index.
-
getDouble
public double getDouble(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a double.
-
setDouble
public void setDouble(Index i, double value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getFloat
public float getFloat(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a float.
-
setFloat
public void setFloat(Index i, float value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getLong
public long getLong(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a long.
-
setLong
public void setLong(Index i, long value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getInt
public int getInt(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a int.
-
setInt
public void setInt(Index i, int value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getShort
public short getShort(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a short.
-
setShort
public void setShort(Index i, short value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getByte
public byte getByte(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a byte.
-
setByte
public void setByte(Index i, byte value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getChar
public char getChar(Index i)
从类复制的说明:ArrayGet the array element at the current element of ima, as a char.
-
setChar
public void setChar(Index i, char value)
从类复制的说明:ArraySet the array element at the current element of ima.
-
getBoolean
public boolean getBoolean(Index i)
not legal, throw ForbiddenConversionException- 指定者:
getBoolean在类中Array- 参数:
i- Index with current element set- 返回:
- value at
indexcast to boolean if necessary.
-
setBoolean
public void setBoolean(Index i, boolean value)
not legal, throw ForbiddenConversionException- 指定者:
setBoolean在类中Array- 参数:
i- Index with current element setvalue- the new value; cast to underlying data type if necessary.
-
getComplex
public Complex getComplex(Index i)
not legal, throw ForbiddenConversionException- 指定者:
getComplex在类中Array- 参数:
i- Index with current element set- 返回:
- value at
indexcast to boolean if necessary.
-
setComplex
public void setComplex(Index i, Complex value)
not legal, throw ForbiddenConversionException- 指定者:
setComplex在类中Array- 参数:
i- Index with current element setvalue- the new value; cast to underlying data type if necessary.
-
getObject
public java.lang.Object getObject(Index i)
从类复制的说明: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, java.lang.Object value)
从类复制的说明:ArraySet the array element at index to the specified value. the value must be passed wrapped in the appropriate Object (eg Double for double)
-
getString
public java.lang.String getString()
Create a String out of this rank one ArrayChar object. If there is a null (0) value in the ArrayChar array, the String will end there. The null is not returned as part of the String.- 返回:
- String value of CharArray
- 抛出:
java.lang.IllegalArgumentException- if rank != 1
-
getString
public java.lang.String getString(int index)
Create a String out of this rank two ArrayChar object. This treats the ArrayChar as a 1D array of Strings. If there is a null (0) value in the ArrayChar array, the String will end there. The null is not returned as part of the String.
-
getString
public java.lang.String getString(Index ima)
Create a String out of this ArrayChar object. The rank must be 1 or greater. If there is a null (0) value in the ArrayChar array, the String will end there. The null is not returned as part of the String. If rank=1, then this will make a string out of the entire CharArray, ignoring ima. If rank is greater than 1, then make a String out of the characters of the last dimension, indexed by ima. This method treats the CharArray like an array of Strings, and allows you to iterate over them, eg for a 2D ArrayChar:ArrayChar ca; Index ima = ca.getIndex(); for (int i=0; i
-
setString
public void setString(java.lang.String val)
Set the ArrayChar values from the characters in the String. Rank must be 1. If String longer than ArrayChar, ignore extra chars; if shorter, fill with 0.- 参数:
val- set characters from this String- 抛出:
java.lang.IllegalArgumentException- if rank != 2
-
setString
public void setString(int index, java.lang.String val)Set the ArrayChar values from the characters in the String. Rank must be 2. This treats the ArrayChar as a 1D array of Strings. If String val longer than ArrayChar, ignore extra chars; if shorter, fill with 0.String[] val = new String[n]; ArrayChar ca; Index ima = ca.getIndex(); for (int i=0; i
-
setString
public void setString(Index ima, java.lang.String val)
Set the ArrayChar values from the characters in the String. Rank must be 1 or greater. If String longer than ArrayChar, ignore extra chars; if shorter, fill with 0. If rank 1, set entire ArrayChar, ignoring ima. If rank > 1, treat the ArrayChar like an array of Strings of rank-1, and set the row indexed by ima. For example, rank 3:String[][] val; ArrayChar ca; Index ima = ca.getIndex(); int rank0 = ca.getShape()[0]; int rank1 = ca.getShape()[1]; for (int i=0; i
-
getBoolean
public boolean getBoolean(int index)
- 指定者:
getBoolean在类中Array
-
setBoolean
public void setBoolean(int index, boolean value)- 指定者:
setBoolean在类中Array
-
getComplex
public Complex getComplex(int index)
- 指定者:
getComplex在类中Array
-
setComplex
public void setComplex(int index, Complex value)- 指定者:
setComplex在类中Array
-
getStringIterator
public ArrayChar.StringIterator getStringIterator()
Treat this Variable as an array of Strings, and iterate over all the strings in the array. If rank == 0, will make single String of length 1.- 返回:
- Iterator over Strings.
-
make1DStringArray
public ArrayObject make1DStringArray()
Make this into the equivilent 1D ArrayObject of Strings.- 返回:
- 1D ArrayObject of Strings
-
makeFromString
public static ArrayChar makeFromString(java.lang.String s, int max)
Create an ArrayChar from a String- 参数:
s- Stringmax- maximum length- 返回:
- equivilent ArrayChar
-
makeFromStringArray
public static ArrayChar makeFromStringArray(ArrayObject values)
Create an ArrayChar from an ArrayObject of Strings.- 参数:
values- ArrayObject of String- 返回:
- equivilent ArrayChar, using maximum length of String. Unused are zero filled.
-
makeFromStringArray
public static ArrayChar makeFromStringArray(ArrayObject values, int strlen)
Create an ArrayChar from an ArrayObject of Strings. Inverse of make1DStringArray. Copies the data.- 参数:
values- ArrayObject of Stringstrlen- string length dimension size- 返回:
- equivilent ArrayChar. Unused are zero filled.
-
-