Package ucar.units
Class PrefixDBImpl
- java.lang.Object
-
- ucar.units.PrefixDBImpl
-
- All Implemented Interfaces:
Serializable,PrefixDB
- Direct Known Subclasses:
StandardPrefixDB
public class PrefixDBImpl extends Object implements PrefixDB, Serializable
Provides a concrete implementation of a database of unit prefixes. Instances of this class are modifiable.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PrefixDBImpl()Constructs from nothing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddName(String name, double value)Adds a prefix to the database by name.voidaddSymbol(String symbol, double value)Adds a prefix symbol to the database.PrefixgetPrefixByName(String string)Gets a prefix by name.PrefixgetPrefixBySymbol(String string)Gets a prefix by symbol.PrefixgetPrefixByValue(double value)Gets a prefix by value.Iterator<Prefix>iterator()Gets an iterator over the prefixes in the database.StringtoString()Returns a string representation of this database.
-
-
-
Method Detail
-
addName
public void addName(String name, double value) throws PrefixExistsException
Adds a prefix to the database by name.- Specified by:
addNamein interfacePrefixDB- Parameters:
name- The name of the prefix to be added.value- The value of the prefix.- Throws:
PrefixExistsException- Another prefix with the same name or value already exists in the database.
-
addSymbol
public void addSymbol(String symbol, double value) throws PrefixExistsException
Adds a prefix symbol to the database.- Specified by:
addSymbolin interfacePrefixDB- Parameters:
symbol- The symbol of the prefix to be added.value- The value of the prefix.- Throws:
PrefixExistsException- Another prefix with the same symbol or value already exists in the database.
-
getPrefixByName
public Prefix getPrefixByName(String string)
Gets a prefix by name.- Specified by:
getPrefixByNamein interfacePrefixDB- Parameters:
string- The name to be matched.- Returns:
- The prefix whose name matches or null.
-
getPrefixBySymbol
public Prefix getPrefixBySymbol(String string)
Gets a prefix by symbol.- Specified by:
getPrefixBySymbolin interfacePrefixDB- Parameters:
string- The symbol to be matched.- Returns:
- The prefix whose symbol matches or null.
-
getPrefixByValue
public Prefix getPrefixByValue(double value)
Gets a prefix by value.- Specified by:
getPrefixByValuein interfacePrefixDB- Parameters:
value- The value to be matched.- Returns:
- The prefix whose value matches or null.
-
toString
public String toString()
Returns a string representation of this database.
-
-