public class ArrayStructureBB extends ArrayStructure
Structure pdata = (Structure) ncfile.findVariable(name); StructureMembers members = pdata.makeStructureMembers(); members.findMember("value").setDataParam(0); // these are the offsets into the record members.findMember("x_start").setDataParam(2); members.findMember("y_start").setDataParam(4); members.findMember("direction").setDataParam(6); members.findMember("speed").setDataParam(8); int recsize = pos[1] - pos[0]; // each record must be all the same size members.setStructureSize(recsize); ArrayStructureBB asbb = new ArrayStructureBB(members, new int[] {size}, bos, pos[0]);For String members, you must store the Strings in the stringHeap. An integer index into the heap is used in the ByteBuffer.
Array
ArrayStructure.ArrayStructureIterator
Constructor and Description |
---|
ArrayStructureBB(StructureMembers members,
int[] shape)
Create a new Array of type StructureData and the given members and shape.
|
ArrayStructureBB(StructureMembers members,
int[] shape,
java.nio.ByteBuffer bbuffer,
int offset)
Construct an ArrayStructureBB with the given ByteBuffer.
|
Modifier and Type | Method and Description |
---|---|
void |
addObjectToHeap(int recnum,
StructureMembers.Member m,
java.lang.Object s) |
int |
addObjectToHeap(java.lang.Object s) |
Array |
getArray(int recnum,
StructureMembers.Member m)
Get member data of any type for a specific record as an Array.
|
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.
|
java.nio.ByteBuffer |
getByteBuffer()
Return backing storage as a ByteBuffer
|
java.util.List<java.lang.Object> |
getHeap()
DO NOT MODIFY
|
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.
|
java.lang.String[] |
getJavaArrayString(int recnum,
StructureMembers.Member m)
Get member data of type String as a 1D array.
|
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.
|
short |
getScalarShort(int recnum,
StructureMembers.Member m)
Get scalar member data of type short.
|
java.lang.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.
|
static int |
setOffsets(StructureMembers members)
Set the offsets, based on m.getSizeBytes().
|
void |
showInternal(java.util.Formatter f,
Indent indent) |
static int |
showOffsets(StructureMembers members,
Indent indent,
java.util.Formatter f) |
convertScalarDouble, convertScalarFloat, convertScalarInt, convertScalarLong, copy, createView, extractMemberArray, findMember, getArrayObject, getBoolean, getBoolean, getByte, getByte, getChar, getChar, getDouble, getDouble, getElementType, getFloat, getFloat, getInt, getInt, getLong, getLong, getMembers, getObject, getObject, getScalarObject, getShort, getShort, getSizeBytes, getStorage, getStructureData, getStructureData, getStructureDataIterator, getStructureMemberNames, getStructureMembers, getStructureSize, iterator, sectionNoReduce, setBoolean, setBoolean, setByte, setByte, setChar, setChar, setDouble, setDouble, setFloat, setFloat, setInt, setInt, setLong, setLong, setMemberArray, setObject, setObject, setShort, setShort, showInternalMembers
arraycopy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factoryConstant, factoryCopy, 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
public ArrayStructureBB(StructureMembers members, int[] shape)
byte[] result = (byte[]) structureArray.getStorage();
members
- a description of the structure membersshape
- the shape of the Array.public ArrayStructureBB(StructureMembers members, int[] shape, java.nio.ByteBuffer bbuffer, int offset)
members
- the list of structure members.shape
- the shape of the structure arraybbuffer
- the data is stored in this ByteBuffer. bbuffer.order must already be set.offset
- offset from the start of the ByteBufffer to the first record.public void addObjectToHeap(int recnum, StructureMembers.Member m, java.lang.Object s)
public int addObjectToHeap(java.lang.Object s)
public Array getArray(int recnum, StructureMembers.Member m)
ArrayStructure
getArray
in class ArrayStructure
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member.public ArraySequence getArraySequence(int recnum, StructureMembers.Member m)
ArrayStructure
getArraySequence
in class ArrayStructure
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)
ArrayStructure
getArrayStructure
in class ArrayStructure
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 java.nio.ByteBuffer getByteBuffer()
public java.util.List<java.lang.Object> getHeap()
public byte[] getJavaArrayByte(int recnum, StructureMembers.Member m)
ArrayStructure
getJavaArrayByte
in class ArrayStructure
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)
ArrayStructure
getJavaArrayChar
in class ArrayStructure
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)
ArrayStructure
getJavaArrayDouble
in class ArrayStructure
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)
ArrayStructure
getJavaArrayFloat
in class ArrayStructure
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)
ArrayStructure
getJavaArrayInt
in class ArrayStructure
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)
ArrayStructure
getJavaArrayLong
in class ArrayStructure
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)
ArrayStructure
getJavaArrayShort
in class ArrayStructure
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 java.lang.String[] getJavaArrayString(int recnum, StructureMembers.Member m)
ArrayStructure
getJavaArrayString
in class ArrayStructure
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 byte getScalarByte(int recnum, StructureMembers.Member m)
ArrayStructure
getScalarByte
in class ArrayStructure
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)
ArrayStructure
getScalarChar
in class ArrayStructure
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)
ArrayStructure
getScalarDouble
in class ArrayStructure
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)
ArrayStructure
getScalarFloat
in class ArrayStructure
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)
ArrayStructure
getScalarInt
in class ArrayStructure
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)
ArrayStructure
getScalarLong
in class ArrayStructure
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 getScalarShort(int recnum, StructureMembers.Member m)
ArrayStructure
getScalarShort
in class ArrayStructure
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 java.lang.String getScalarString(int recnum, StructureMembers.Member m)
ArrayStructure
getScalarString
in class ArrayStructure
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)
ArrayStructure
getScalarStructure
in class ArrayStructure
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 static int setOffsets(StructureMembers members)
members
- set offsets for these memberspublic void showInternal(java.util.Formatter f, Indent indent)
showInternal
in class ArrayStructure
public static int showOffsets(StructureMembers members, Indent indent, java.util.Formatter f)