|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.parser.TSDateParser
public class TSDateParser
Parser that assembles TSDate
objects from an input string, for
example
1960
1960.1
1960 I
1960 1/4
1960 Q4
1960 m11
The following rules apply for parsing:
XX x"/"y
, for example 1960 1/1
is
recognized for arbitrary sub periodicities with mainPeriod=XX, subPeriod=x,
subPeriodicity=y
XX ["M","m"]x
, for example 1960 M1
is
recognized as mainPeriod=XX, subPeriod=x, subPeriodicity=12 (monthly)
XX ["Q","q"]x
, for example 1960 Q1
is
recognized as mainPeriod=XX, subPeriod=x, subPeriodicity=4 (quarterly)
XX ["I", "II"]
, for example 1960 I
is
recognized as mainPeriod=XX, subPeriod=1 or 2, subPeriodicity=2 (half yearly)
XX
, for example 1960
is recognized as
mainPeriod=XX, subPeriod=1, subPeriodicity=1 (yearly)
XX.x
, for example 1960.1
is recognized as
mainPeriod=XX, subPeriod=x, subPeriodicity=subPeriodicity (needs to be set as
argument)
You can use the parser via the
parseString(input, subPeriodicity)
method. Whenever the
information about the sub periodicity is contained in the input string, it is
used and the explicit argument is ignored. But it is needed for dates coded
as XX.x
, because there is no way to retrieve the sub
periodicity from that format, although it is often used and convenient.
TSDate
Field Summary | |
---|---|
Token |
jj_nt
|
boolean |
lookingAhead
|
Token |
token
|
TSDateParserTokenManager |
token_source
|
Fields inherited from interface com.jstatcom.parser.TSDateParserConstants |
---|
DEFAULT, DELIM, DIGIT, EOF, EOL, HALFYEAR1, HALFYEAR2, INTEGER, MINUS, MONTH, QUARTER, tokenImage |
Constructor Summary | |
---|---|
TSDateParser()
Default constructor. |
|
TSDateParser(java.io.InputStream stream)
|
|
TSDateParser(java.io.Reader stream)
|
|
TSDateParser(TSDateParserTokenManager tm)
|
Method Summary | |
---|---|
void |
disable_tracing()
|
void |
enable_tracing()
|
ParseException |
generateParseException()
|
Token |
getNextToken()
|
Token |
getToken(int index)
|
static void |
main(java.lang.String[] args)
|
TSDate |
parseString(java.lang.String inputString,
int subPeriodicity)
Reinitializes this engine and parses an input String. |
void |
ReInit(java.io.InputStream stream)
|
void |
ReInit(java.io.Reader stream)
|
void |
ReInit(TSDateParserTokenManager tm)
|
int |
toeval(int subPeriodicity)
|
void |
tsdate(int subPeriodicity)
Possible date formats. |
void |
tsdefault()
Default 1960 1/4. |
void |
tshalfyearly()
Half-Yearly 1960 II. |
void |
tsmonthly()
Monthly 1960 M11. |
void |
tsquarterly()
Quarterly 1960 Q3. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public TSDateParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
Constructor Detail |
---|
public TSDateParser()
public TSDateParser(TSDateParserTokenManager tm)
public TSDateParser(java.io.InputStream stream)
public TSDateParser(java.io.Reader stream)
Method Detail |
---|
public final void disable_tracing()
public final void enable_tracing()
public final ParseException generateParseException()
public final Token getNextToken()
public final Token getToken(int index)
public static void main(java.lang.String[] args) throws ParseException
ParseException
public TSDate parseString(java.lang.String inputString, int subPeriodicity) throws ParseException, TokenMgrError, java.lang.IllegalArgumentException
inputString
- the String to parsesubPeriodicity
- defines number of sub periods for the parser run, the argument
is ignored if the inputString contains this information, if
set to <1, then the string must contain the sub periodicity
java.lang.IllegalArgumentException
- if TSDate assembly failed due to wrong arguments
ParseException
- if parsing failed, contains error description
TokenMgrError
- if tokenizing failed, contains error descriptionpublic void ReInit(TSDateParserTokenManager tm)
public void ReInit(java.io.InputStream stream)
public void ReInit(java.io.Reader stream)
public final int toeval(int subPeriodicity) throws ParseException
ParseException
public final void tsdate(int subPeriodicity) throws ParseException
ParseException
public final void tsdefault() throws ParseException
ParseException
public final void tshalfyearly() throws ParseException
ParseException
public final void tsmonthly() throws ParseException
ParseException
public final void tsquarterly() throws ParseException
ParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |