public interface UnitFormat
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(Factor factor)
Formats a Factor (a base unit/exponent pair).
|
java.lang.StringBuffer |
format(Factor factor,
java.lang.StringBuffer buffer)
Appends a formatted factor to a string buffer.
|
java.lang.String |
format(Unit unit)
Formats a unit.
|
java.lang.StringBuffer |
format(Unit unit,
java.lang.StringBuffer buffer)
Appends a formatted unit to a string buffer.
|
java.lang.String |
longFormat(Unit unit)
Formats a unit using a long form.
|
java.lang.StringBuffer |
longFormat(Unit unit,
java.lang.StringBuffer buffer)
Appends a unit formatted according to the long form to a string buffer.
|
Unit |
parse(java.lang.String spec)
Parses a unit specification.
|
Unit |
parse(java.lang.String spec,
UnitDB unitDB)
Parses a unit specification.
|
Unit parse(java.lang.String spec) throws NoSuchUnitException, UnitParseException, SpecificationException, UnitDBException, PrefixDBException, UnitSystemException
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.Unit parse(java.lang.String spec, UnitDB unitDB) throws NoSuchUnitException, UnitParseException, SpecificationException, UnitDBException, PrefixDBException, UnitSystemException
spec
- The unit specification (e.g. "m/s");unitDB
- The unit database.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.java.lang.String format(Factor factor)
factor
- The base unit/exponent pair.java.lang.StringBuffer format(Factor factor, java.lang.StringBuffer buffer)
factor
- The base unit/exponent pair.buffer
- The string buffer to be appended to.java.lang.String format(Unit unit) throws UnitClassException
unit
- The unit.UnitClassException
java.lang.String longFormat(Unit unit) throws UnitClassException
unit
- The unit.UnitClassException
java.lang.StringBuffer format(Unit unit, java.lang.StringBuffer buffer) throws UnitClassException
format(Unit)
but it appends the specification to a
string buffer.unit
- The unit.buffer
- The string buffer to be appended to.UnitClassException
java.lang.StringBuffer longFormat(Unit unit, java.lang.StringBuffer buffer) throws UnitClassException
longFormat(Unit)
but it appends the
specification to a string buffer.unit
- The unit.buffer
- The string buffer to be appended to.UnitClassException