|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.units.UnitFormatImpl
public abstract class UnitFormatImpl
Provides support for classes that parse and format unit specifications. Instances are thread-safe.
Constructor Summary | |
---|---|
UnitFormatImpl()
|
Method Summary | |
---|---|
String |
format(Factor factor)
Formats a Factor (a base unit/exponent pair). |
String |
format(Unit unit)
Formats a unit. |
String |
longFormat(Unit unit)
Formats a unit using a long form. |
Unit |
parse(String spec)
Parses a unit specification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ucar.units.UnitFormat |
---|
format, format, longFormat, parse |
Constructor Detail |
---|
public UnitFormatImpl()
Method Detail |
---|
public final Unit parse(String spec) throws NoSuchUnitException, UnitParseException, SpecificationException, UnitDBException, PrefixDBException, UnitSystemException
parse
in interface UnitFormat
spec
- The unit specification (e.g. "m/s");
NoSuchUnitException
- A unit in the specification couldn't be found (e.g. the "m"
in the example).
UnitParseException
- The specification is grammatically incorrect.
SpecificationException
- The specification is incorrect somehow.
UnitDBException
- Problem with the unit database.
PrefixDBException
- Problem with the unit-prefix database.
UnitSystemException
- Problem with the system of units.public final String format(Factor factor)
format
in interface UnitFormat
factor
- The base unit/exponent pair.
public final String format(Unit unit) throws UnitClassException
format
in interface UnitFormat
unit
- The unit.
UnitClassException
public final String longFormat(Unit unit) throws UnitClassException
longFormat
in interface UnitFormat
unit
- The unit.
UnitClassException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |