Package ch.poole.openinghoursparser
Class OpeningHoursParser
- java.lang.Object
-
- ch.poole.openinghoursparser.OpeningHoursParser
-
- All Implemented Interfaces:
OpeningHoursParserConstants
public class OpeningHoursParser extends java.lang.Object implements OpeningHoursParserConstants
-
-
Field Summary
Fields Modifier and Type Field Description Tokenjj_ntNext token.TokentokenCurrent token.OpeningHoursParserTokenManagertoken_sourceGenerated Token Manager.-
Fields inherited from interface ch.poole.openinghoursparser.OpeningHoursParserConstants
ALWAYS, AM, BRACKET_LEFT, BRACKET_RIGHT, CHAR, COLON, COMMA, COMMENT_STATE, DAYS, DEFAULT, DIGIT, ENDQUOTE, EOF, EVENTS, FALLBACKSEPERATOR, H, HOLIDAYS, HYPHEN, MODIFIER, MONTH, NUMBER, PLUS, PM, QUOTE, SEMICOLON, SLASH, STOP, TO, tokenImage, UNEXPECTED_CHAR, VARDATE, WEEK, WEEKDAY, WEEKDAY3, WEEKDAYDE, WS
-
-
Constructor Summary
Constructors Constructor Description OpeningHoursParser(OpeningHoursParserTokenManager tm)Constructor with generated Token Manager.OpeningHoursParser(java.io.InputStream stream)Constructor with InputStream.OpeningHoursParser(java.io.InputStream stream, java.lang.String encoding)Constructor with InputStream and supplied encodingOpeningHoursParser(java.io.Reader stream)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ch.poole.openinghoursparser.OpeningHoursParser.AMPMampm()java.lang.Stringcomment()Match a comment.DateRangedate_range()java.util.List<DateRange>date_selector()DateWithOffsetdatewithoffset(boolean mo)intdaynum()voiddisable_tracing()Disable tracing.voidenable_tracing()Enable tracing.intextendedtime()returns the total number of minutes for a time of the form hh:00 or just hh with hh up to 48ParseExceptiongenerateParseException()Generate ParseException.voidgetChar(java.lang.StringBuilder builder)Match char inside quoted string.TokengetNextToken()Get the next Token.TokengetToken(int index)Get the specific Token.Holidayholiday()java.util.List<Holiday>holiday_sequence()Tokenhours()returns a number Token if between 0 and 24 uses semantic lookaheadintinterval()Tokenminutes()returns a number Token if between 0 and 59 and starts with a suitable delimiter uses semantic lookaheadjava.lang.Stringmonth()Nthnth()Tokennumber()match a positive number larger than 1Tokenone2five()match a number between 1 and 5voidReInit(OpeningHoursParserTokenManager tm)Reinitialise.voidReInit(java.io.InputStream stream)Reinitialise.voidReInit(java.io.InputStream stream, java.lang.String encoding)Reinitialise.voidReInit(java.io.Reader stream)Reinitialise.Rulerule()RuleModifierrule_modifier()java.util.List<Rule>rules(boolean strict)Get the output of the parserjava.util.List<Rule>rules(boolean strict, boolean strictTime)Get the output of the parserinttime()returns the total number of minutes for a time of the form hh:00 or just hh AM/PM handling, see http://www.npl.co.uk/reference/faqs/is-midnight-12-am-or-12-pm-faq-time for why this is a mess 12:01pm to 12:59pm is 12:01 to 12:59 13:00pm and later is considered to be mistyped and in the 24:00 system 12:00 pm is 12:00 12:01am to 12:59am is 00:01 to 00:59 12:00am is 00:00 13:00am and later is considered to be mistyped and in the 24:00 systemjava.util.List<TimeSpan>time_selector()TimeSpantimespan()VariableTimevariabletime()WeekRangeweek_range()java.util.List<WeekRange>week_selector()java.lang.Stringweekday()WeekDayRangeweekday_range()java.util.List<WeekDayRange>weekday_selector()intweeknum()intyear()YearRangeyear_range()java.util.List<YearRange>year_selector()
-
-
-
Field Detail
-
token_source
public OpeningHoursParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
OpeningHoursParser
public OpeningHoursParser(java.io.InputStream stream)
Constructor with InputStream.
-
OpeningHoursParser
public OpeningHoursParser(java.io.InputStream stream, java.lang.String encoding)Constructor with InputStream and supplied encoding
-
OpeningHoursParser
public OpeningHoursParser(java.io.Reader stream)
Constructor.
-
OpeningHoursParser
public OpeningHoursParser(OpeningHoursParserTokenManager tm)
Constructor with generated Token Manager.
-
-
Method Detail
-
rules
public java.util.List<Rule> rules(boolean strict) throws OpeningHoursParseException
Get the output of the parser- Parameters:
strict- if true the parser will run in strict mode- Returns:
- a List of Rule elements
- Throws:
OpeningHoursParseException- on parse errors
-
rules
public java.util.List<Rule> rules(boolean strict, boolean strictTime) throws OpeningHoursParseException
Get the output of the parser- Parameters:
strict- if true the parser will run in strict modestrictTime- if false and strict is true, earlier than the start time endings will be fixed up silently- Returns:
- a List of Rule elements
- Throws:
OpeningHoursParseException- on parse errors
-
one2five
public final Token one2five() throws ParseException
match a number between 1 and 5- Throws:
ParseException
-
number
public final Token number() throws ParseException
match a positive number larger than 1- Throws:
ParseException
-
comment
public final java.lang.String comment() throws ParseExceptionMatch a comment.- Throws:
ParseException
-
getChar
public final void getChar(java.lang.StringBuilder builder) throws ParseExceptionMatch char inside quoted string.- Throws:
ParseException
-
hours
public final Token hours() throws ParseException
returns a number Token if between 0 and 24 uses semantic lookahead- Throws:
ParseException
-
minutes
public final Token minutes() throws ParseException
returns a number Token if between 0 and 59 and starts with a suitable delimiter uses semantic lookahead- Throws:
ParseException
-
time
public final int time() throws ParseExceptionreturns the total number of minutes for a time of the form hh:00 or just hh AM/PM handling, see http://www.npl.co.uk/reference/faqs/is-midnight-12-am-or-12-pm-faq-time for why this is a mess 12:01pm to 12:59pm is 12:01 to 12:59 13:00pm and later is considered to be mistyped and in the 24:00 system 12:00 pm is 12:00 12:01am to 12:59am is 00:01 to 00:59 12:00am is 00:00 13:00am and later is considered to be mistyped and in the 24:00 system- Throws:
ParseException
-
ampm
public final ch.poole.openinghoursparser.OpeningHoursParser.AMPM ampm() throws ParseException- Throws:
ParseException
-
extendedtime
public final int extendedtime() throws ParseExceptionreturns the total number of minutes for a time of the form hh:00 or just hh with hh up to 48- Throws:
ParseException
-
variabletime
public final VariableTime variabletime() throws ParseException
- Throws:
ParseException
-
interval
public final int interval() throws ParseException- Throws:
ParseException
-
timespan
public final TimeSpan timespan() throws ParseException
- Throws:
ParseException
-
time_selector
public final java.util.List<TimeSpan> time_selector() throws ParseException
- Throws:
ParseException
-
weekday
public final java.lang.String weekday() throws ParseException- Throws:
ParseException
-
weekday_range
public final WeekDayRange weekday_range() throws ParseException
- Throws:
ParseException
-
nth
public final Nth nth() throws ParseException
- Throws:
ParseException
-
weekday_selector
public final java.util.List<WeekDayRange> weekday_selector() throws ParseException
- Throws:
ParseException
-
holiday
public final Holiday holiday() throws ParseException
- Throws:
ParseException
-
holiday_sequence
public final java.util.List<Holiday> holiday_sequence() throws ParseException
- Throws:
ParseException
-
month
public final java.lang.String month() throws ParseException- Throws:
ParseException
-
date_range
public final DateRange date_range() throws ParseException
- Throws:
ParseException
-
daynum
public final int daynum() throws ParseException- Throws:
ParseException
-
year
public final int year() throws ParseException- Throws:
ParseException
-
datewithoffset
public final DateWithOffset datewithoffset(boolean mo) throws ParseException
- Throws:
ParseException
-
date_selector
public final java.util.List<DateRange> date_selector() throws ParseException
- Throws:
ParseException
-
weeknum
public final int weeknum() throws ParseException- Throws:
ParseException
-
week_range
public final WeekRange week_range() throws ParseException
- Throws:
ParseException
-
week_selector
public final java.util.List<WeekRange> week_selector() throws ParseException
- Throws:
ParseException
-
year_range
public final YearRange year_range() throws ParseException
- Throws:
ParseException
-
year_selector
public final java.util.List<YearRange> year_selector() throws ParseException
- Throws:
ParseException
-
rule_modifier
public final RuleModifier rule_modifier() throws ParseException
- Throws:
ParseException
-
rule
public final Rule rule() throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(java.io.InputStream stream)
Reinitialise.
-
ReInit
public void ReInit(java.io.InputStream stream, java.lang.String encoding)Reinitialise.
-
ReInit
public void ReInit(java.io.Reader stream)
Reinitialise.
-
ReInit
public void ReInit(OpeningHoursParserTokenManager tm)
Reinitialise.
-
getNextToken
public final Token getNextToken()
Get the next Token.
-
getToken
public final Token getToken(int index)
Get the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-