ucar.netcdf
Class AttributeDictionary

java.lang.Object
  extended byucar.netcdf.AttributeDictionary
All Implemented Interfaces:
AttributeSet, Serializable

class AttributeDictionary
extends Object
implements AttributeSet, Serializable

AttributeDictionary is the machinery to implement AttributeSet. It wraps NamedDictionary so that the NamedDictionary can only contain Attributes. Note that AttributeDictionary is mutable, it has methods for adding new elements and removing elements. These methods should be exposed in the ProtoVariable and Schema implementations, and _not_ exposed in the Variable and Netcdf implementations.

Note: no public constructor.

See Also:
AttributeSet

Field Summary
protected  NamedDictionary attributes
           
 
Constructor Summary
(package private) AttributeDictionary()
           
(package private) AttributeDictionary(Attribute[] attrArray)
           
(package private) AttributeDictionary(AttributeSet ss)
           
 
Method Summary
 boolean contains(Object oo)
          Tests if the argument is in this set.
 boolean contains(String name)
          Tests if the Attribute identified by name is in this set.
 Attribute get(String name)
          Gets the attribute associated with the specified name.
 AttributeIterator iterator()
          Returns an iterator for the elements.
 Attribute put(Attribute attr)
          Ensures that this set contains the specified Attribute.
 boolean remove(Object oo)
          Delete the Attribute specified from this set.
 boolean remove(String name)
          Delete the Attribute specified by name from this set.
 int size()
          Returns the number of elements contained within the Dictionary.
 Attribute[] toArray()
          Returns a new Array containing the elements of this set.
 void toCdl(StringBuffer buf)
          Format as CDL.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributes

protected final NamedDictionary attributes
Constructor Detail

AttributeDictionary

AttributeDictionary()

AttributeDictionary

AttributeDictionary(Attribute[] attrArray)

AttributeDictionary

AttributeDictionary(AttributeSet ss)
Method Detail

size

public int size()
Returns the number of elements contained within the Dictionary.

Specified by:
size in interface AttributeSet
Returns:
int number of elements in the set

iterator

public AttributeIterator iterator()
Returns an iterator for the elements. Use the Iterator methods on the returned object to fetch the elements sequentially.

Specified by:
iterator in interface AttributeSet
Returns:
AttributeIterator for the elements.
See Also:
Iterator

toArray

public Attribute[] toArray()
Description copied from interface: AttributeSet
Returns a new Array containing the elements of this set.

Specified by:
toArray in interface AttributeSet
Returns:
a new Array containing the elements of this set.

get

public Attribute get(String name)
Gets the attribute associated with the specified name.

Specified by:
get in interface AttributeSet
Parameters:
name - the name of the attribute
Returns:
the attribute, or null if not found

contains

public boolean contains(String name)
Tests if the Attribute identified by name is in this set.

Specified by:
contains in interface AttributeSet
Parameters:
name - String which identifies the desired attribute
Returns:
true if and only if this set contains the named Attribute.

contains

public boolean contains(Object oo)
Tests if the argument is in this set.

Specified by:
contains in interface AttributeSet
Parameters:
oo - some Object
Returns:
true if and only if this set contains oo

put

public Attribute put(Attribute attr)
Ensures that this set contains the specified Attribute. If a different Attribute with the same name, was in the set, it is returned, otherwise null is returned.

Specified by:
put in interface AttributeSet
Parameters:
attr - the Attribute to be added to this set.
Returns:
Attribute replaced or null if not a replacement

remove

public boolean remove(String name)
Delete the Attribute specified by name from this set.

Specified by:
remove in interface AttributeSet
Parameters:
name - String identifying the Attribute to be removed.
Returns:
true if the Set changed as a result of this call.

remove

public boolean remove(Object oo)
Delete the Attribute specified from this set.

Specified by:
remove in interface AttributeSet
Parameters:
oo - Attribute to be removed.
Returns:
true if the Set changed as a result of this call.

toCdl

public void toCdl(StringBuffer buf)
Format as CDL.

Parameters:
buf - StringBuffer into which to write

toString

public String toString()
Returns:
a CDL string of this.