Package ucar.ma2

Class ArraySequenceNested

  • All Implemented Interfaces:
    Iterable<StructureData>

    public class ArraySequenceNested
    extends ArrayStructure
    Handles nested sequences: a 1D array of variable length 1D arrays of StructureData. Uses same technique as ArrayStructureMA for the inner fields; data storage is in member arrays. Used only by opendap internals. Example use:
     ArraySequence aseq = new ArraySequence(members, outerLength);
     for (int seq = 0; seq < outerLength; seq++) {
       aseq.setSequenceLength(seq, seqLength);
     }
     aseq.finish();
     
    • Constructor Detail

      • ArraySequenceNested

        public ArraySequenceNested​(StructureMembers members,
                                   int nseq)
        This is used for inner sequences, ie variable length structures nested inside of another structure.
        Parameters:
        members - the members of the STructure
        nseq - the number of sequences, ie the length of the outer structure.
    • Method Detail

      • getStructureData

        public StructureData getStructureData​(int index)
        Description copied from class: ArrayStructure
        Get the index-th StructureData of this ArrayStructure.
        Overrides:
        getStructureData in class ArrayStructure
        Parameters:
        index - which one to get, specified by an integer.
        Returns:
        object of type StructureData.
      • setSequenceLength

        public void setSequenceLength​(int outerIndex,
                                      int len)
        Set the length of one of the sequences.
        Parameters:
        outerIndex - which sequence?
        len - what is its length?
      • getSequenceLength

        public int getSequenceLength​(int outerIndex)
        Get the length of the ith sequence.
        Parameters:
        outerIndex - which sequence?
        Returns:
        its length
      • getSequenceOffset

        public int getSequenceOffset​(int outerIndex)
        Get the the starting index of the ith sequence.
        Parameters:
        outerIndex - which sequence?
        Returns:
        its starting index
      • finish

        public void finish()
        Call this when you have set all the sequence lengths.
      • getTotalNumberOfStructures

        public int getTotalNumberOfStructures()
        Returns:
        the total number of Structures over all the nested sequences.
      • flatten

        public ArrayStructure flatten()
        Flatten the Structures into a 1D array of Structures of length getTotalNumberOfStructures().
        Returns:
        Array of Structures
      • 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.