public abstract class ArrayStructure extends Array implements Iterable<StructureData>
StructureData getStructureData(Index index).For 1D arrays (or by calculating your own recnum for nD arrays), you can also use:
StructureData getStructureData(int recnum).Once you have a StructureData object, you can access data in a general way by using:
Array StructureData.getArray(Member m)When dealing with large arrays of Structures, there can be significant overhead in using the generic interfaces. A number of convenience routines may be able to avoid extra Object creation, and so are recommended for efficiency. The following may avoid the overhead of creating the StructureData object:
Array getArray(int recno, StructureMembers.Member m)The following can be convenient for accessing all the data in the ArrayStructure for one member, but its efficiency depends on the implementation:
Array getMemberArray(StructureMembers.Member m)These require that you know the data types of the member data, but they are the most efficent:
getScalarXXX(int recnum, Member m) getJavaArrayXXX(int recnum, Member m)where XXX is Byte, Char, Double, Float, Int, Long, Short, or String. For members that are themselves Structures, the equivilent is:
StructureData getScalarStructure(int recnum, Member m) ArrayStructure getArrayStructure(int recnum, Member m)These will return any compatible type as a double or float, but will have extra overhead when the types dont match:
convertScalarXXX(int recnum, Member m) convertJavaArrayXXX(int recnum, Member m)where XXX is Double or Float
Array
,
StructureData
Modifier and Type | Class and Description |
---|---|
class |
ArrayStructure.ArrayStructureIterator |
Modifier and Type | Method and Description |
---|---|
double |
convertScalarDouble(int recnum,
StructureMembers.Member m)
Get scalar value as a double, with conversion as needed.
|
float |
convertScalarFloat(int recnum,
StructureMembers.Member m)
Get scalar value as a float, with conversion as needed.
|
int |
convertScalarInt(int recnum,
StructureMembers.Member m)
Get scalar value as an int, with conversion as needed.
|
long |
convertScalarLong(int recnum,
StructureMembers.Member m) |
Array |
copy()
DO NOT USE, throws UnsupportedOperationException
|
Array |
createView(Index index)
create new Array with given Index and the same backing store
|
Array |
extractMemberArray(StructureMembers.Member m)
Extract data for one member, over all structures.
|
StructureMembers.Member |
findMember(String memberName)
Find a member by its name.
|
Array |
getArray(int recno,
StructureMembers.Member m)
Get member data of any type for a specific record as an Array.
|
ArrayObject |
getArrayObject(int recnum,
StructureMembers.Member m)
Get member data of type ArrayObject
|
ArraySequence |
getArraySequence(int recnum,
StructureMembers.Member m)
Get member data of type ArraySequence
|
ArrayStructure |
getArrayStructure(int recnum,
StructureMembers.Member m)
Get member data of type array of Structure.
|
boolean |
getBoolean(Index i)
DO NOT USE, throw ForbiddenConversionException
|
boolean |
getBoolean(int index) |
byte |
getByte(Index i)
DO NOT USE, throw ForbiddenConversionException
|
byte |
getByte(int index) |
char |
getChar(Index i)
DO NOT USE, throw ForbiddenConversionException
|
char |
getChar(int index) |
double |
getDouble(Index i)
DO NOT USE, throw ForbiddenConversionException
|
double |
getDouble(int index) |
Class |
getElementType()
Get the element class type of this Array
|
float |
getFloat(Index i)
DO NOT USE, throw ForbiddenConversionException
|
float |
getFloat(int index) |
int |
getInt(Index i)
DO NOT USE, throw ForbiddenConversionException
|
int |
getInt(int index) |
byte[] |
getJavaArrayByte(int recnum,
StructureMembers.Member m)
Get member data of type byte as a 1D array.
|
char[] |
getJavaArrayChar(int recnum,
StructureMembers.Member m)
Get member data of type char as a 1D array.
|
double[] |
getJavaArrayDouble(int recnum,
StructureMembers.Member m)
Get member data of type double as a 1D array.
|
float[] |
getJavaArrayFloat(int recnum,
StructureMembers.Member m)
Get member data of type float as a 1D array.
|
int[] |
getJavaArrayInt(int recnum,
StructureMembers.Member m)
Get member data of type int as a 1D array.
|
long[] |
getJavaArrayLong(int recnum,
StructureMembers.Member m)
Get member data of type long as a 1D array.
|
short[] |
getJavaArrayShort(int recnum,
StructureMembers.Member m)
Get member data of type short as a 1D array.
|
String[] |
getJavaArrayString(int recnum,
StructureMembers.Member m)
Get member data of type String as a 1D array.
|
long |
getLong(Index i)
DO NOT USE, throw ForbiddenConversionException
|
long |
getLong(int index) |
List<StructureMembers.Member> |
getMembers()
Get a list of structure members.
|
Object |
getObject(Index i)
Get the index-th StructureData of this ArrayStructure.
|
Object |
getObject(int index)
Get the index-th StructureData of this ArrayStructure.
|
byte |
getScalarByte(int recnum,
StructureMembers.Member m)
Get scalar member data of type byte.
|
char |
getScalarChar(int recnum,
StructureMembers.Member m)
Get scalar member data of type char.
|
double |
getScalarDouble(int recnum,
StructureMembers.Member m)
Get scalar member data of type double.
|
float |
getScalarFloat(int recnum,
StructureMembers.Member m)
Get scalar member data of type float.
|
int |
getScalarInt(int recnum,
StructureMembers.Member m)
Get scalar member data of type int.
|
long |
getScalarLong(int recnum,
StructureMembers.Member m)
Get scalar member data of type long.
|
Object |
getScalarObject(int recno,
StructureMembers.Member m)
Get member data array of any type as an Object, eg, Float, Double, String, StructureData etc.
|
short |
getScalarShort(int recnum,
StructureMembers.Member m)
Get scalar member data of type short.
|
String |
getScalarString(int recnum,
StructureMembers.Member m)
Get member data of type String or char.
|
StructureData |
getScalarStructure(int recnum,
StructureMembers.Member m)
Get member data of type Structure.
|
short |
getShort(Index i)
DO NOT USE, throw ForbiddenConversionException
|
short |
getShort(int index) |
long |
getSizeBytes()
Get the total number of bytes in the array.
|
Object |
getStorage()
Get underlying primitive array storage.
|
StructureData |
getStructureData(Index i)
Get the index-th StructureData of this ArrayStructure.
|
StructureData |
getStructureData(int index)
Get the index-th StructureData of this ArrayStructure.
|
StructureDataIterator |
getStructureDataIterator() |
List<String> |
getStructureMemberNames()
Get a list structure member names.
|
StructureMembers |
getStructureMembers()
Get the StructureMembers object.
|
int |
getStructureSize()
Get the size of each StructureData object in bytes.
|
Iterator<StructureData> |
iterator() |
Array |
sectionNoReduce(List<Range> ranges)
Create a new Array as a subsection of this Array, without rank reduction.
|
void |
setBoolean(Index i,
boolean value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setBoolean(int index,
boolean value) |
void |
setByte(Index i,
byte value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setByte(int index,
byte value) |
void |
setChar(Index i,
char value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setChar(int index,
char value) |
void |
setDouble(Index i,
double value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setDouble(int index,
double value) |
void |
setFloat(Index i,
float value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setFloat(int index,
float value) |
void |
setInt(Index i,
int value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setInt(int index,
int value) |
void |
setLong(Index i,
long value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setLong(int index,
long value) |
void |
setMemberArray(StructureMembers.Member m,
Array memberArray)
Set data for one member, over all structures.
|
void |
setObject(Index i,
Object value)
Set one of the StructureData of this ArrayStructure.
|
void |
setObject(int index,
Object value)
Set the index-th StructureData of this ArrayStructure.
|
void |
setShort(Index i,
short value)
DO NOT USE, throw ForbiddenConversionException
|
void |
setShort(int index,
short value) |
void |
showInternal(Formatter f,
Indent indent) |
void |
showInternalMembers(Formatter f,
Indent indent) |
arraycopy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factoryConstant, flip, get1DJavaArray, getDataAsByteBuffer, getDataAsByteBuffer, getDataAsByteBuffer, getDataType, getIndex, getIndexIterator, getRangeIterator, getRank, getShape, getSize, 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, shapeToString, slice, toString, transpose
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public double convertScalarDouble(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- member Variable.ForbiddenConversionException
- if not convertible to double.public float convertScalarFloat(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- member Variable.ForbiddenConversionException
- if not convertible to float.public int convertScalarInt(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- member Variable.ForbiddenConversionException
- if not convertible to double.public long convertScalarLong(int recnum, StructureMembers.Member m)
public Array copy()
public Array createView(Index index)
Array
index
- use this Indexpublic Array extractMemberArray(StructureMembers.Member m) throws IOException
m
- get data from this StructureMembers.Member.IOException
- on read error (only happens for Sequences, otherwise data is already read)public StructureMembers.Member findMember(String memberName)
memberName
- find member with this namepublic Array getArray(int recno, StructureMembers.Member m)
recno
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member.public ArrayObject getArrayObject(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type Structure.public ArraySequence getArraySequence(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type Structure.public ArrayStructure getArrayStructure(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type Structure.public boolean getBoolean(Index i)
getBoolean
in class Array
i
- Index with current element setindex
cast to boolean if necessary.public boolean getBoolean(int index)
getBoolean
in class Array
public byte getByte(Index i)
public char getChar(Index i)
public double getDouble(Index i)
public Class getElementType()
Array
getElementType
in class Array
public float getFloat(Index i)
public int getInt(Index i)
public byte[] getJavaArrayByte(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type byte.public char[] getJavaArrayChar(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type char.public double[] getJavaArrayDouble(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type double.public float[] getJavaArrayFloat(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type float.public int[] getJavaArrayInt(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type int.public long[] getJavaArrayLong(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type long.public short[] getJavaArrayShort(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type float.public String[] getJavaArrayString(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type String.public long getLong(Index i)
public List<StructureMembers.Member> getMembers()
public Object getObject(int index)
public byte getScalarByte(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type byte.public char getScalarChar(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type char.public double getScalarDouble(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type double.public float getScalarFloat(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type float.public int getScalarInt(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type int.public long getScalarLong(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type long.public Object getScalarObject(int recno, StructureMembers.Member m)
recno
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member.public short getScalarShort(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type short.public String getScalarString(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type String or char.public StructureData getScalarStructure(int recnum, StructureMembers.Member m)
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member. Must be of type Structure.public short getShort(Index i)
public long getSizeBytes()
Array
getSizeBytes
in class Array
public Object getStorage()
Array
getStorage
in class Array
public StructureData getStructureData(Index i)
i
- which one to get, specified by an Index.public StructureData getStructureData(int index)
index
- which one to get, specified by an integer.public StructureDataIterator getStructureDataIterator()
public List<String> getStructureMemberNames()
public StructureMembers getStructureMembers()
public int getStructureSize()
public Iterator<StructureData> iterator()
iterator
in interface Iterable<StructureData>
public Array sectionNoReduce(List<Range> ranges)
Array
sectionNoReduce
in class Array
ranges
- list of Ranges that specify the array subset.
Must be same rank as original Array.
A particular Range: 1) may be a subset, or 2) may be null, meaning use entire Range.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 void setBoolean(int index, boolean value)
setBoolean
in class Array
public void setByte(Index i, byte value)
public void setChar(Index i, char value)
public void setDouble(Index i, double value)
public void setFloat(Index i, float value)
public void setInt(Index i, int value)
public void setLong(Index i, long value)
public void setMemberArray(StructureMembers.Member m, Array memberArray)
m
- set data for this StructureMembers.Member.memberArray
- Array values.public void setObject(Index i, Object value)
public void setObject(int index, Object value)
public void setShort(Index i, short value)