| This class provides the interface for formatting and parsing
Amount measures instances. For example:[code]
// Display measurements using unscaled units (e.g. base units or alternate units).
AmountFormat.setInstance(new AmountFormat() { // Context local.
public Appendable format(Amount m, Appendable a) throws IOException {
Unit u = m.getUnit();
if (u instanceof TransformedUnit)
u = ((TransformedUnit)u).getParentUnit();
return AmountFormat.getPlusMinusErrorInstance(2).format(m.to(u), a);
}
public Amount parse(CharSequence csq, Cursor c) {
return AmountFormat.getPlusMinusErrorInstance(2).parse(csq, c);
}
});[/code]
author: Jean-Marie Dautelle version: 3.0, February 21, 2006 |