## visad.data.units
Class UnitParser

    java.lang.Object
      visad.data.units.UnitParser

All Implemented Interfaces:
  UnitParserConstants

Direct Known Subclasses:
  UnitParser

public class UnitParser
extends Object
implements UnitParserConstants

Nested Class Summary
`(package private) static class` `UnitParser.JJCalls`

Field Summary
`protected boolean` `isTime` Whether or not we're decoding a time unit.
`(package private) SimpleCharStream` `jj_input_stream`
`Token` `jj_nt`
`protected static long` `julianDayOrigin` The Julian day number of the (artificial) time origin.
`boolean` `lookingAhead`
`protected static Unit` `second` The canonical time unit.
`Token` `token`
`UnitParserTokenManager` `token_source`
`protected static UnitsDB` `unitsDB` The units database.

Fields inherited from interface visad.data.units.UnitParserConstants
`DATE, DAY, DECIMAL, DEFAULT, DIGIT, DIVIDE, EOF, EXP, FROM, HOUR, INT, INTEGER, LETTER, MINUTE, MONTH, NAME, REAL, SECOND, SHIFT, SIGN, SINCE, TIME, tokenImage, WHITESPACE, YEAR`

Constructor Summary
`UnitParser(InputStream stream)`
`UnitParser(Reader stream)`
`UnitParser(UnitParserTokenManager tm)`

Method Summary
`void` `disable_tracing()`
`void` `enable_tracing()`
`static double` `encodeTimestamp(int year, int month, int day, int hour, int minute, float second, int zone)` Encode a timestamp as a double value in units of seconds.
`ParseException` `generateParseException()`
`Token` `getNextToken()`
`Token` `getToken(int index)`
`static long` `julianDay(int year, int month, int day)` Compute the Julian day number of a date.
`static void` `main(String[] args)` Test this class.
`void` `multiply()`
`Unit` `nameExpression()`
`double` `numberExpression()`
`double` `numericalTerm()`
`Unit` `powerExpression()`
`void` `ReInit(InputStream stream)`
`void` `ReInit(Reader stream)`
`void` `ReInit(UnitParserTokenManager tm)`
`double` `shiftExpression()`
`double` `timestampExpression()`
`double` `timestampTerm()`
`Unit` `unitProductList()`
`Unit` `unitSpec()`
`double` `valueExpression()`

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

Field Detail

### unitsDB

    protected static UnitsDB unitsDB

  The units database.

### second

    protected static final Unit second

  The canonical time unit.

### isTime

    protected boolean isTime

  Whether or not we're decoding a time unit.

### julianDayOrigin

    protected static final long julianDayOrigin

  The Julian day number of the (artificial) time origin.

### token_source

    public UnitParserTokenManager token_source

### jj_input_stream

    SimpleCharStream jj_input_stream

### token

    public Token token

### jj_nt

    public Token jj_nt

### lookingAhead

    public boolean lookingAhead

Constructor Detail

### UnitParser

    public UnitParser(InputStream stream)

### UnitParser

    public UnitParser(Reader stream)

### UnitParser

    public UnitParser(UnitParserTokenManager tm)

Method Detail

### julianDay

    public static long julianDay(int year,
                                 int month,
                                 int day)

  Compute the Julian day number of a date.

### encodeTimestamp

    public static double encodeTimestamp(int year,
                                         int month,
                                         int day,
                                         int hour,
                                         int minute,
                                         float second,
                                         int zone)

  Encode a timestamp as a double value in units of seconds.

### main

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

  Test this class.

  Throws:
    `Exception`

### unitSpec

    public final Unit unitSpec()
                        throws ParseException

  Throws:
    `ParseException`

### unitProductList

    public final Unit unitProductList()
                               throws ParseException

  Throws:
    `ParseException`

### multiply

    public final void multiply()
                        throws ParseException

  Throws:
    `ParseException`

### powerExpression

    public final Unit powerExpression()
                               throws ParseException

  Throws:
    `ParseException`

### nameExpression

    public final Unit nameExpression()
                              throws ParseException

  Throws:
    `ParseException`

### numberExpression

    public final double numberExpression()
                                  throws ParseException

  Throws:
    `ParseException`

### shiftExpression

    public final double shiftExpression()
                                 throws ParseException

  Throws:
    `ParseException`

### valueExpression

    public final double valueExpression()
                                 throws ParseException

  Throws:
    `ParseException`

### numericalTerm

    public final double numericalTerm()
                               throws ParseException

  Throws:
    `ParseException`

### timestampExpression

    public final double timestampExpression()
                                     throws ParseException

  Throws:
    `ParseException`

### timestampTerm

    public final double timestampTerm()
                               throws ParseException

  Throws:
    `ParseException`

### ReInit

    public void ReInit(InputStream stream)

### ReInit

    public void ReInit(Reader stream)

### ReInit

    public void ReInit(UnitParserTokenManager tm)

### getNextToken

    public final Token getNextToken()

### getToken

    public final Token getToken(int index)

### generateParseException

    public ParseException generateParseException()

### enable_tracing

    public final void enable_tracing()

### disable_tracing

    public final void disable_tracing()