Package ucar.ma2
Class ArrayStructureW
- java.lang.Object
-
- ucar.ma2.Array
-
- ucar.ma2.ArrayStructure
-
- ucar.ma2.ArrayStructureW
-
- All Implemented Interfaces:
Iterable<StructureData>
public class ArrayStructureW extends ArrayStructure
Concrete implementation of ArrayStructure, with data access deferred to the StructureData objects. The StructureData objects may be of any subclass. Using ArrayStructureW and StructureDataW is often the easiest to construct, but not efficient for large arrays of Structures due to excessive object creation.- See Also:
Array
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ucar.ma2.ArrayStructure
ArrayStructure.ArrayStructureIterator
-
-
Constructor Summary
Constructors Constructor Description ArrayStructureW(StructureData sdata)
ArrayStructureW(StructureMembers members, int[] shape)
Create a new Array of type StructureData and the given members and shape.ArrayStructureW(StructureMembers members, int[] shape, StructureData[] sdata)
Create a new Array of type StructureData and the given members, shape, and array of StructureData.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 ArraySequenceArrayStructure
getArrayStructure(int recnum, StructureMembers.Member m)
Get member data of type array of Structure.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.protected StructureData
makeStructureData(ArrayStructure as, int index)
void
setStructureData(StructureData sd, int index)
Set one of the StructureData of this ArrayStructure.-
Methods inherited from class ucar.ma2.ArrayStructure
convertScalarDouble, convertScalarFloat, convertScalarInt, convertScalarLong, copy, copyBytes, copyChars, copyDoubles, copyFloats, copyFrom1DJavaArray, copyInts, copyLongs, copyObjects, copySequences, copyShorts, copyStructures, copyTo1DJavaArray, 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, showInternal, showInternalMembers
-
Methods inherited from class ucar.ma2.Array
arraycopy, copyTo1DJavaArray, copyToNDJavaArray, factory, factory, factory, factory, factoryConstant, factoryCopy, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ArrayStructureW
public ArrayStructureW(StructureMembers members, int[] shape)
Create a new Array of type StructureData and the given members and shape. You must completely construct by calling setStructureData()- Parameters:
members
- a description of the structure membersshape
- the shape of the Array.
-
ArrayStructureW
public ArrayStructureW(StructureData sdata)
-
ArrayStructureW
public ArrayStructureW(StructureMembers members, int[] shape, StructureData[] sdata)
Create a new Array of type StructureData and the given members, shape, and array of StructureData.- Parameters:
members
- a description of the structure membersshape
- the shape of the Array.sdata
- StructureData array, must be
-
-
Method Detail
-
setStructureData
public void setStructureData(StructureData sd, int index)
Set one of the StructureData of this ArrayStructure.- Parameters:
sd
- set it to this StructureData.index
- which one to set, as an index into 1D backing store.
-
makeStructureData
protected StructureData makeStructureData(ArrayStructure as, int index)
- Specified by:
makeStructureData
in classArrayStructure
-
getArray
public Array getArray(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of any type for a specific record as an Array. This may avoid the overhead of creating the StructureData object, but is equivilent to getStructure(recno).getArray( Member m).- Overrides:
getArray
in classArrayStructure
- Parameters:
recnum
- get data from the recnum-th StructureData of the ArrayStructure. Must be less than getSize();m
- get data from this StructureMembers.Member.- Returns:
- Array values.
-
getScalarDouble
public double getScalarDouble(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type double.- Overrides:
getScalarDouble
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayDouble
public double[] getJavaArrayDouble(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type double as a 1D array. The member data may be any rank.- Overrides:
getJavaArrayDouble
in classArrayStructure
- Parameters:
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.- Returns:
- double[]
-
getScalarFloat
public float getScalarFloat(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type float.- Overrides:
getScalarFloat
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayFloat
public float[] getJavaArrayFloat(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type float as a 1D array.- Overrides:
getJavaArrayFloat
in classArrayStructure
- Parameters:
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.- Returns:
- float[]
-
getScalarByte
public byte getScalarByte(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type byte.- Overrides:
getScalarByte
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayByte
public byte[] getJavaArrayByte(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type byte as a 1D array.- Overrides:
getJavaArrayByte
in classArrayStructure
- Parameters:
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.- Returns:
- byte[]
-
getScalarShort
public short getScalarShort(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type short.- Overrides:
getScalarShort
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayShort
public short[] getJavaArrayShort(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type short as a 1D array.- Overrides:
getJavaArrayShort
in classArrayStructure
- Parameters:
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.- Returns:
- short[]
-
getScalarInt
public int getScalarInt(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type int.- Overrides:
getScalarInt
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayInt
public int[] getJavaArrayInt(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type int as a 1D array.- Overrides:
getJavaArrayInt
in classArrayStructure
- Parameters:
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.- Returns:
- int[]
-
getScalarLong
public long getScalarLong(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type long.- Overrides:
getScalarLong
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayLong
public long[] getJavaArrayLong(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type long as a 1D array.- Overrides:
getJavaArrayLong
in classArrayStructure
- Parameters:
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.- Returns:
- long[]
-
getScalarChar
public char getScalarChar(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get scalar member data of type char.- Overrides:
getScalarChar
in classArrayStructure
- Parameters:
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.- Returns:
- scalar double value
-
getJavaArrayChar
public char[] getJavaArrayChar(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type char as a 1D array.- Overrides:
getJavaArrayChar
in classArrayStructure
- Parameters:
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.- Returns:
- char[]
-
getScalarString
public String getScalarString(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type String or char.- Overrides:
getScalarString
in classArrayStructure
- Parameters:
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.- Returns:
- scalar String value
-
getJavaArrayString
public String[] getJavaArrayString(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type String as a 1D array.- Overrides:
getJavaArrayString
in classArrayStructure
- Parameters:
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.- Returns:
- String[]
-
getScalarStructure
public StructureData getScalarStructure(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type Structure.- Overrides:
getScalarStructure
in classArrayStructure
- Parameters:
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.- Returns:
- scalar StructureData
-
getArrayStructure
public ArrayStructure getArrayStructure(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type array of Structure.- Overrides:
getArrayStructure
in classArrayStructure
- Parameters:
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.- Returns:
- nested ArrayStructure.
-
getArraySequence
public ArraySequence getArraySequence(int recnum, StructureMembers.Member m)
Description copied from class:ArrayStructure
Get member data of type ArraySequence- Overrides:
getArraySequence
in classArrayStructure
- Parameters:
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.- Returns:
- nested ArrayStructure.
-
-