|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.units.PrefixDBImpl
public class PrefixDBImpl
Provides a concrete implementation of a database of unit prefixes. Instances of this class are modifiable.
Constructor Summary | |
---|---|
PrefixDBImpl()
Constructs from nothing. |
Method Summary | |
---|---|
void |
addName(String name,
double value)
Adds a prefix to the database by name. |
void |
addSymbol(String symbol,
double value)
Adds a prefix symbol to the database. |
Prefix |
getPrefixByName(String string)
Gets a prefix by name. |
Prefix |
getPrefixBySymbol(String string)
Gets a prefix by symbol. |
Prefix |
getPrefixByValue(double value)
Gets a prefix by value. |
Iterator |
iterator()
Gets an iterator over the prefixes in the database. |
static void |
main(String[] args)
Tests this class. |
String |
toString()
Returns a string representation of this database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PrefixDBImpl()
Method Detail |
---|
public void addName(String name, double value) throws PrefixExistsException
addName
in interface PrefixDB
name
- The name of the prefix to be added.value
- The value of the prefix.
PrefixExistsException
- Another prefix with the same name or value already exists in
the database.public void addSymbol(String symbol, double value) throws PrefixExistsException
addSymbol
in interface PrefixDB
symbol
- The symbol of the prefix to be added.value
- The value of the prefix.
PrefixExistsException
- Another prefix with the same symbol or value already exists
in the database.public Prefix getPrefixByName(String string)
getPrefixByName
in interface PrefixDB
string
- The name to be matched.
public Prefix getPrefixBySymbol(String string)
getPrefixBySymbol
in interface PrefixDB
string
- The symbol to be matched.
public Prefix getPrefixByValue(double value)
getPrefixByValue
in interface PrefixDB
value
- The value to be matched.
public String toString()
toString
in interface PrefixDB
toString
in class Object
public Iterator iterator()
iterator
in interface PrefixDB
Prefix
.public static void main(String[] args) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |