public abstract class UnitFormatImpl extends java.lang.Object implements UnitFormat
Constructor and Description |
---|
UnitFormatImpl() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(Factor factor)
Formats a Factor (a base unit/exponent pair).
|
java.lang.String |
format(Unit unit)
Formats a unit.
|
java.lang.String |
longFormat(Unit unit)
Formats a unit using a long form.
|
Unit |
parse(java.lang.String spec)
Parses a unit specification.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
format, format, longFormat, parse
public final Unit parse(java.lang.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 java.lang.String format(Factor factor)
format
in interface UnitFormat
factor
- The base unit/exponent pair.public final java.lang.String format(Unit unit) throws UnitClassException
format
in interface UnitFormat
unit
- The unit.UnitClassException
public final java.lang.String longFormat(Unit unit) throws UnitClassException
longFormat
in interface UnitFormat
unit
- The unit.UnitClassException