Class YearRange

java.lang.Object
ch.poole.openinghoursparser.YearRange
All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>

public class YearRange extends Object
Container for objects from the opening_hours specification
  • Field Details

    • FIRST_VALID_YEAR

      public static final int FIRST_VALID_YEAR
      See Also:
    • 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:
  • Constructor Details

    • 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 Details

    • toString

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

      public boolean equals(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 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