visad.data.units
Class DefaultUnitsDB
- java.lang.Object
-
- visad.data.units.UnitTable
-
- visad.data.units.DefaultUnitsDB
-
- All Implemented Interfaces:
- java.io.Serializable, UnitsDB
public final class DefaultUnitsDB extends UnitTable
Default units database. This database knows about approximately 500 different units. Users can also add new units to the database at runtime. The basis for this units database is the International System of Units (SI). This is a singleton class.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description Unitget(java.lang.String name)Get a unit.static UnitsDBinstance()Gets an instance of this class.static voidmain(java.lang.String[] args)Test this class.-
Methods inherited from class visad.data.units.UnitTable
getNameEnumeration, getSymbolEnumeration, getUnitEnumeration, list, put, putName, putSymbol, toString
-
-
-
-
Method Detail
-
instance
public static UnitsDB instance() throws UnitException
Gets an instance of this class. This is the only way to obtain an instance of this class.- Throws:
UnitException- Something went wrong in generating the singleton instance of the database. This should not occur and indicates an internal inconsistancy.
-
get
public Unit get(java.lang.String name)
Get a unit.- Specified by:
getin interfaceUnitsDB- Overrides:
getin classUnitTable- Parameters:
name- The name of the unit to be retrieved. It may be the plural form (e.g. "yards"). If an entry in the database corresponding to the complete name is not found and the given name ends with an `s', then a search will be made for the singular form (e.g. "yard"). The matching entry will be returned only if the entry permits a plural form. The entry may also have one or more SI prefixes (e.g. "mega", "M").- Returns:
- The appropriate unit or
null. The unit will account for any SI prefixes in the name.
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionTest this class.- Throws:
java.lang.Exception- A problem occurred.
-
-
DMelt 3.0 © DataMelt by jWork.ORG