Class YearRange

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

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

      Fields 
      Modifier and Type Field Description
      static int FIRST_VALID_YEAR  
      static int UNDEFINED_YEAR
      years are defined as positive integers greater than 1900 (in the spec non-inclusive) however that might change one day
    • Constructor Summary

      Constructors 
      Constructor Description
      YearRange()
      Default constructor
      YearRange​(@NotNull YearRange yr)
      Construct a new YearRange with the same contents
    • Field Detail

      • UNDEFINED_YEAR

        public static final int UNDEFINED_YEAR
        years are defined as positive integers greater than 1900 (in the spec non-inclusive) however that might change one day
        See Also:
        Constant Field Values
    • Constructor Detail

      • YearRange

        public YearRange()
        Default constructor
      • YearRange

        public YearRange​(@NotNull
                         @NotNull YearRange yr)
        Construct a new YearRange with the same contents
        Parameters:
        yr - original YearRange
    • Method Detail

      • 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()
      • getStartYear

        public int getStartYear()
        Returns:
        the startYear
      • getEndYear

        public int getEndYear()
        Returns:
        the endYear
      • getInterval

        public int getInterval()
        Returns:
        the interval
      • setStartYear

        public void setStartYear​(int start)
        Set the start of the year range
        Parameters:
        start - the year to set
      • setEndYear

        public void setEndYear​(int end)
        Set the end of the year range
        Parameters:
        end - the year to set
      • setInterval

        public void setInterval​(int interval)
        Parameters:
        interval - the interval to set
      • isOpenEnded

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

        public void setOpenEnded​(boolean openEnded)
        Set if this range is open ended
        Parameters:
        openEnded - if true the range is open ended
      • copy

        public YearRange 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