ucar.netcdf
Class DimensionDictionary

java.lang.Object
  extended byucar.netcdf.DimensionDictionary
All Implemented Interfaces:
DimensionSet, Serializable

class DimensionDictionary
extends Object
implements DimensionSet, Serializable

DimensionDictionary is package private implementation of DimensionSet.


Constructor Summary
(package private) DimensionDictionary()
           
(package private) DimensionDictionary(DimensionSet ss)
           
(package private) DimensionDictionary(ProtoVariable[] varArray)
           
 
Method Summary
 boolean contains(Object oo)
          Tests if the argument is in this set.
 boolean contains(String name)
          Tests if the Dimension identified by name is in this set.
 Dimension get(String name)
          Gets the dimension associated with the specified name.
(package private)  int indexOf(Dimension elem)
          Searches for the specified object, starting from the first position and returns an index to it.
(package private)  void initialPut(Dimension dim)
          Add a Dimension instance to this dictionary.
 DimensionIterator iterator()
          Returns an iterator of the elements.
(package private)  Dimension put(Dimension dim)
          Ensures that this set contains a Dimension which is equal() to the argument.
(package private)  boolean remove(String name)
          Delete the Dimension specified by name from this set.
 int size()
          Returns the number of elements contained within the Dictionary.
 Dimension[] 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
 

Constructor Detail

DimensionDictionary

DimensionDictionary()

DimensionDictionary

DimensionDictionary(DimensionSet ss)

DimensionDictionary

DimensionDictionary(ProtoVariable[] varArray)
Method Detail

size

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

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

iterator

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

Specified by:
iterator in interface DimensionSet
Returns:
DimensionIterator for the elements.
See Also:
Iterator

toArray

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

Specified by:
toArray in interface DimensionSet
Returns:
a new Array containing (clones of) elements of this set.

get

public Dimension get(String name)
Gets the dimension associated with the specified name.

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

contains

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

Specified by:
contains in interface DimensionSet
Parameters:
name - String which identifies the desired dimension
Returns:
true if and only if this set contains the named Dimension.

contains

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

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

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.

put

Dimension put(Dimension dim)
Ensures that this set contains a Dimension which is equal() to the argument. If such an element exists, it is returned. Otherwise, a clone is created, added to the dictionary, and the clone is returned. NOTE: this is different than the usual container.put() return!

If a different (not equal()) Dimension with the same name was in the set, throw IllegalArgumentException.

Parameters:
dim - the Dimension to be added to this set.
Returns:
Dimension added or matching member from the set.

initialPut

void initialPut(Dimension dim)
Add a Dimension instance to this dictionary. <> Use this form when initializing from an existing data set and you want instances (and thus UnlimitedDimension values) preserved.


remove

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

Parameters:
name - String identifying the Dimension to be removed.
Returns:
true if the Set changed as a result of this call.

indexOf

int indexOf(Dimension elem)
Searches for the specified object, starting from the first position and returns an index to it.

Parameters:
elem - the desired element
Returns:
the index of the element, or -1 if it was not found.