## visad.data.units
Class Parser

    java.lang.Object
      visad.data.units.Parser

Direct Known Subclasses:
  Parser

public class Parser
extends Object

Class for parsing unit specifications.

Field Summary
`protected static Parser` `parser` The singleton instance of this class.
`protected static UnitParser` `unitParser` The unit parser.

Constructor Summary
`protected` `Parser()` Default constructor.

Method Summary
`static Parser` `instance()` Obtain the singleton instance of this class.
`static void` `main(String[] args)` Test this class.
`static Unit` `parse(String spec)` Parse a unit specification.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### unitParser

    protected static final UnitParser unitParser

  The unit parser.

### parser

    protected static final Parser parser

  The singleton instance of this class.

Constructor Detail

### Parser

    protected Parser()

  Default constructor. Protected to ensure use of singleton.

Method Detail

### instance

    public static Parser instance()

  Obtain the singleton instance of this class. Strictly speaking, this isn't necessary since `parse()` is a class method.

### parse

    public static Unit parse(String spec)
                      throws ParseException,
                             NoSuchUnitException

  Parse a unit specification.

  Throws:
    `ParseException` - An error occurred while parsing the specification.
    `NoSuchUnitException`

### main

    public static void main(String[] args)
                     throws ParseException

  Test this class.

  Throws:
    `ParseException`