visad.data.netcdf
Class StandardQuantityDB

java.lang.Object
  extended by visad.data.netcdf.QuantityDB
      extended by visad.data.netcdf.QuantityDBImpl
          extended by visad.data.netcdf.StandardQuantityDB
All Implemented Interfaces:
Serializable

public final class StandardQuantityDB
extends QuantityDBImpl

The following class implements a database of standard quantities. It is implemented as a singleton. Instances of the class are modifiable.

Author:
Steven R. Emmerson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class visad.data.netcdf.QuantityDBImpl
QuantityDBImpl.Iterator, QuantityDBImpl.NameIterator, QuantityDBImpl.NameKey, QuantityDBImpl.QuantityIterator, QuantityDBImpl.UnitKey
 
Field Summary
 
Fields inherited from class visad.data.netcdf.QuantityDB
emptyDB
 
Method Summary
 QuantityDB add(String[] definitions, String[] aliases)
          Adds the given quantities and aliases to the database.
 void add(String name, String unitSpec)
          Adds a quantity to the database given a name and a display unit specification.
static StandardQuantityDB instance()
          Returns an instance of this class.
static void main(String[] args)
          Tests this class.
 
Methods inherited from class visad.data.netcdf.QuantityDBImpl
add, add, get, get, nameIterator, quantityIterator
 
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
 

Method Detail

instance

public static StandardQuantityDB instance()
Returns an instance of this class.

Throws:
VisADException - Couldn't instantiate.

add

public QuantityDB add(String[] definitions,
                      String[] aliases)
               throws ParseException,
                      TypeException,
                      VisADException
Adds the given quantities and aliases to the database.

Overrides:
add in class QuantityDBImpl
Parameters:
definitions - New quantities and their definitions. definitions[2*i] contains the name (e.g. "speed") of the quantity whose preferred unit specification (e.g. "m/s") is in definitions[2*i+1].
aliases - Aliases for quantities. aliases[2*i] contains the alias for the quantity named in aliases[2*i+1].
Returns:
The database resulting from the addition. Will not be the original object.
Throws:
ParseException - A unit specification couldn't be parsed.
TypeException - An incompatible version of the quantity already exists.
VisADException - Couldn't create necessary VisAD object.

add

public void add(String name,
                String unitSpec)
Adds a quantity to the database given a name and a display unit specification.

Overrides:
add in class QuantityDBImpl
Parameters:
name - The name of the quantity (e.g. "length").
unitSpec - The preferred display unit for the quantity (e.g. "feet").
Throws:
UnsupportedOperationException - Always thrown because a standard database must be unmodifiable.

main

public static void main(String[] args)
                 throws Exception
Tests this class. If the only argument is "list", then this method will print the list of standard quantities -- one per line -- in the following format: name "(" CannonicalName ")" " in " PreferredUnit e.g. VolumicElectricCharge (ElectricChargeDensity) in C/m3

Throws:
Exception