public interface UnitFormat
Modifier and Type | Method and Description |
---|---|
String |
format(Factor factor)
Formats a Factor (a base unit/exponent pair).
|
StringBuffer |
format(Factor factor,
StringBuffer buffer)
Appends a formatted factor to a string buffer.
|
String |
format(Unit unit)
Formats a unit.
|
StringBuffer |
format(Unit unit,
StringBuffer buffer)
Appends a formatted unit to a string buffer.
|
String |
longFormat(Unit unit)
Formats a unit using a long form.
|
StringBuffer |
longFormat(Unit unit,
StringBuffer buffer)
Appends a unit formatted according to the long form to a string buffer.
|
Unit |
parse(String spec)
Parses a unit specification.
|
Unit |
parse(String spec,
UnitDB unitDB)
Parses a unit specification.
|
Unit parse(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(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.String format(Factor factor)
factor
- The base unit/exponent pair.StringBuffer format(Factor factor, StringBuffer buffer)
factor
- The base unit/exponent pair.buffer
- The string buffer to be appended to.String format(Unit unit) throws UnitClassException
unit
- The unit.UnitClassException
String longFormat(Unit unit) throws UnitClassException
unit
- The unit.UnitClassException
StringBuffer format(Unit unit, 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
StringBuffer longFormat(Unit unit, 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
Copyright © 1999–2017 UCAR/Unidata. All rights reserved.