visad.data.netcdf.in
Class NetcdfQuantityDB

java.lang.Object
  extended by visad.data.netcdf.QuantityDB
      extended by visad.data.netcdf.in.NetcdfQuantityDB

public class NetcdfQuantityDB
extends QuantityDB

Provides support for mapping netCDF elements to VisAD quantities by decorating a existing quantity database with methods specifically appropriate to netCDF variables.

Author:
Steven R. Emmerson

Field Summary
 
Fields inherited from class visad.data.netcdf.QuantityDB
emptyDB
 
Constructor Summary
NetcdfQuantityDB(QuantityDB db)
          Constructs from another quantity database.
 
Method Summary
 void add(String name, Quantity quantity)
          Adds a given Quantity to the database under a given name.
 Quantity get(String name)
          Returns the quantity in the database whose name matches a given name.
 Quantity[] get(Unit unit)
          Returns all quantities in the database whose default unit is convertible with a given unit.
 Quantity getBest(String longName, String name)
          Return the VisAD quantity corresponding to the best combination of long name and name.
 Iterator nameIterator()
          Returns an iterator of the names in the database.
 Iterator quantityIterator()
          Returns an iterator of the quantities in the database.
 
Methods inherited from class visad.data.netcdf.QuantityDB
add, get
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetcdfQuantityDB

public NetcdfQuantityDB(QuantityDB db)
Constructs from another quantity database.

Method Detail

add

public void add(String name,
                Quantity quantity)
         throws VisADException
Adds a given Quantity to the database under a given name.

Specified by:
add in class QuantityDB
Parameters:
name - The name under which the quantity is to be added. May be an alias.
quantity - The quantity to be added.
Throws:
VisADException - Couldn't create necessary VisAD object.

getBest

public Quantity getBest(String longName,
                        String name)
Return the VisAD quantity corresponding to the best combination of long name and name.

Parameters:
longName - The long name of the quantity. May be null.
name - The name of the quantity.
Returns:
The corresponding, unique, VisAD quantity or null if no such quantity exists.

nameIterator

public Iterator nameIterator()
Returns an iterator of the names in the database.

Specified by:
nameIterator in class QuantityDB

quantityIterator

public Iterator quantityIterator()
Returns an iterator of the quantities in the database.

Specified by:
quantityIterator in class QuantityDB

get

public Quantity[] get(Unit unit)
Returns all quantities in the database whose default unit is convertible with a given unit.

Specified by:
get in class QuantityDB
Parameters:
unit - The unit of the quantity.
Returns:
The quantities in the database whose unit is convertible with unit.

get

public Quantity get(String name)
Returns the quantity in the database whose name matches a given name.

Specified by:
get in class QuantityDB
Parameters:
name - The name of the quantity.
Returns:
The quantity in the loal database that matches name. Note that RETURN_VALUE.getName().equals(name) can be false due to aliasing.