Class DateWithOffset

  • All Implemented Interfaces:
    Copy<ch.poole.openinghoursparser.Element>

    public class DateWithOffset
    extends java.lang.Object
    Container for objects from the opening_hours specification
    • Constructor Detail

      • DateWithOffset

        public DateWithOffset()
        Default constructor
      • DateWithOffset

        public DateWithOffset​(@NotNull
                              @NotNull DateWithOffset dwo)
        Construct a new DateWithOffset with the same content
        Parameters:
        dwo - original DateWithOffset
    • Method Detail

      • undefinedDay

        public boolean undefinedDay()
        Check if we don't have a month day number or equivalent
        Returns:
        true if the day is undefined
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
      • hashCode

        public int hashCode()
      • isOpenEnded

        public boolean isOpenEnded()
        Check if this is open ended
        Returns:
        true if open ended
      • getYear

        public int getYear()
        Returns:
        the year
      • getMonth

        public Month getMonth()
        Returns:
        the month
      • getDay

        public int getDay()
        Returns:
        the day
      • isWeekDayOffsetPositive

        public boolean isWeekDayOffsetPositive()
        Returns:
        the weekDayOffsetPositive
      • getWeekDayOffset

        public WeekDay getWeekDayOffset()
        Returns:
        the weekDayOffset
      • getDayOffset

        public int getDayOffset()
        Returns:
        the dayOffset
      • getVarDate

        public VarDate getVarDate()
        Returns:
        the varDate
      • setVarDate

        public void setVarDate​(VarDate varDate)
        Parameters:
        varDate - the varDate to set
      • setVarDate

        public void setVarDate​(@NotNull
                               @NotNull java.lang.String date)
        Set a variable date
        Parameters:
        date - the var date
      • setOpenEnded

        public void setOpenEnded​(boolean openEnded)
        Parameters:
        openEnded - the openEnded to set
      • setYear

        public void setYear​(int year)
        Set the year value
        Parameters:
        year - the year to set
      • setMonth

        public void setMonth​(Month month)
        Parameters:
        month - the month to set
      • setMonth

        public void setMonth​(java.lang.String month)
        Set a month
        Parameters:
        month - the month
      • setDay

        public void setDay​(int day)
        Set the month day number
        Parameters:
        day - the day to set
      • setNth

        public void setNth​(java.lang.String day,
                           int nth)
        Set date specification via occurrence in month
        Parameters:
        day - week day to use
        nth - the occurrence in the month positive number between -5 and 5, negative numbers are last occurrence (-1), before last (-2) and so on
      • setNth

        public void setNth​(WeekDay day,
                           int nth)
        Set date specification via occurrence in month
        Parameters:
        day - WeekDay to use
        nth - the occurrence in the month positive number between -5 and 5, negative numbers are last occurrence (-1), before last (-2) and so on
      • getNthWeekDay

        public WeekDay getNthWeekDay()
        Get the WeekDay for date specification via occurrence in month
        Returns:
        the WeekDay or null if not set
      • getNth

        public int getNth()
        Get the occurrence value for date specification via occurrence in month
        Returns:
        a integer between -5 and 5, valid only if the WeekDay has been set
      • setWeekDayOffsetPositive

        public void setWeekDayOffsetPositive​(boolean weekDayOffsetPositive)
        Parameters:
        weekDayOffsetPositive - the weekDayOffsetPositive to set
      • setWeekDayOffset

        public void setWeekDayOffset​(WeekDay weekDayOffset)
        Parameters:
        weekDayOffset - the weekDayOffset to set
      • setWeekDayOffset

        public void setWeekDayOffset​(java.lang.String weekDayOffset)
        Parameters:
        weekDayOffset - the weekDayOffset to set
      • setDayOffset

        public void setDayOffset​(int dayOffset)
        Parameters:
        dayOffset - the dayOffset to set
      • copy

        public DateWithOffset copy()
        Description copied from interface: Copy
        Create a copy of the objecz
        Returns:
        a copy of the object
      • toDebugString

        public java.lang.String toDebugString()
        Create a string that identifies which class created it for debugging and testing
        Returns:
        the output of toString with the class name prepended