Class DateRange

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

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

      Constructors 
      Constructor Description
      DateRange()
      Default constructor
      DateRange​(@NotNull DateRange dr)
      Construct a new DateRange with the same content
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DateRange copy()
      Create a copy of the objecz
      boolean equals​(java.lang.Object other)  
      @Nullable DateWithOffset getEndDate()
      Get the end date of the range
      int getInterval()
      Get the interval for the date range Note: currently the opening hours specification is quiet on what units this is supposed to be in
      @NotNull DateWithOffset getStartDate()
      Get the start date of the range
      int hashCode()  
      void setEndDate​(@Nullable DateWithOffset endDate)
      Set the end date of the range
      void setInterval​(int interval)
      Set an interval for the date range Note: currently the opening hours specification is quiet on what units this is supposed to be in
      void setStartDate​(@NotNull DateWithOffset startDate)
      Set the start date of the range
      java.lang.String toDebugString()
      Create a string that identifies which class created it for debugging and testing
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DateRange

        public DateRange()
        Default constructor
      • DateRange

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

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.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
      • equals

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

        public int hashCode()
      • getStartDate

        @NotNull
        public @NotNull DateWithOffset getStartDate()
        Get the start date of the range
        Returns:
        the startDate
      • getEndDate

        @Nullable
        public @Nullable DateWithOffset getEndDate()
        Get the end date of the range
        Returns:
        the endDate, null if not present
      • getInterval

        public int getInterval()
        Get the interval for the date range Note: currently the opening hours specification is quiet on what units this is supposed to be in
        Returns:
        the interval, 0 if no interval
      • setStartDate

        public void setStartDate​(@NotNull
                                 @NotNull DateWithOffset startDate)
        Set the start date of the range
        Parameters:
        startDate - the startDate to set, can not be null
      • setEndDate

        public void setEndDate​(@Nullable
                               @Nullable DateWithOffset endDate)
        Set the end date of the range
        Parameters:
        endDate - the end date of the range to set, null if there is no end date
      • setInterval

        public void setInterval​(int interval)
        Set an interval for the date range Note: currently the opening hours specification is quiet on what units this is supposed to be in
        Parameters:
        interval - the interval to set
      • copy

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