Class RMDateParser
java.lang.Object
com.inductiveautomation.rm.parsing.RMDateParser
- All Implemented Interfaces:
RMDateParserConstants
-
Field Summary
FieldsModifier and TypeFieldDescriptionNext token.Current token.Generated Token Manager.Fields inherited from interface com.inductiveautomation.rm.parsing.RMDateParserConstants
A, AFTER, AGO, AM, AMPM, APR, APRILFOOLS, AT, AUG, BASTILLEDAY, BDAY, BEFORE, BLACKTUESDAY, BOXINGDAY, CHRISTMAS, CINCODEMAYO, COLON, DASH, DAY, DDAY, DEC, DECIMAL, DEFAULT, EOF, EOL, EVE, FEB, FIRST, FOURDIGIT, FOURTH, FRI, GMT, GROUNDHOGDAY, HALLOWEEN, HENCE, INDEPENDENCEDAY, INITLOCALE, ISO8601GMT, ISO8601SEPARATOR, JAN, JEFFSDAY, JILLSDAY, JOSHSDAY, JUL, JUN, LAST, LOCAL_DATEFIELD, LOCAL_SEPARATOR, MAR, MAY, MINSEC, MON, MONTH, NEVER, NEWYEARS, NEXT, NOV, NOW, OCT, ONEDIGIT, PEARLHARBOR, PERIOD, PM, SAINT, SAT, SECOND, SEP, SLASH, STPATTYSDAY, SUN, THE, THIRD, THIS, THISCOMING, THISPAST, THU, TIME, TIMEZONE, TIMEZONEOFFSET, TODAY, tokenImage, TOMORROW, TUE, TWODIGIT, TZ, VALENTINESDAY, VEDAY, VJDAY, WED, WEEK, YEAR, YESTERDAY
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with generated Token Manager.RMDateParser
(InputStream stream) Constructor with InputStream.RMDateParser
(InputStream stream, String encoding) Constructor with InputStream and supplied encodingRMDateParser
(Reader stream) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final int
final Date
date()
final void
simple expressions, like "3 weeks from this past christmas" or "a year ago", "3 months from now", " Doesn't do things like "8/13/99 + 3 days", but that seems really stupid Some other interesting cases that we don't handle might be : "the 4th thursday in November", "the saturday after christmas" "the last monday in may" "a week ago this friday"final void
final int
final void
Disable tracing.final void
Enable tracing.final int
final double
fraction()
Generate ParseException.Main entry point.final Token
Get the next Token.final Token
getToken
(int index) Get the specific Token.final void
holiday
(int modifier) final int[]
final int
intInRange
(int lo, int hi) final void
final int
final void
static void
final int
modifier()
final int
month()
final Date
one_line()
void
Reinitialise.void
ReInit
(InputStream stream) Reinitialise.void
ReInit
(InputStream stream, String encoding) Reinitialise.void
Reinitialise.final void
void
Set the locale.void
setAcceptsTwoDigitYears
(int earliest) Y2K handling - accept 2 digit years.final void
final void
void
Y2K handling - call this to make the parser throw an error when it encounters a 2 digit yearfinal void
settime()
final void
final void
final void
final int
twoOrFourDigitDateField
(boolean isYear) final int
final int
weekday()
-
Field Details
-
token_source
Generated Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
RMDateParser
public RMDateParser() -
RMDateParser
-
RMDateParser
Constructor with InputStream. -
RMDateParser
Constructor with InputStream and supplied encoding -
RMDateParser
Constructor. -
RMDateParser
Constructor with generated Token Manager.
-
-
Method Details
-
resetLocale
Set the locale. Currently just uses the DateFormat to figure out how to interpret "3/4/05" -
setRejectsTwoDigitYears
public void setRejectsTwoDigitYears()Y2K handling - call this to make the parser throw an error when it encounters a 2 digit year -
setAcceptsTwoDigitYears
public void setAcceptsTwoDigitYears(int earliest) Y2K handling - accept 2 digit years.'earliest' can be anything, and is the earliest possible year that would be representable by 2 digits. setAcceptsTwoDigitYears(1920) : 00->2000, 01->2001,...,19->2019, 20->1920, 21-1921... setAcceptsTwoDigitYears(1700) : 00->1700, ... 99->1799 This is similar to DateFormatter, but they let you pick the earliest day: eg. {8/13/1920 - 8/13/2019} which seems like overkill.
-
getDate
Main entry point. Parses aString as best it can. -
main
-
one_line
- Throws:
ParseException
-
date
- Throws:
ParseException
-
localField
- Throws:
ParseException
-
initLocale
- Throws:
ParseException
-
month
- Throws:
ParseException
-
weekday
- Throws:
ParseException
-
modifier
- Throws:
ParseException
-
calendarField
- Throws:
ParseException
-
intInRange
- Throws:
ParseException
-
date_expression
simple expressions, like "3 weeks from this past christmas" or "a year ago", "3 months from now", " Doesn't do things like "8/13/99 + 3 days", but that seems really stupid Some other interesting cases that we don't handle might be : "the 4th thursday in November", "the saturday after christmas" "the last monday in may" "a week ago this friday"- Throws:
ParseException
-
dayOrdinal
- Throws:
ParseException
-
twoOrFourDigitYear
- Throws:
ParseException
-
twoOrFourDigitDateField
- Throws:
ParseException
-
fourDigitInt
- Throws:
ParseException
-
relative_date
- Throws:
ParseException
-
holiday
- Throws:
ParseException
-
specific_day
- Throws:
ParseException
-
datePartsSeparator
- Throws:
ParseException
-
simple_date
- Throws:
ParseException
-
absolute_date
- Throws:
ParseException
-
long_date
- Throws:
ParseException
-
settime
- Throws:
ParseException
-
settimezone
- Throws:
ParseException
-
fraction
- Throws:
ParseException
-
iso_8601_date
- Throws:
ParseException
-
setiso_8601_time
- Throws:
ParseException
-
setiso_8601_timezone
- Throws:
ParseException
-
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-