Package ucar.ma2

Class 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
    • 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 members
        shape - 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 members
        shape - 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.
      • 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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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 class ArrayStructure
        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.