## visad.data.netcdf
Class QuantityDB

    java.lang.Object
      visad.data.netcdf.QuantityDB

Direct Known Subclasses:
  NetcdfQuantityDB, QuantityDBImpl

public abstract class QuantityDB
extends Object

Provides support for a database of quantities.

Nested Class Summary
`(package private) static class` `QuantityDB.NilIterator` A nil `Iterator`.

Field Summary
`static QuantityDB` `emptyDB` The empty quantity database.

Constructor Summary
`QuantityDB()`

Method Summary
`void` `add(Quantity quantity)` Adds a given Quantity to the database.
`abstract void` `add(String name, Quantity quantity)` Adds a given Quantity to the database under a given name.
`abstract Quantity` `get(String name)` Returns the quantity in the database whose name matches a given name.
`Quantity` `get(String name, String unitSpec)` Returns the quantity that matches the given name and unit.
`abstract Quantity[]` `get(Unit unit)` Returns all quantities in the database whose default unit is convertible with a given unit.
`abstract Iterator` `nameIterator()` Returns an iterator of the names in the database.
`abstract Iterator` `quantityIterator()` Returns an iterator of the quantities in the database.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### emptyDB

    public static final QuantityDB emptyDB

  The empty quantity database. This is useful if, for example, you do not want the netCDF import package to map incoming netCDF variables to canonical ones by, effectively, altering their names and units. This database cannot be altered.

Constructor Detail

### QuantityDB

    public QuantityDB()

Method Detail

### get

    public abstract Quantity get(String name)

  Returns the quantity in the database whose name matches a given name.

  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.

### get

    public abstract Quantity[] get(Unit unit)

  Returns all quantities in the database whose default unit is convertible with a given unit.

  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,
                        String unitSpec)
                 throws ParseException,
                        NoSuchUnitException,
                        UnitException,
                        VisADException

  Returns the quantity that matches the given name and unit. If necessary, it creates the quantity and adds it to the database.

  Parameters:
    `name` - The name of the quantity.
  Returns:
    The quantity in the database that matches `name` and `unit`. Note that RETURN_VALUE`.getName().equals(name)` can be `false` due to aliasing and RETURN_VALUE`. getDefaultUnit().equals(unit)` can be `false` due to allowable unit conversion.
  Throws:
    `ParseException` - Couldn't decode `unitSpec`.
    `NoSuchUnitException` - `unitSpec` not in unit database.
    `UnitException` - The quantity already exists with an incompatible unit.
    `VisADException` - Couldn't create necessary VisAD object.

### add

    public abstract void add(String name,
                             Quantity quantity)
                      throws VisADException

  Adds a given Quantity to the database under a given name.

  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.

### add

    public void add(Quantity quantity)
             throws VisADException

  Adds a given Quantity to the database.

  Parameters:
    `quantity` - The quantity to be added. The quantity will be added under it own name.
  Returns:
    The database resulting from the addition. May or may not be the original object.
  Throws:
    `VisADException` - Couldn't create necessary VisAD object.

### quantityIterator

    public abstract Iterator quantityIterator()

  Returns an iterator of the quantities in the database.

### nameIterator

    public abstract Iterator nameIterator()

  Returns an iterator of the names in the database.