javax.measure.unit.format
Class UCUMFormat

java.lang.Object
  extended by java.text.Format
      extended by javax.measure.unit.UnitFormat
          extended by javax.measure.unit.format.UCUMFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public abstract class UCUMFormat
extends UnitFormat

This class provides the interface for formatting and parsing units according to the Uniform Code for Units of Measure (UCUM).

For a technical/historical overview of this format please read Units 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 UCUMParser.jj file to conform to the standard.

Version:
1.0
Author:
Eric Russell
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Method Summary
 java.lang.Appendable format(Unit<?> unit, java.lang.Appendable appendable)
          Formats the specified unit.
static UCUMFormat getCaseInsensitiveInstance()
          Returns the instance for formatting and parsing using case insensitive symbols
static UCUMFormat getCaseInsensitiveInstance(SymbolMap symbolMap)
          Returns a case insensitive instance for formatting and parsing using user defined symbols
static UCUMFormat getCaseSensitiveInstance()
          Returns the instance for formatting and parsing using case sensitive symbols
static UCUMFormat getCaseSensitiveInstance(SymbolMap symbolMap)
          Returns a case sensitive instance for formatting and parsing using user defined symbols
static UCUMFormat getPrintInstance()
          Returns the instance for formatting using "print" symbols
static UCUMFormat getPrintInstance(SymbolMap symbolMap)
          Returns the instance for formatting using user defined symbols
 
Methods inherited from class javax.measure.unit.UnitFormat
format, format, getInstance, getInstance, getStandard, parse, parseObject
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrintInstance

public static UCUMFormat getPrintInstance()
Returns the instance for formatting using "print" symbols


getPrintInstance

public static UCUMFormat getPrintInstance(SymbolMap symbolMap)
Returns the instance for formatting using user defined symbols


getCaseSensitiveInstance

public static UCUMFormat getCaseSensitiveInstance()
Returns the instance for formatting and parsing using case sensitive symbols


getCaseSensitiveInstance

public static UCUMFormat getCaseSensitiveInstance(SymbolMap symbolMap)
Returns a case sensitive instance for formatting and parsing using user defined symbols


getCaseInsensitiveInstance

public static UCUMFormat getCaseInsensitiveInstance()
Returns the instance for formatting and parsing using case insensitive symbols


getCaseInsensitiveInstance

public static UCUMFormat getCaseInsensitiveInstance(SymbolMap symbolMap)
Returns a case insensitive instance for formatting and parsing using user defined symbols


format

public java.lang.Appendable format(Unit<?> unit,
                                   java.lang.Appendable appendable)
                            throws java.io.IOException
Description copied from class: UnitFormat
Formats the specified unit.

Specified by:
format in class UnitFormat
Parameters:
unit - the unit to format.
appendable - the appendable destination.
Throws:
java.io.IOException - if an error occurs.


Copyright © 2009 JScience. All Rights Reserved.