Package ch.poole.openinghoursparser
Class YearRange
- java.lang.Object
-
- ch.poole.openinghoursparser.YearRange
-
- All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>
public class YearRange extends java.lang.ObjectContainer for objects from the opening_hours specification
-
-
Field Summary
Fields Modifier and Type Field Description static intFIRST_VALID_YEARstatic intUNDEFINED_YEARyears are defined as positive integers greater than 1900 (in the spec non-inclusive) however that might change one day
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description YearRangecopy()Create a copy of the objeczbooleanequals(java.lang.Object other)intgetEndYear()intgetInterval()intgetStartYear()inthashCode()booleanisOpenEnded()Check if this is open endedvoidsetEndYear(int end)Set the end of the year rangevoidsetInterval(int interval)voidsetOpenEnded(boolean openEnded)Set if this range is open endedvoidsetStartYear(int start)Set the start of the year rangejava.lang.StringtoDebugString()Create a string that identifies which class created it for debugging and testingjava.lang.StringtoString()
-
-
-
Field Detail
-
FIRST_VALID_YEAR
public static final int FIRST_VALID_YEAR
- See Also:
- Constant Field Values
-
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:
toStringin classjava.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:CopyCreate 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
-
-