Package ucar.units

Provides support for parsing and formatting string unit specification, converting numerical values between compatible units, and performing arithmetic on units (such as dividing one unit by another).

See:
          Description

Interface Summary
Base Interface for "base" entities like base units or base quantities.
Converter Interface for converting numeric values from one unit to another.
DerivableUnit Interface for units that can convert numeric values to and from an underlying derived unit.
DerivedUnit Interface for derived units.
PrefixDB Interface for a database of unit prefixes.
StandardUnitFormatConstants Token literal values and constants.
Unit Interface for units.
UnitDB Interface for a unit database.
UnitFormat Interface for classes that parse and format unit specifications.
UnitSystem Interface for a system of units.
 

Class Summary
ASCII_CharStream An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (without unicode processing).
BaseQuantity Provides support for abstract base quantities (ex: length, time).
BaseUnit Provides support for base units.
ConverterImpl Provides support for implementations of unit converters.
DerivedUnitImpl Provides support for a concrete implementation of derived units.
Dimension Provides support for the concept of "dimension": pairs of base entities and exponents.
Factor Provides support for a Base/exponent pair.
LogarithmicUnit Provides support for units that are based on a logarithm of the ratio of a physical quantity to an underlying reference level.
OffsetUnit Provides support for units that are offset from reference units (ex: as the unit "degree Celsius" is offset from the reference unit "kelvin").
Prefix Provides support for unit prefixes (e.g.
PrefixDBImpl Provides a concrete implementation of a database of unit prefixes.
PrefixDBManager Provides support for managing a database of unit prefixes.
PrefixName Provides support for prefix names and numeric values.
PrefixSymbol Provides support for prefix symbols.
QuantityDimension Provides support for the dimension of a quantity.
RegularBaseQuantity Provides support for a base quantity that is dimensionfull.
ScaledUnit Provides support for a unit that is a mutiplicative factor of a reference unit.
SI Provides support for the International System of Units (SI).
SimpleCharStream An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (without unicode processing).
StandardPrefixDB Provides support for a database of standard unit prefixes.
StandardUnitDB Provides support for a database of standard units.
StandardUnitFormat Standard formatter/parser for unit specifications.
StandardUnitFormatTokenManager Token Manager.
SupplementaryBaseQuantity Provides support for supplementary base quantities.
Test Provides support for testing the ucar.units package.
TimeScaleUnit Provides support for a reference time unit whose origin is at a certain time.
TimeScaleUnit.MyConverter Provides support for Converter-s.
Token Describes the input token stream.
UnitDBImpl Provides most of a concrete implementation of a database of units.
UnitDBManager Provides support for managing a default unit database.
UnitDimension  
UnitFormatImpl Provides support for classes that parse and format unit specifications.
UnitFormatManager Provides support for managing a default UnitFormat.
UnitID Provides support for unit identifiers.
UnitImpl Provides support for classes that implement units.
UnitImpl.MyConverter Provides support for converting numeric values from this unit to another unit.
UnitName Provides support for unit names.
UnitSymbol Provides support for symbols for units.
UnitSystemImpl  
UnitSystemManager Provides support for managing a UnitSystem.
UnknownBaseQuantity Provides support for an unknown base quantity.
UnknownUnit Provides support for unknown base units.
 

Exception Summary
BadUnitException Provides support for failures due to attempts to redefine an existing unit in a unit database.
BaseQuantityException Provides support for base quantity exceptions.
ConversionException Provides support for unit conversion exceptions.
DivideException Provides support for unit division failures.
MultiplyException Provides support for unit multiplication failures.
NameException Provides support for bad unit names.
NoSuchUnitException Provides support for failure to find a unit.
OperationException Provides support for unit operation failures (ex: multiplication).
ParseException This exception is thrown when parse errors are encountered.
PrefixDBAccessException Provides support for prefix database access failures.
PrefixDBException Provides support for the general class of prefix database failures.
PrefixExistsException Provides support for prefix database failures.
QuantityExistsException Provides support for attempting to redefine a base quantity in a database.
RaiseException Provides support for failure to raise a unit to a power.
ShiftException Provides support for failure to raise a unit to a power.
SpecificationException Provides support for errors in unit string specifications.
UnitClassException Provides support for a Unit that is an instance of an unknown class.
UnitDBAccessException Provides support for failure to access unit database (e.g.
UnitDBException Provides support for general unit database failures.
UnitException Provides support for general failures of this package.
UnitExistsException Provides support for failures due to attempts to redefine an existing unit in a unit database.
UnitFormatException Provides support for general failures with unit format classes.
UnitParseException Provides support for errors in unit specifications.
UnitSystemException Provides support for errors with the system of units.
 

Error Summary
TokenMgrError Token Manager Error.
 

Package ucar.units Description

Provides support for parsing and formatting string unit specification, converting numerical values between compatible units, and performing arithmetic on units (such as dividing one unit by another).

Examples of Intended Use

The following code will print the string "5 knots is 2.57222 m/s":
UnitFormat format = UnitFormatManager.instance();
Unit meter = format.parse("meter");
Unit second = format.parse("second");
Unit meterPerSecondUnit = meter.divideBy(second);
Unit knot = format.parse("knot");
if (meterPerSecondUnit.isCompatible(knot) {
    System.out.println("5 knots is " +
        knot.convertTo(5, meterPerSecondUnit) +
        ' ' + format.format(meterPerSecondUnit));
}
 



Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.