Package ch.poole.openinghoursparser
Class DateWithOffset
java.lang.Object
ch.poole.openinghoursparser.DateWithOffset
- All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>
Container for objects from the opening_hours specification
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorDateWithOffset(@NotNull DateWithOffset dwo) Construct a new DateWithOffset with the same content -
Method Summary
Modifier and TypeMethodDescriptioncopy()Create a copy of the objeczbooleanintgetDay()intgetMonth()intgetNth()Get the occurrence value for date specification via occurrence in monthGet the WeekDay for date specification via occurrence in monthintgetYear()inthashCode()booleanCheck if this is open endedbooleanvoidsetDay(int day) Set the month day numbervoidsetDayOffset(int dayOffset) voidvoidSet a monthvoidSet date specification via occurrence in monthvoidSet date specification via occurrence in monthvoidsetOpenEnded(boolean openEnded) voidsetVarDate(@NotNull String date) Set a variable datevoidsetVarDate(VarDate varDate) voidsetWeekDayOffset(WeekDay weekDayOffset) voidsetWeekDayOffset(String weekDayOffset) voidsetWeekDayOffsetPositive(boolean weekDayOffsetPositive) voidsetYear(int year) Set the year valueCreate a string that identifies which class created it for debugging and testingtoString()booleanCheck if we don't have a month day number or equivalent
-
Field Details
-
UNDEFINED_MONTH_DAY
public static final int UNDEFINED_MONTH_DAY- See Also:
-
MIN_MONTH_DAY
public static final int MIN_MONTH_DAY- See Also:
-
MAX_MONTH_DAY
public static final int MAX_MONTH_DAY- See Also:
-
-
Constructor Details
-
DateWithOffset
public DateWithOffset()Default constructor -
DateWithOffset
Construct a new DateWithOffset with the same content- Parameters:
dwo- original DateWithOffset
-
-
Method Details
-
undefinedDay
public boolean undefinedDay()Check if we don't have a month day number or equivalent- Returns:
- true if the day is undefined
-
toString
-
equals
-
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
- Returns:
- the month
-
getDay
public int getDay()- Returns:
- the day
-
isWeekDayOffsetPositive
public boolean isWeekDayOffsetPositive()- Returns:
- the weekDayOffsetPositive
-
getWeekDayOffset
- Returns:
- the weekDayOffset
-
getDayOffset
public int getDayOffset()- Returns:
- the dayOffset
-
getVarDate
- Returns:
- the varDate
-
setVarDate
- Parameters:
varDate- the varDate to set
-
setVarDate
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
- Parameters:
month- the month to set
-
setMonth
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
Set date specification via occurrence in month- Parameters:
day- week day to usenth- the occurrence in the month positive number between -5 and 5, negative numbers are last occurrence (-1), before last (-2) and so on
-
setNth
Set date specification via occurrence in month- Parameters:
day- WeekDay to usenth- the occurrence in the month positive number between -5 and 5, negative numbers are last occurrence (-1), before last (-2) and so on
-
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
- Parameters:
weekDayOffset- the weekDayOffset to set
-
setWeekDayOffset
- Parameters:
weekDayOffset- the weekDayOffset to set
-
setDayOffset
public void setDayOffset(int dayOffset) - Parameters:
dayOffset- the dayOffset to set
-
copy
Description copied from interface:CopyCreate a copy of the objecz- Returns:
- a copy of the object
-
toDebugString
Create a string that identifies which class created it for debugging and testing- Returns:
- the output of toString with the class name prepended
-