public abstract class UCUMFormat extends tec.uom.se.format.AbstractUnitFormat
This class provides the interface for formatting and parsing
units according to the
Uniform Code for CommonUnits of
Measure (UCUM).
For a technical/historical overview of this format please read CommonUnits of Measure in Clinical Information Systems.
As of revision 1.16, the BNF in the UCUM standard contains an error. I've attempted to work around the problem by modifying the BNF productions for <Term>. Once the error in the standard is corrected, it may be necessary to modify the productions in the UCUMFormatParser.jj file to conform to the standard.
| Modifier and Type | Class and Description |
|---|---|
static class |
UCUMFormat.Variant
Variant of unit representation in the UCUM standard
|
| Modifier and Type | Method and Description |
|---|---|
Appendable |
format(javax.measure.Unit<?> unknownUnit,
Appendable appendable) |
static UCUMFormat |
getInstance(UCUMFormat.Variant variant)
Returns the instance for formatting/parsing using the given variant
|
static UCUMFormat |
getInstance(UCUMFormat.Variant variant,
tec.uom.se.format.SymbolMap symbolMap)
Returns an instance for formatting and parsing using user defined symbols
|
protected tec.uom.se.format.SymbolMap |
getSymbols()
Get the symbol map used by this instance to map between
Units and Strings, etc... |
boolean |
isLocaleSensitive() |
void |
label(javax.measure.Unit<?> unit,
String label) |
abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> |
parse(CharSequence csq) |
protected javax.measure.Unit<?> |
parse(CharSequence csq,
int index) |
abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> |
parse(CharSequence csq,
ParsePosition cursor) |
public static UCUMFormat getInstance(UCUMFormat.Variant variant)
variant - the UCUM variant to useUCUMFormat instancepublic static UCUMFormat getInstance(UCUMFormat.Variant variant, tec.uom.se.format.SymbolMap symbolMap)
variant - the UCUM variant to usesymbolMap - the map of user defined symbols to useUCUMFormat instanceprotected tec.uom.se.format.SymbolMap getSymbols()
Units and Strings, etc...getSymbols in class tec.uom.se.format.AbstractUnitFormatpublic abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> parse(CharSequence csq, ParsePosition cursor) throws javax.measure.format.ParserException
parse in class tec.uom.se.format.AbstractUnitFormatjavax.measure.format.ParserExceptionprotected javax.measure.Unit<?> parse(CharSequence csq, int index) throws javax.measure.format.ParserException
parse in class tec.uom.se.format.AbstractUnitFormatjavax.measure.format.ParserExceptionpublic abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> parse(CharSequence csq) throws javax.measure.format.ParserException
javax.measure.format.ParserExceptionpublic Appendable format(javax.measure.Unit<?> unknownUnit, Appendable appendable) throws IOException
format in interface javax.measure.format.UnitFormatformat in class tec.uom.se.format.AbstractUnitFormatIOExceptionpublic void label(javax.measure.Unit<?> unit, String label)
label in interface javax.measure.format.UnitFormatlabel in class tec.uom.se.format.AbstractUnitFormatpublic boolean isLocaleSensitive()
Copyright © 2005–2018 Units of Measurement project. All rights reserved.