Package opendap.dap
Class AttributeTable
- java.lang.Object
-
- opendap.dap.DAPNode
-
- opendap.dap.AttributeTable
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<String>
- Direct Known Subclasses:
DAS
public class AttributeTable extends DAPNode implements Iterable<String>
AnAttributeTablestores a set of names and, for each name, anAttributeobject. It is an Iterable< that returns the attribute names in insert order.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class opendap.dap.DAPNode
DAPNode.CloneMap
-
-
Field Summary
-
Fields inherited from class opendap.dap.DAPNode
_nameClear, _nameEncoded, log
-
-
Constructor Summary
Constructors Constructor Description AttributeTable(String clearname)Create a new emptyAttributeTable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlias(String alias, String attributeName)Add an alias to the current table.voidaddContainer(String clearname, AttributeTable at)Create and append an attribute container to the table.voidappendAttribute(String clearname, int type, String value)Adds an attribute to the table.voidappendAttribute(String clearname, int type, String value, boolean check)Adds an attribute to the table.AttributeTableappendContainer(String clearname)Create and append an attribute container to the table.AttributeTablecloneDAG(DAPNode.CloneMap map)Returns a copy of thisAttributeTable.voiddelAttribute(String clearname)Delete the attribute namedname.voiddelAttribute(String clearname, int i)Delete the attribute namedname.AttributegetAttribute(String clearname)Returns theAttributewhich matches name.Iterator<String>iterator()voidprint(OutputStream os)Print the attribute table on the givenOutputStreamwith four spaces of indentation.voidprint(OutputStream os, String pad)Print the attribute table on the givenOutputStream.voidprint(PrintStream os)Print the attribute table on the givenPrintWriterwith four spaces of indentation.voidprint(PrintWriter os)Print the attribute table on the givenPrintWriterwith four spaces of indentation.voidprint(PrintWriter os, String pad)Print the attribute table on the givenPrintWriter.voidprintXML(OutputStream os, String pad)voidprintXML(PrintWriter pw)voidprintXML(PrintWriter pw, String pad)voidprintXML(PrintWriter pw, String pad, boolean constrained)intsize()StringtoString()-
Methods inherited from class opendap.dap.DAPNode
clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setClearName, setEncodedName, setParent, setProject, setProject, setProjected
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
AttributeTable
public AttributeTable(String clearname)
Create a new emptyAttributeTable.
-
-
Method Detail
-
size
public int size()
- Returns:
- the # of contained attributes
-
getAttribute
@Nullable public final Attribute getAttribute(String clearname)
Returns theAttributewhich matches name.
-
appendAttribute
public final void appendAttribute(String clearname, int type, String value, boolean check) throws DASException
Adds an attribute to the table. If the given name already refers to an attribute, and the attribute has a vector value, the given value is appended to the attribute vector. Calling this function repeatedly is the way to create an attribute vector. The function throws an exception if the attribute is a container, or if the type of the input value does not match the existing attribute's type and thecheckparameter is true. Use theappendContainermethod to add container attributes.- Parameters:
clearname- The name of the attribute to add or modify.type- The type code of the attribute to add or modify.value- The value to add to the attribute table.check- Check the validity of the attribute's value?- Throws:
AttributeExistsException- thrown if an Attribute with the same name, but a different type was previously defined.AttributeBadValueException- thrown if the value is not a legal member of typeDASException- See Also:
appendContainer(String)
-
appendAttribute
public final void appendAttribute(String clearname, int type, String value) throws DASException
Adds an attribute to the table. If the given name already refers to an attribute, and the attribute has a vector value, the given value is appended to the attribute vector. Calling this function repeatedly is the way to create an attribute vector. The function throws an exception if the attribute is a container, or if the type of the input value does not match the existing attribute's type. Use theappendContainermethod to add container attributes.- Parameters:
clearname- The name of the attribute to add or modify.type- The type code of the attribute to add or modify.value- The value to add to the attribute table.- Throws:
AttributeExistsException- thrown if an Attribute with the same name, but a different type was previously defined.AttributeBadValueException- thrown if the value is not a legal member of typeDASException- See Also:
appendContainer(String)
-
appendContainer
@Nullable public final AttributeTable appendContainer(String clearname)
Create and append an attribute container to the table. A container is anotherAttributeTableobject.- Parameters:
clearname- the name of the container to add.- Returns:
- A pointer to the new
AttributeTableobject, or null if a container by that name already exists.
-
addContainer
public final void addContainer(String clearname, AttributeTable at) throws AttributeExistsException
Create and append an attribute container to the table. A container is anotherAttributeTableobject.- Parameters:
clearname- the name of the container to add. if a container by that name already exists.- Throws:
AttributeExistsException
-
addAlias
public final void addAlias(String alias, String attributeName) throws AttributeExistsException
Add an alias to the current table. This method is used by the DAS parser to build Aliases for the DAS. And the DDSXMLParser to add them to the DDX The new (9/26/02) DDS requires the use ofaddAlias(String, String, String)and is the preffered way of representing the DAS information.- Parameters:
alias- The alias to insert into the attribute table.attributeName- The normalized name of the attribute to which the alias will refer.- Throws:
AttributeExistsException- thrown if the new alias has the same name as an existing attribute.
-
delAttribute
public final void delAttribute(String clearname)
Delete the attribute namedname.- Parameters:
clearname- The name of the attribute to delete. This can be an attribute of any type, including containers.
-
delAttribute
public final void delAttribute(String clearname, int i) throws DASException
Delete the attribute namedname. If the attribute has a vector value, delete thei'th element of the vector.- Parameters:
clearname- The name of the attribute to delete. This can be an attribute of any type, including containers.i- If the named attribute is a vector, andiis non-negative, thei'th entry in the vector is deleted. Ifiequals -1, the entire attribute is deleted.- Throws:
DASException- See Also:
delAttribute(String)
-
print
public void print(PrintWriter os, String pad)
Print the attribute table on the givenPrintWriter.- Parameters:
os- thePrintWriterto use for output.pad- the number of spaces to indent each line.
-
print
public final void print(OutputStream os, String pad)
Print the attribute table on the givenOutputStream.- Parameters:
os- theOutputStreamto use for output.pad- the number of spaces to indent each line.
-
print
public final void print(PrintStream os)
Print the attribute table on the givenPrintWriterwith four spaces of indentation.- Parameters:
os- thePrintWriterto use for output.
-
print
public final void print(PrintWriter os)
Print the attribute table on the givenPrintWriterwith four spaces of indentation.- Parameters:
os- thePrintWriterto use for output.
-
print
public final void print(OutputStream os)
Print the attribute table on the givenOutputStreamwith four spaces of indentation.- Parameters:
os- theOutputStreamto use for output.
-
printXML
public void printXML(OutputStream os, String pad)
-
printXML
public void printXML(PrintWriter pw)
-
printXML
public void printXML(PrintWriter pw, String pad)
-
printXML
public void printXML(PrintWriter pw, String pad, boolean constrained)
-
cloneDAG
public AttributeTable cloneDAG(DAPNode.CloneMap map) throws CloneNotSupportedException
Returns a copy of thisAttributeTable.- Overrides:
cloneDAGin classDAPNode- Parameters:
map- list of previously cloned nodes- Returns:
- clone of this node
- Throws:
CloneNotSupportedException
-
-