public interface UnitDB
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(String alias,
String name)
Adds an alias for a unit to the database.
|
void |
addAlias(String alias,
String name,
String symbol)
Adds an alias for a unit to the database.
|
void |
addAlias(String alias,
String name,
String symbol,
String plural)
Adds an alias for a unit to the database.
|
void |
addAlias(UnitID id,
String name)
Adds an alias for a unit to the database.
|
void |
addSymbol(String symbol,
String name)
Adds a symbol for a unit to the database.
|
void |
addUnit(Unit unit)
Adds a unit to the database.
|
Unit |
get(String id)
Gets the unit in the database whose name, plural, or symbol, match an
identifier.
|
Unit |
getByName(String name)
Gets a unit in the database by name.
|
Unit |
getBySymbol(String symbol)
Gets a unit in the database by symbol.
|
Iterator<?> |
getIterator()
Returns an iterator over the units of the database.
|
String |
toString()
Returns the string representation of the database.
|
void addUnit(Unit unit) throws UnitExistsException, UnitDBAccessException, NameException
unit - The unit to be added. Its getName() method must not return
null. Its getPlural() and getSymbol() methods may return null.NameException - Bad unit name.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.void addAlias(String alias, String name) throws NoSuchUnitException, UnitExistsException, UnitDBAccessException, NameException
alias - The alias for the unit.name - The name of the unit already in the database.NameException - Bad unit name.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.NoSuchUnitException - The unit doesn't exist in the database.void addAlias(String alias, String name, String symbol) throws NoSuchUnitException, UnitExistsException, UnitDBAccessException, NameException
alias - The alias for the unit.name - The name of the unit already in the database.symbol - The symbol for the unit.NameException - Bad unit name.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.NoSuchUnitException - The unit doesn't exist in the database.void addAlias(String alias, String name, String symbol, String plural) throws NoSuchUnitException, UnitExistsException, UnitDBAccessException, NameException
alias - The alias for the unit.name - The name of the unit already in the database.symbol - The symbol of the alias. May be null
.plural - The plural form of the alias. May be
null in which
case regular plural- forming rules are followed.NameException - Bad unit name.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.NoSuchUnitException - The unit doesn't exist in the database.void addAlias(UnitID id, String name) throws NoSuchUnitException, UnitExistsException, UnitDBAccessException
id - The alias identifier.name - The name of the unit already in the database.NoSuchUnitException - The unit doesn't exist in the database.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.void addSymbol(String symbol, String name) throws NoSuchUnitException, UnitExistsException, UnitDBAccessException, NameException
symbol - The symbol for the unit.name - The name of the unit already in the database.NameException - Bad unit name.UnitExistsException - The unit is already in the database.UnitDBAccessException - Problem accessing unit database.NoSuchUnitException - The unit doesn't exist in the database.Unit get(String id) throws UnitDBAccessException
id - The identifier for the unit.
null if no
matching unit could be found.UnitDBAccessException - Problem accessing unit database.Unit getByName(String name) throws UnitDBAccessException
name - The name of the unit.
null if no
matching unit could be found.UnitDBAccessException - Problem accessing unit database.Unit getBySymbol(String symbol) throws UnitDBAccessException
symbol - The symbol for the unit.
null if no
matching unit could be found.UnitDBAccessException - Problem accessing unit database.String toString()
Iterator<?> getIterator()
next() of the iterator returns objects of type
Unit.Copyright © 1999-2012 UCAR/Unidata. All Rights Reserved.