Package ch.poole.openinghoursparser
Class DateWithOffset
- java.lang.Object
-
- ch.poole.openinghoursparser.DateWithOffset
-
- All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>
public class DateWithOffset extends java.lang.ObjectContainer for objects from the opening_hours specification
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_MONTH_DAYstatic intMIN_MONTH_DAYstatic intUNDEFINED_MONTH_DAY
-
Constructor Summary
Constructors Constructor Description DateWithOffset()Default constructorDateWithOffset(@NotNull DateWithOffset dwo)Construct a new DateWithOffset with the same content
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateWithOffsetcopy()Create a copy of the objeczbooleanequals(java.lang.Object other)intgetDay()intgetDayOffset()MonthgetMonth()intgetNth()Get the occurrence value for date specification via occurrence in monthWeekDaygetNthWeekDay()Get the WeekDay for date specification via occurrence in monthVarDategetVarDate()WeekDaygetWeekDayOffset()intgetYear()inthashCode()booleanisOpenEnded()Check if this is open endedbooleanisWeekDayOffsetPositive()voidsetDay(int day)Set the month day numbervoidsetDayOffset(int dayOffset)voidsetMonth(Month month)voidsetMonth(java.lang.String month)Set a monthvoidsetNth(WeekDay day, int nth)Set date specification via occurrence in monthvoidsetNth(java.lang.String day, int nth)Set date specification via occurrence in monthvoidsetOpenEnded(boolean openEnded)voidsetVarDate(@NotNull java.lang.String date)Set a variable datevoidsetVarDate(VarDate varDate)voidsetWeekDayOffset(WeekDay weekDayOffset)voidsetWeekDayOffset(java.lang.String weekDayOffset)voidsetWeekDayOffsetPositive(boolean weekDayOffsetPositive)voidsetYear(int year)Set the year valuejava.lang.StringtoDebugString()Create a string that identifies which class created it for debugging and testingjava.lang.StringtoString()booleanundefinedDay()Check if we don't have a month day number or equivalent
-
-
-
Field Detail
-
UNDEFINED_MONTH_DAY
public static final int UNDEFINED_MONTH_DAY
- See Also:
- Constant Field Values
-
MIN_MONTH_DAY
public static final int MIN_MONTH_DAY
- See Also:
- Constant Field Values
-
MAX_MONTH_DAY
public static final int MAX_MONTH_DAY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DateWithOffset
public DateWithOffset()
Default constructor
-
DateWithOffset
public DateWithOffset(@NotNull @NotNull DateWithOffset dwo)Construct a new DateWithOffset with the same content- Parameters:
dwo- original DateWithOffset
-
-
Method Detail
-
undefinedDay
public boolean undefinedDay()
Check if we don't have a month day number or equivalent- Returns:
- true if the day is undefined
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
-
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
public Month getMonth()
- Returns:
- the month
-
getDay
public int getDay()
- Returns:
- the day
-
isWeekDayOffsetPositive
public boolean isWeekDayOffsetPositive()
- Returns:
- the weekDayOffsetPositive
-
getWeekDayOffset
public WeekDay getWeekDayOffset()
- Returns:
- the weekDayOffset
-
getDayOffset
public int getDayOffset()
- Returns:
- the dayOffset
-
getVarDate
public VarDate getVarDate()
- Returns:
- the varDate
-
setVarDate
public void setVarDate(VarDate varDate)
- Parameters:
varDate- the varDate to set
-
setVarDate
public void setVarDate(@NotNull @NotNull java.lang.String date)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
public void setMonth(Month month)
- Parameters:
month- the month to set
-
setMonth
public void setMonth(java.lang.String month)
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
public void setNth(java.lang.String day, int nth)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
public void setNth(WeekDay day, int nth)
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
public WeekDay 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
public void setWeekDayOffset(WeekDay weekDayOffset)
- Parameters:
weekDayOffset- the weekDayOffset to set
-
setWeekDayOffset
public void setWeekDayOffset(java.lang.String weekDayOffset)
- Parameters:
weekDayOffset- the weekDayOffset to set
-
setDayOffset
public void setDayOffset(int dayOffset)
- Parameters:
dayOffset- the dayOffset to set
-
copy
public DateWithOffset 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
-
-