uk.me.nxg.unity
Class UnitDefinitionMap

java.lang.Object
  extended by uk.me.nxg.unity.UnitDefinitionMap

public abstract class UnitDefinitionMap
extends Object

Provides a mapping from unit abbreviations to unit definitions.

This is a singleton class, so clients must first obtain the instance of the class using getInstance().


Method Summary
static UnitDefinitionMap getInstance()
          Obtain an instance of the unit-definition map.
 UnitDefinition lookupUnitDefinition(Syntax syntax, String symbol)
          Obtain unit-definition information for a symbol, as interpreted in a particular syntax.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UnitDefinitionMap getInstance()
Obtain an instance of the unit-definition map.


lookupUnitDefinition

public UnitDefinition lookupUnitDefinition(Syntax syntax,
                                           String symbol)
Obtain unit-definition information for a symbol, as interpreted in a particular syntax. Return null if the syntax is unrecognised, or if the symbol is not recognised within that syntax

Parameters:
symbol - a symbol for a unit, without prefix (eg 'm' for metre, not 'mm')
syntax - one of the syntaxes of Syntax
Returns:
a UnitDefinition instance, or null if this is not available