public abstract class BaseType extends DAPNode
DFloat64
, DArray
, etc.) subclass it or one of
its two abstract descendents, DVector
or
DConstructor
.
These classes and their methods give a user the capacity to set up
sophisticated data types. They do not provide sophisticated ways to
access and use this data. On the server side, in many cases, the class
instances will have no data in them at all until the serialize
method is called to send data to the client. On the client side, most OPeNDAP
application programs will unpack the data promptly into whatever local
data structure the programmer deems the most useful.
Descendents of this class should implement the ClientIO
interface. That interface defines a deserialize
method used
by a OPeNDAP client to retrieve the variable's declaration and value(s) from
a OPeNDAP server.DDS
,
ClientIO
,
Serialized FormDAPNode.CloneMap
_nameClear, _nameEncoded, log
Constructor and Description |
---|
BaseType()
Constructs a new
BaseType with no name. |
BaseType(java.lang.String clearname)
Constructs a new
BaseType with name n . |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeAlias(java.lang.String alias,
java.lang.String attributeName) |
void |
addAttributeContainer(AttributeTable at) |
void |
appendAttribute(java.lang.String clearname,
int type,
java.lang.String value) |
void |
appendAttribute(java.lang.String clearname,
int type,
java.lang.String value,
boolean check) |
AttributeTable |
appendAttributeContainer(java.lang.String clearname) |
void |
checkSemantics()
Check semantics.
|
void |
checkSemantics(boolean all)
Checks for internal consistency.
|
DAPNode |
cloneDAG(DAPNode.CloneMap map)
Returns a clone of this
BaseType . |
void |
delAttribute(java.lang.String clearname) |
void |
delAttribute(java.lang.String clearname,
int i) |
int |
elementCount()
Returns the number of variables contained in this object.
|
int |
elementCount(boolean leaves)
Returns the number of variables contained in this object.
|
Attribute |
getAttribute() |
Attribute |
getAttribute(java.lang.String clearname) |
java.util.Enumeration |
getAttributeNames() |
AttributeTable |
getAttributeTable() |
java.lang.String |
getLongName() |
abstract java.lang.String |
getTypeName()
Returns the OPeNDAP type name of the class instance as a
String . |
boolean |
hasAttributes() |
PrimitiveVector |
newPrimitiveVector()
Constructs a new
PrimitiveVector object optimized for the
particular data type of this BaseType . |
void |
printAttributes(java.io.OutputStream os) |
void |
printAttributes(java.io.OutputStream os,
java.lang.String pad) |
void |
printAttributes(java.io.PrintWriter pw) |
void |
printAttributes(java.io.PrintWriter pw,
java.lang.String pad) |
void |
printConstraint(java.io.PrintWriter os) |
void |
printDecl(java.io.OutputStream os)
Print the variable's declaration.
|
void |
printDecl(java.io.OutputStream os,
java.lang.String space)
Print the variable's declaration.
|
void |
printDecl(java.io.OutputStream os,
java.lang.String space,
boolean print_semi)
Print the variable's declaration using
OutputStream . |
void |
printDecl(java.io.OutputStream os,
java.lang.String space,
boolean print_semi,
boolean constrained)
Print the variable's declaration using
OutputStream . |
void |
printDecl(java.io.PrintWriter os)
Print the variable's declaration.
|
void |
printDecl(java.io.PrintWriter os,
java.lang.String space)
Print the variable's declaration.
|
void |
printDecl(java.io.PrintWriter os,
java.lang.String space,
boolean print_semi)
Write the variable's declaration in a C-style syntax.
|
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.OutputStream os,
java.lang.String space)
Print the variable's value using
OutputStream . |
void |
printVal(java.io.OutputStream os,
java.lang.String space,
boolean print_decl_p)
Print the variable's value using
OutputStream . |
void |
printVal(java.io.PrintWriter os,
java.lang.String space)
Print the variable's value.
|
abstract void |
printVal(java.io.PrintWriter os,
java.lang.String space,
boolean print_decl_p)
Prints the value of the variable, with its declaration.
|
void |
printXML(java.io.OutputStream os) |
void |
printXML(java.io.OutputStream os,
java.lang.String pad) |
void |
printXML(java.io.PrintWriter pw) |
void |
printXML(java.io.PrintWriter pw,
java.lang.String pad) |
void |
printXML(java.io.PrintWriter pw,
java.lang.String pad,
boolean constrained) |
void |
setClearName(java.lang.String clearname)
Sets the unencoded name of the class instance.
|
clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setEncodedName, setParent, setProject, setProject, setProjected
public BaseType()
BaseType
with no name.public BaseType(java.lang.String clearname)
BaseType
with name n
.
Name is always assumed to be dap encodedclearname
- the name of the variable.public void setClearName(java.lang.String clearname)
setClearName
in class DAPNode
clearname
- the unencoded name of the class instance.public abstract java.lang.String getTypeName()
String
.String
.public int elementCount(boolean leaves)
leaves
to true
.leaves
- If true, count all the simple types in the `tree' of
variables rooted at this variable.public final int elementCount()
public void printDecl(java.io.PrintWriter os, java.lang.String space, boolean print_semi, boolean constrained)
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.DDS
public void printDecl(java.io.PrintWriter os, java.lang.String space, boolean print_semi)
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.DDS
public final void printDecl(java.io.PrintWriter os, java.lang.String space)
printDecl(os, space, true)
.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.DDS.print(PrintWriter)
public final void printDecl(java.io.PrintWriter os)
printDecl(os, " ", true)
.os
- The PrintWriter
on which to print the
declaration.DDS.print(PrintWriter)
public final void printDecl(java.io.OutputStream os, java.lang.String space, boolean print_semi, boolean constrained)
OutputStream
.os
- The OutputStream
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.DDS.print(PrintWriter)
public final void printDecl(java.io.OutputStream os, java.lang.String space, boolean print_semi)
OutputStream
.os
- The OutputStream
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.DDS.print(PrintWriter)
public final void printDecl(java.io.OutputStream os, java.lang.String space)
printDecl(os, space, true)
.os
- The OutputStream
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.DDS.print(PrintWriter)
public void printDecl(java.io.OutputStream os)
printDecl(os, " ", true)
.os
- The OutputStream
on which to print the
declaration.DDS.print(PrintWriter)
public abstract void printVal(java.io.PrintWriter os, java.lang.String space, boolean print_decl_p)
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.public void printVal(java.io.PrintWriter os, java.lang.String space)
printVal(os, space, true)
.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.DataDDS.printVal(PrintWriter)
public void printVal(java.io.OutputStream os, java.lang.String space, boolean print_decl_p)
OutputStream
.os
- the OutputStream
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.DataDDS.printVal(PrintWriter)
public void printVal(java.io.OutputStream os, java.lang.String space)
OutputStream
.os
- the OutputStream
on which to print the value.space
- this value is passed to the printDecl
method,
and controls the leading spaces of the output.DataDDS.printVal(PrintWriter)
public void checkSemantics(boolean all) throws BadSemanticsException
DInt32
instance would return false if it had
no name defined. A DGrid
instance might return false for
more complex reasons, such as having Map arrays of the wrong
size or shape.
This method is used by the DDS
class, and will rarely, if
ever, be explicitly called by a OPeNDAP application program. A
variable must pass this test before it is sent, but there may be
many other stages in a retrieve operation where it would fail.all
- For complex constructor types (
DGrid
, DSequence
, DStructure
),
this flag indicates whether to check the
semantics of the member variables, too.BadSemanticsException
- if semantics are bad, explains why.DDS.checkSemantics(boolean)
public final void checkSemantics() throws BadSemanticsException
checkSemantics(false)
.BadSemanticsException
- if semantics are bad, explains why.checkSemantics(boolean)
public PrimitiveVector newPrimitiveVector()
PrimitiveVector
object optimized for the
particular data type of this BaseType
. For example, a
DByte
class would create a new
BytePrimitiveVector
in this call. This allows for a very
optimized, yet type-safe, implementation of DVector
functionality. For non-primitive types, such as
DArray
, DGrid
, DSequence
, and
DStructure
, the default implementation returns a
BaseTypePrimitiveVector
object which can
deserialize an array of complex types.PrimitiveVector
object for the variable type.public java.lang.String getLongName()
public boolean hasAttributes()
public Attribute getAttribute()
public AttributeTable getAttributeTable()
public void addAttributeAlias(java.lang.String alias, java.lang.String attributeName) throws DASException
DASException
public void appendAttribute(java.lang.String clearname, int type, java.lang.String value, boolean check) throws DASException
DASException
public void appendAttribute(java.lang.String clearname, int type, java.lang.String value) throws DASException
DASException
public void addAttributeContainer(AttributeTable at) throws AttributeExistsException
AttributeExistsException
public AttributeTable appendAttributeContainer(java.lang.String clearname)
public void delAttribute(java.lang.String clearname)
public void delAttribute(java.lang.String clearname, int i) throws DASException
DASException
public Attribute getAttribute(java.lang.String clearname)
public java.util.Enumeration getAttributeNames()
public void printAttributes(java.io.OutputStream os)
public void printAttributes(java.io.OutputStream os, java.lang.String pad)
public void printAttributes(java.io.PrintWriter pw)
public void printAttributes(java.io.PrintWriter pw, java.lang.String pad)
public void printXML(java.io.OutputStream os)
os
- public void printXML(java.io.OutputStream os, java.lang.String pad)
os
- pad
- public void printXML(java.io.PrintWriter pw)
pw
- public void printXML(java.io.PrintWriter pw, java.lang.String pad)
pw
- pad
- public void printXML(java.io.PrintWriter pw, java.lang.String pad, boolean constrained)
pw
- pad
- constrained
- public void printConstraint(java.io.PrintWriter os)
public DAPNode cloneDAG(DAPNode.CloneMap map) throws java.lang.CloneNotSupportedException
BaseType
.
See DAPNode.cloneDAG.