## dods.dap
Class Float64PrimitiveVector

    java.lang.Object
      dods.dap.PrimitiveVector
          dods.dap.Float64PrimitiveVector

All Implemented Interfaces:
  ClientIO, Cloneable

public class Float64PrimitiveVector
extends PrimitiveVector
implements Cloneable

A vector of doubles.

See Also:
  `PrimitiveVector`

Constructor Summary
`Float64PrimitiveVector(BaseType var)` Constructs a new `Float64PrimitiveVector`.

Method Summary
`Object` `clone()` Returns a clone of this `Float64PrimitiveVector`.
`void` `deserialize(DataInputStream source, ServerVersion sv, StatusUI statusUI)` Reads data from a `DataInputStream`.
`void` `externalize(DataOutputStream sink)` Writes data to a `DataOutputStream`.
`void` `externalize(DataOutputStream sink, int start, int stop, int stride)` Write a subset of the data to a `DataOutputStream`.
`Object` `getInternalStorage()` Returns (a reference to) the internal storage for this PrimitiveVector object.
`int` `getLength()` Returns the number of elements in the array.
`double` `getValue(int i)` Return the i'th value as a `double`.
`void` `printSingleVal(PrintWriter os, int index)` Prints the value of a single variable in this vector.
`void` `printVal(PrintWriter os, String space)` Prints the value of all variables in this vector.
`void` `setInternalStorage(Object o)` Set the internal storage for PrimitiveVector.
`void` `setLength(int len)` Sets the number of elements in the array.
`void` `setValue(int i, double newVal)` Set the i'th value of the array.
`PrimitiveVector` `subset(int start, int stop, int stride)` Create a new primitive vector using a subset of the data.

Methods inherited from class dods.dap.PrimitiveVector
`getTemplate, printDecl, printDecl`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Float64PrimitiveVector

    public Float64PrimitiveVector(BaseType var)

  Constructs a new `Float64PrimitiveVector`.

Parameters:
  `var` - the template `BaseType` to use.

Method Detail

### clone

    public Object clone()

  Returns a clone of this `Float64PrimitiveVector`. A deep copy is performed on all data inside the variable.

  Overrides:
    `clone` in class `PrimitiveVector`
  Returns:
    a clone of this `Float64PrimitiveVector`.

### getLength

    public int getLength()

  Returns the number of elements in the array.

  Specified by:
    `getLength` in class `PrimitiveVector`
  Returns:
    the number of elements in the array.

### setLength

    public 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.

  Specified by:
    `setLength` in class `PrimitiveVector`
  Parameters:
    `len` - the number of elements in the array.

### getValue

    public final double getValue(int i)

  Return the i'th value as a `double`.

  Parameters:
    `i` - the index of the value to return.
  Returns:
    the i'th value.

### setValue

    public final void setValue(int i,
                               double newVal)

  Set the i'th value of the array.

  Parameters:
    `i` - the index of the value to set.
    `newVal` - the new value.

### printVal

    public void printVal(PrintWriter os,
                         String space)

  Prints the value of all variables in this vector. This method is primarily intended for debugging DODS applications and text-based clients such as geturl.

  Specified by:
    `printVal` in class `PrimitiveVector`
  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 void printSingleVal(PrintWriter os,
                               int index)

  Prints the value of a single variable in this vector. method is used by `DArray`'s `printVal` method.

  Specified by:
    `printSingleVal` in class `PrimitiveVector`
  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)`

### deserialize

    public void deserialize(DataInputStream source,
                            ServerVersion sv,
                            StatusUI statusUI)
                     throws IOException,
                            EOFException,
                            DataReadException

  Reads data from a `DataInputStream`. This method is only used on the client side of the DODS client/server connection.

  Specified by:
    `deserialize` in interface `ClientIO`
  Specified by:
    `deserialize` in class `PrimitiveVector`
  Parameters:
    `source` - a `DataInputStream` to read from.
    `sv` - The `ServerVersion` returned by the server. (used by `DSequence` to determine which protocol version was used).
    `statusUI` - The `StatusUI` object to use for GUI updates and user cancellation notification (may be null).
  Throws:
    `DataReadException` - when invalid data is read, or if the user cancels the download.
    `EOFException` - if EOF is found before the variable is completely deserialized.
    `IOException` - thrown on any other InputStream exception.
  See Also:
    `ClientIO.deserialize(DataInputStream, ServerVersion, StatusUI)`

### externalize

    public void externalize(DataOutputStream sink)
                     throws IOException

  Writes data to a `DataOutputStream`. This method is used primarily by GUI clients which need to download DODS data, manipulate it, and then re-save it as a binary file.

  Specified by:
    `externalize` in interface `ClientIO`
  Specified by:
    `externalize` in class `PrimitiveVector`
  Parameters:
    `sink` - a `DataOutputStream` to write to.
  Throws:
    `IOException` - thrown on any `OutputStream` exception.

### externalize

    public void externalize(DataOutputStream sink,
                            int start,
                            int stop,
                            int stride)
                     throws IOException

  Write a subset of the data to a `DataOutputStream`.

  Parameters:
    `sink` - a `DataOutputStream` to write to.
  Throws:
    `IOException` - thrown on any `OutputStream` exception.

### getInternalStorage

    public Object getInternalStorage()

  Returns (a reference to) the internal storage for this PrimitiveVector object.

  ## WARNING:

  Because this method breaks encapsulation rules the user must beware! If we (the DODS 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.

  Specified by:
    `getInternalStorage` in class `PrimitiveVector`
  Returns:
    The internal array of doubles.

### setInternalStorage

    public void setInternalStorage(Object o)

  Set the internal storage for PrimitiveVector.

  ## WARNING:

  Because this method breaks encapsulation rules the user must beware! If we (the DODS 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.

  Specified by:
    `setInternalStorage` in class `PrimitiveVector`

### subset

    public PrimitiveVector subset(int start,
                                  int stop,
                                  int stride)

  Create a new primitive vector using a subset of the data.

  Specified by:
    `subset` in class `PrimitiveVector`
  Returns:
    new primitive vector, of type Float64PrimitiveVector.