visad.data.netcdf
Class StandardQuantityDB
java.lang.Object
visad.data.netcdf.QuantityDB
visad.data.netcdf.QuantityDBImpl
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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