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,
ByteBuffer bbuffer,
int offset)
Construct an ArrayStructureBB with the given ByteBuffer.
|
Modifier and Type | Method and Description |
---|---|
void |
addObjectToHeap(int recnum,
StructureMembers.Member m,
Object s) |
int |
addObjectToHeap(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.
|
ByteBuffer |
getByteBuffer()
Return backing storage as a ByteBuffer
|
List<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.
|
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.
|
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(Formatter f,
Indent indent) |
static int |
showOffsets(StructureMembers members,
Indent indent,
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, flip, get1DJavaArray, 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 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, 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 static int setOffsets(StructureMembers members)
members
- set offsets for these memberspublic static int showOffsets(StructureMembers members, Indent indent, Formatter f)
public ByteBuffer getByteBuffer()
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 int addObjectToHeap(Object s)
public void addObjectToHeap(int recnum, StructureMembers.Member m, Object s)
public void showInternal(Formatter f, Indent indent)
showInternal
in class ArrayStructure