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
Unit s and String s, 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 usepublic 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 useprotected tec.uom.se.format.SymbolMap getSymbols()
Unit
s and String
s, etc...getSymbols
in class tec.uom.se.format.AbstractUnitFormat
public 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.AbstractUnitFormat
javax.measure.format.ParserException
protected javax.measure.Unit<?> parse(CharSequence csq, int index) throws javax.measure.format.ParserException
parse
in class tec.uom.se.format.AbstractUnitFormat
javax.measure.format.ParserException
public abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> parse(CharSequence csq) throws javax.measure.format.ParserException
javax.measure.format.ParserException
public Appendable format(javax.measure.Unit<?> unknownUnit, Appendable appendable) throws IOException
format
in interface javax.measure.format.UnitFormat
format
in class tec.uom.se.format.AbstractUnitFormat
IOException
public void label(javax.measure.Unit<?> unit, String label)
label
in interface javax.measure.format.UnitFormat
label
in class tec.uom.se.format.AbstractUnitFormat
public boolean isLocaleSensitive()
Copyright © 2005-2018 Units of Measurement project. All Rights Reserved.