Class RMDateParser

java.lang.Object
com.inductiveautomation.rm.parsing.RMDateParser
All Implemented Interfaces:
RMDateParserConstants

public class RMDateParser extends Object implements RMDateParserConstants
  • Field Details

  • Constructor Details

    • RMDateParser

      public RMDateParser()
    • RMDateParser

      public RMDateParser(Locale l)
    • RMDateParser

      public RMDateParser(InputStream stream)
      Constructor with InputStream.
    • RMDateParser

      public RMDateParser(InputStream stream, String encoding)
      Constructor with InputStream and supplied encoding
    • RMDateParser

      public RMDateParser(Reader stream)
      Constructor.
    • RMDateParser

      public RMDateParser(RMDateParserTokenManager tm)
      Constructor with generated Token Manager.
  • Method Details

    • resetLocale

      public void resetLocale(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 Date getDate(String aString)
      Main entry point. Parses aString as best it can.
    • main

      public static void main(String[] args)
    • one_line

      public final Date one_line() throws ParseException
      Throws:
      ParseException
    • date

      public final Date date() throws ParseException
      Throws:
      ParseException
    • localField

      public final int localField() throws ParseException
      Throws:
      ParseException
    • initLocale

      public final int[] initLocale() throws ParseException
      Throws:
      ParseException
    • month

      public final int month() throws ParseException
      Throws:
      ParseException
    • weekday

      public final int weekday() throws ParseException
      Throws:
      ParseException
    • modifier

      public final int modifier() throws ParseException
      Throws:
      ParseException
    • calendarField

      public final int calendarField() throws ParseException
      Throws:
      ParseException
    • intInRange

      public final int intInRange(int lo, int hi) throws ParseException
      Throws:
      ParseException
    • 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
    • dayOrdinal

      public final int dayOrdinal() throws ParseException
      Throws:
      ParseException
    • twoOrFourDigitYear

      public final int twoOrFourDigitYear() throws ParseException
      Throws:
      ParseException
    • twoOrFourDigitDateField

      public final int twoOrFourDigitDateField(boolean isYear) throws ParseException
      Throws:
      ParseException
    • fourDigitInt

      public final int fourDigitInt() throws ParseException
      Throws:
      ParseException
    • relative_date

      public final void relative_date() throws ParseException
      Throws:
      ParseException
    • holiday

      public final void holiday(int modifier) throws ParseException
      Throws:
      ParseException
    • specific_day

      public final void specific_day() throws ParseException
      Throws:
      ParseException
    • datePartsSeparator

      public final void datePartsSeparator() throws ParseException
      Throws:
      ParseException
    • simple_date

      public final void simple_date() throws ParseException
      Throws:
      ParseException
    • absolute_date

      public final void absolute_date() throws ParseException
      Throws:
      ParseException
    • long_date

      public final void long_date() throws ParseException
      Throws:
      ParseException
    • settime

      public final void settime() throws ParseException
      Throws:
      ParseException
    • settimezone

      public final void settimezone() throws ParseException
      Throws:
      ParseException
    • fraction

      public final double fraction() throws ParseException
      Throws:
      ParseException
    • iso_8601_date

      public final void iso_8601_date() throws ParseException
      Throws:
      ParseException
    • setiso_8601_time

      public final void setiso_8601_time() throws ParseException
      Throws:
      ParseException
    • setiso_8601_timezone

      public final void setiso_8601_timezone() throws ParseException
      Throws:
      ParseException
    • ReInit

      public void ReInit(InputStream stream)
      Reinitialise.
    • ReInit

      public void ReInit(InputStream stream, String encoding)
      Reinitialise.
    • ReInit

      public void ReInit(Reader stream)
      Reinitialise.
    • ReInit

      public void ReInit(RMDateParserTokenManager 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.