public abstract class UCUMFormat extends tech.units.indriya.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,
tech.units.indriya.format.SymbolMap symbolMap)
Returns an instance for formatting and parsing using user defined symbols
|
protected tech.units.indriya.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, tech.units.indriya.format.SymbolMap symbolMap)
variant - the UCUM variant to usesymbolMap - the map of user defined symbols to useUCUMFormat instanceprotected tech.units.indriya.format.SymbolMap getSymbols()
Units and Strings, etc...public abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> parse(CharSequence csq, ParsePosition cursor) throws javax.measure.format.MeasurementParseException
parse in interface javax.measure.format.UnitFormatparse in class tech.units.indriya.format.AbstractUnitFormatjavax.measure.format.MeasurementParseExceptionprotected javax.measure.Unit<?> parse(CharSequence csq, int index) throws javax.measure.format.MeasurementParseException
parse in class tech.units.indriya.format.AbstractUnitFormatjavax.measure.format.MeasurementParseExceptionpublic abstract javax.measure.Unit<? extends javax.measure.Quantity<?>> parse(CharSequence csq) throws javax.measure.format.MeasurementParseException
javax.measure.format.MeasurementParseExceptionpublic Appendable format(javax.measure.Unit<?> unknownUnit, Appendable appendable) throws IOException
format in interface javax.measure.format.UnitFormatformat in class tech.units.indriya.format.AbstractUnitFormatIOExceptionpublic void label(javax.measure.Unit<?> unit, String label)
label in interface javax.measure.format.UnitFormatlabel in class tech.units.indriya.format.AbstractUnitFormatpublic boolean isLocaleSensitive()
Copyright © 2005–2021 Units of Measurement project. All rights reserved.