|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object visad.data.units.UnitParser
public class UnitParser
A class for parsing string unit specifications. Instances are thread-compatible but not thread-safe.
Field Summary | |
---|---|
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. |
Fields inherited from interface visad.data.units.UnitParserConstants |
---|
COLON, DEFAULT, DIVIDE, EOF, LB, LETTER, LG, LN, LPAREN, MINUS, NAME, PERIOD, PLUS, RAISE, REAL_EXP, RPAREN, SHIFT, SIGN, SP, STAR, SYMBOL, T, tokenImage, UINT, UTC |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public UnitParser(InputStream stream)
public UnitParser(InputStream stream, String encoding)
public UnitParser(Reader stream)
public UnitParser(UnitParserTokenManager tm)
Method Detail |
---|
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 static void main(String[] args) throws Exception
Exception
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |