Package opendap.dap

Class PrimitiveVector

    • Constructor Detail

      • PrimitiveVector

        public PrimitiveVector​(BaseType var)
        Constructs a new PrimitiveVector.
        Parameters:
        var - the template BaseType to use.
    • Method Detail

      • getLength

        public abstract int getLength()
        Returns the number of elements in the array.
        Returns:
        the number of elements in the array.
      • setLength

        public abstract void setLength​(int len)
        Sets the number of elements in the array. Allocates a new primitive array of the desired size. Note that if this is called multiple times, the old array and its contents will be lost.

        Only called inside of deserialize method or in derived classes on server.

        Parameters:
        len - the number of elements in the array.
      • externalize

        public abstract void externalize​(DataOutputStream sink)
                                  throws IOException
        Writes data to a DataOutputStream. This method is used primarily by GUI clients which need to download OPeNDAP data, manipulate it, and then re-save it as a binary file.
        Specified by:
        externalize in interface ClientIO
        Parameters:
        sink - a DataOutputStream to write to.
        Throws:
        IOException - thrown on any OutputStream exception.
      • printDecl

        public final void printDecl​(PrintWriter os,
                                    String space,
                                    boolean print_semi,
                                    boolean constrained)
        Write the variable's declaration in a C-style syntax. This method is used to create textual representation of the Data Descriptor Structure (DDS).
        Parameters:
        os - The PrintWriter on which to print the declaration.
        space - Each line of the declaration will begin with the characters in this string. Usually used for leading spaces.
        print_semi - a boolean value indicating whether to print a semicolon at the end of the declaration.
        constrained - a boolean value indicating whether to print the declartion dependent on the projection information. This is only used by Server side code.
        See Also:
        BaseType.printDecl(PrintWriter, String, boolean, boolean)
      • printDecl

        public final void printDecl​(PrintWriter os,
                                    String space,
                                    boolean print_semi)
        Write the variable's declaration in a C-style syntax. This method is used to create textual representation of the Data Descriptor Structure (DDS).
        Parameters:
        os - The PrintWriter on which to print the declaration.
        space - Each line of the declaration will begin with the characters in this string. Usually used for leading spaces.
        print_semi - a boolean value indicating whether to print a semicolon at the end of the declaration.
        See Also:
        BaseType.printDecl(PrintWriter, String, boolean)
      • getTypeName

        public String getTypeName()
        Returns the OPeNDAP type name of the class instance as a String.
        Returns:
        the OPeNDAP type name of the class instance as a String.
      • printVal

        public abstract void printVal​(PrintWriter os,
                                      String space)
        Prints the value of all variables in this vector. This method is primarily intended for debugging OPeNDAP applications and text-based clients such as geturl.
        Parameters:
        os - the PrintWriter on which to print the value.
        space - this value is passed to the printDecl method, and controls the leading spaces of the output.
        See Also:
        BaseType.printVal(PrintWriter, String, boolean)
      • printSingleVal

        public abstract void printSingleVal​(PrintWriter os,
                                            int index)
        Prints the value of a single variable in this vector. method is used by DArray's printVal method.
        Parameters:
        os - the PrintWriter on which to print the value.
        index - the index of the variable to print.
        See Also:
        DArray.printVal(PrintWriter, String, boolean)
      • getInternalStorage

        public abstract Object getInternalStorage()
        Returns (a reference to) the internal storage for PrimitiveVector.

        WARNING:

        Because this method breaks encapsulation rules the user must beware! If we (the OPeNDAP prgramming team) choose to change the internal representation(s) of these types your code will probably break.

        This method is provided as an optimization to eliminate massive copying of data.

      • setInternalStorage

        public abstract void setInternalStorage​(Object o)
        Set the internal storage for PrimitiveVector.

        WARNING:

        Because this method breaks encapsulation rules the user must beware! If we (the OPeNDAP prgramming team) choose to change the internal representation(s) of these types your code will probably break.

        This method is provided as an optimization to eliminate massive copying of data.

      • subset

        public abstract PrimitiveVector subset​(int start,
                                               int stop,
                                               int stride)
        Create a new primitive vector using a subset of the data.
        Parameters:
        start - starting index (i=start)
        stop - ending index (i<=stop)
        stride - index stride (i+=stride)
        Returns:
        new primitive vector