visad.data.units
Class UnitTable
- java.lang.Object
-
- visad.data.units.UnitTable
-
- All Implemented Interfaces:
- java.io.Serializable, UnitsDB
- Direct Known Subclasses:
- DefaultUnitsDB
public class UnitTable extends java.lang.Object implements UnitsDB, java.io.Serializable
Provides support for a table of units.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description UnitTable(int numNames)Construct.UnitTable(int numNames, int numSymbols)Construct.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description Unitget(java.lang.String name)Get a unit.java.util.EnumerationgetNameEnumeration()Get an enumeration of the unit names in the table.java.util.EnumerationgetSymbolEnumeration()Get an enumeration of the unit symbols in the table.java.util.EnumerationgetUnitEnumeration()Get an enumeration of the units in the table.voidlist()List the units in the database.static voidmain(java.lang.String[] args)Test this class.voidput(BaseUnit unit)Adds a base unit.voidputName(java.lang.String name, Unit unit)Adds a name and a unit to the name table.voidputSymbol(java.lang.String symbol, Unit unit)Adds a symbol and a unit to the symbol table.java.lang.StringtoString()Return a string representation of this instance.
-
-
-
Constructor Detail
-
UnitTable
public UnitTable(int numNames) throws java.lang.IllegalArgumentExceptionConstruct.- Parameters:
numNames- Anticipated minimum number of names in the database.- Throws:
java.lang.IllegalArgumentException-numNames < 0.
-
UnitTable
public UnitTable(int numNames, int numSymbols) throws java.lang.IllegalArgumentExceptionConstruct.- Parameters:
numNames- Anticipated minimum number of names in the database.numSymbols- Anticipated minimum number of symbols in the database.- Throws:
java.lang.IllegalArgumentException-numNames < 0 || numSymbols < 0.
-
-
Method Detail
-
get
public Unit get(java.lang.String name)
Get a unit.
-
put
public void put(BaseUnit unit) throws java.lang.IllegalArgumentException
Adds a base unit.
-
putName
public void putName(java.lang.String name, Unit unit)Adds a name and a unit to the name table.
-
putSymbol
public void putSymbol(java.lang.String symbol, Unit unit)Adds a symbol and a unit to the symbol table.
-
getNameEnumeration
public java.util.Enumeration getNameEnumeration()
Get an enumeration of the unit names in the table. The Object returned by nextElement() is a String.- Specified by:
getNameEnumerationin interfaceUnitsDB
-
getSymbolEnumeration
public java.util.Enumeration getSymbolEnumeration()
Get an enumeration of the unit symbols in the table. The Object returned by nextElement() is a String.- Specified by:
getSymbolEnumerationin interfaceUnitsDB
-
getUnitEnumeration
public java.util.Enumeration getUnitEnumeration()
Get an enumeration of the units in the table. The Object returned by nextElement() is a Unit.- Specified by:
getUnitEnumerationin interfaceUnitsDB
-
toString
public java.lang.String toString()
Return a string representation of this instance.- Overrides:
toStringin classjava.lang.Object
-
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