public abstract class DVector extends BaseType implements ClientIO
DList
and DArray
.
This class uses a PrimitiveVector
to hold the data and
deserialize it, thus allowing more efficient storage to be used for the
primitive types.BaseType
,
DArray
,
PrimitiveVector
,
Serialized FormDAPNode.CloneMap
_nameClear, _nameEncoded, log
Constructor and Description |
---|
DVector()
Constructs a new
DVector . |
DVector(java.lang.String n)
Constructs a new
DVector with name n . |
Modifier and Type | Method and Description |
---|---|
void |
addVariable(BaseType v)
Adds a variable to the container.
|
DAPNode |
cloneDAG(DAPNode.CloneMap map)
Returns a clone of this
Vector . |
void |
deserialize(java.io.DataInputStream source,
ServerVersion sv,
StatusUI statusUI)
Reads data from a
DataInputStream . |
void |
externalize(java.io.DataOutputStream sink)
Writes data to a
DataOutputStream . |
BaseType |
getContainerVar() |
int |
getLength()
Returns the number of elements in the vector.
|
PrimitiveVector |
getPrimitiveVector()
Returns the
PrimitiveVector for this vector. |
java.lang.String |
getTypeName()
Returns the OPeNDAP type name of the class instance as a
String . |
void |
printDecl(java.io.PrintWriter os,
java.lang.String space,
boolean print_semi,
boolean constrained)
Write the variable's declaration in a C-style syntax.
|
void |
printVal(java.io.PrintWriter os,
java.lang.String space,
boolean print_decl_p)
Prints the value of the variable, with its declaration.
|
void |
setContainerVar(BaseType var) |
void |
setLength(int len)
Sets the number of elements in the vector.
|
addAttributeAlias, addAttributeContainer, appendAttribute, appendAttribute, appendAttributeContainer, checkSemantics, checkSemantics, delAttribute, delAttribute, elementCount, elementCount, getAttribute, getAttribute, getAttributeNames, getAttributeTable, getLongName, hasAttributes, newPrimitiveVector, printAttributes, printAttributes, printAttributes, printAttributes, printConstraint, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, printXML, printXML, printXML, printXML, printXML, setClearName
clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setEncodedName, setParent, setProject, setProject, setProjected
public DVector()
DVector
.public DVector(java.lang.String n)
DVector
with name n
.n
- the name of the variable.public java.lang.String getTypeName()
String
.getTypeName
in class BaseType
String
.public BaseType getContainerVar()
public void setContainerVar(BaseType var)
public int getLength()
public void setLength(int len)
deserialize
method or in derived
classes on server.len
- the number of elements in the array.public void addVariable(BaseType v)
v
- the variable to add.public PrimitiveVector getPrimitiveVector()
PrimitiveVector
for this vector. This can be
cast to the appropriate type and used by a OPeNDAP client to read or set
individual values in the vector.PrimitiveVector
.public void printDecl(java.io.PrintWriter os, java.lang.String space, boolean print_semi, boolean constrained)
printDecl
in class BaseType
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.BaseType.printDecl(PrintWriter, String, boolean)
public void printVal(java.io.PrintWriter os, java.lang.String space, boolean print_decl_p)
printVal
in class BaseType
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.print_decl_p
- a boolean value controlling whether the
variable declaration is printed as well as the value.BaseType.printVal(PrintWriter, String, boolean)
public void deserialize(java.io.DataInputStream source, ServerVersion sv, StatusUI statusUI) throws java.io.IOException, java.io.EOFException, DataReadException
DataInputStream
. This method is only used
on the client side of the OPeNDAP client/server connection.deserialize
in interface ClientIO
source
- a DataInputStream
to read from.sv
- the ServerVersion
returned by the server.statusUI
- the StatusUI
object to use for GUI updates
and user cancellation notification (may be null).java.io.EOFException
- if EOF is found before the variable is completely
deserialized.java.io.IOException
- thrown on any other InputStream exception.DataReadException
- if an unexpected value was read.ClientIO.deserialize(DataInputStream, ServerVersion, StatusUI)
public void externalize(java.io.DataOutputStream sink) throws java.io.IOException
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.externalize
in interface ClientIO
sink
- a DataOutputStream
to write to.java.io.IOException
- thrown on any OutputStream
exception.public DAPNode cloneDAG(DAPNode.CloneMap map) throws java.lang.CloneNotSupportedException
Vector
.
See DAPNode.cloneDag()