public interface UnitDB
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(java.lang.String alias,
java.lang.String name)
Adds an alias for a unit to the database.
|
void |
addAlias(java.lang.String alias,
java.lang.String name,
java.lang.String symbol)
Adds an alias for a unit to the database.
|
void |
addAlias(java.lang.String alias,
java.lang.String name,
java.lang.String symbol,
java.lang.String plural)
Adds an alias for a unit to the database.
|
void |
addAlias(UnitID id,
java.lang.String name)
Adds an alias for a unit to the database.
|
void |
addSymbol(java.lang.String symbol,
java.lang.String name)
Adds a symbol for a unit to the database.
|
void |
addUnit(Unit unit)
Adds a unit to the database.
|
Unit |
get(java.lang.String id)
Gets the unit in the database whose name, plural, or symbol, match an
identifier.
|
Unit |
getByName(java.lang.String name)
Gets a unit in the database by name.
|
Unit |
getBySymbol(java.lang.String symbol)
Gets a unit in the database by symbol.
|
java.util.Iterator<?> |
getIterator()
Returns an iterator over the units of the database.
|
java.lang.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(java.lang.String alias,
java.lang.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(java.lang.String alias,
java.lang.String name,
java.lang.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(java.lang.String alias,
java.lang.String name,
java.lang.String symbol,
java.lang.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, java.lang.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(java.lang.String symbol,
java.lang.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(java.lang.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(java.lang.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(java.lang.String symbol) throws UnitDBAccessException
symbol - The symbol for the unit.
null if no
matching unit could be found.UnitDBAccessException - Problem accessing unit database.java.lang.String toString()
toString in class java.lang.Objectjava.util.Iterator<?> getIterator()
next() of the iterator returns objects of type
Unit.