public class UnitParser extends Object implements UnitParserConstants
Modifier and Type | Field and Description |
---|---|
Token |
jj_nt
Next token.
|
protected static long |
julianDayOrigin
The Julian day number of the (artificial) time origin.
|
protected static Unit |
SECOND
The canonical time unit.
|
Token |
token
Current token.
|
UnitParserTokenManager |
token_source
Generated Token Manager.
|
protected static UnitsDB |
unitsDB
The units database.
|
Constructor and Description |
---|
UnitParser(InputStream stream)
Constructor with InputStream.
|
UnitParser(InputStream stream,
String encoding)
Constructor with InputStream and supplied encoding
|
UnitParser(Reader stream)
Constructor.
|
UnitParser(UnitParserTokenManager tm)
Constructor with generated Token Manager.
|
Modifier and Type | Method and Description |
---|---|
Unit |
basicExpr() |
Calendar |
clockExpr(Calendar calendar) |
Calendar |
dateExpr() |
void |
disable_tracing()
Disable tracing.
|
void |
enable_tracing()
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()
Generate ParseException.
|
Token |
getNextToken()
Get the next Token.
|
Token |
getToken(int index)
Get the specific Token.
|
int |
integer() |
static long |
julianDay(int year,
int month,
int day)
Compute the Julian day number of a date.
|
Unit |
logExpr() |
static void |
main(String[] args)
Test this class.
|
double |
number() |
Unit |
parse(String spec)
Parses a string unit specification.
|
Unit |
powerExpr() |
Unit |
productExpr() |
double |
real() |
void |
ReInit(InputStream stream)
Reinitialise.
|
void |
ReInit(InputStream stream,
String encoding)
Reinitialise.
|
void |
ReInit(Reader stream)
Reinitialise.
|
void |
ReInit(UnitParserTokenManager tm)
Reinitialise.
|
Unit |
shiftExpr() |
int |
sign() |
double |
tenFactor() |
double |
timeOriginExpr() |
Unit |
unitIdentifier() |
Unit |
unitSpec() |
double |
unsignedDecimal() |
int |
unsignedInteger() |
Calendar |
zoneExpr(Calendar calendar) |
protected static UnitsDB unitsDB
protected static final Unit SECOND
protected static final long julianDayOrigin
public UnitParserTokenManager token_source
public Token token
public Token jj_nt
public UnitParser(InputStream stream)
public UnitParser(InputStream stream, String encoding)
public UnitParser(Reader stream)
public UnitParser(UnitParserTokenManager tm)
public static long julianDay(int year, int month, int day)
public static double encodeTimestamp(int year, int month, int day, int hour, int minute, float second, int zone)
public Unit parse(String spec) throws ParseException, UnitException
spec
- The unit specification.Unit
corresponding to spec
.NullPointerException
- if spec
is null
.ParseException
- if a parsing error occurred.UnitException
- if the string specifies an invalid unit
operation.public final Unit unitSpec() throws ParseException, UnitException
ParseException
UnitException
public final Unit shiftExpr() throws ParseException, UnitException
ParseException
UnitException
public final Unit productExpr() throws ParseException, UnitException
ParseException
UnitException
public final Unit powerExpr() throws ParseException, UnitException
ParseException
UnitException
public final Unit basicExpr() throws ParseException, UnitException
ParseException
UnitException
public final Unit unitIdentifier() throws ParseException
ParseException
public final Unit logExpr() throws ParseException, UnitException
ParseException
UnitException
public final double number() throws ParseException
ParseException
public final double real() throws ParseException
ParseException
public final int sign() throws ParseException
ParseException
public final double unsignedDecimal() throws ParseException
ParseException
public final double tenFactor() throws ParseException
ParseException
public final int integer() throws ParseException
ParseException
public final int unsignedInteger() throws ParseException
ParseException
public final double timeOriginExpr() throws ParseException
ParseException
public final Calendar dateExpr() throws ParseException
ParseException
public final Calendar clockExpr(Calendar calendar) throws ParseException
ParseException
public final Calendar zoneExpr(Calendar calendar) throws ParseException
ParseException
public void ReInit(InputStream stream)
public void ReInit(InputStream stream, String encoding)
public void ReInit(Reader stream)
public void ReInit(UnitParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
Copyright © 1996–2023 The SSEC Visualization Project. All rights reserved.