Class RMDateParser

    • Constructor Detail

      • RMDateParser

        public RMDateParser()
      • RMDateParser

        public RMDateParser​(java.util.Locale l)
      • RMDateParser

        public RMDateParser​(java.io.InputStream stream)
        Constructor with InputStream.
      • RMDateParser

        public RMDateParser​(java.io.InputStream stream,
                            java.lang.String encoding)
        Constructor with InputStream and supplied encoding
      • RMDateParser

        public RMDateParser​(java.io.Reader stream)
        Constructor.
    • Method Detail

      • resetLocale

        public void resetLocale​(java.util.Locale l)
        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

        public java.util.Date getDate​(java.lang.String aString)
        Main entry point. Parses aString as best it can.
      • main

        public static void main​(java.lang.String[] args)
      • date_expression

        public final void date_expression()
                                   throws ParseException
        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
      • 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.
      • 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.