Package ch.poole.openinghoursparser
Class Rule
java.lang.Object
ch.poole.openinghoursparser.Rule
- All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>
Container for objects from the opening_hours specification
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Create a copy of the objeczbooleangetDates()Get a List of DateRange objects@Nullable List<WeekDayRange>getDays()Get a List of WeekDayRange objectsGet a List of Holiday objects@Nullable RuleModifierGet the RuleModifiergetTimes()Get a List of TimeSpan objectsgetWeeks()Get a List of WeekRange objectsgetYears()Get a List of YearRange objectsinthashCode()booleanbooleanisEmpty()Check if this rule actually contains somethingbooleanbooleanReturns true if the input only differs in the days and times objects Current considers comments significantbooleanvoidsetAdditive(boolean additive) Set the additive flag for this rulevoidsetComment(@Nullable String comment) Set the comment for this rulevoidSet the list of DateRange objectsvoidsetDays(@Nullable List<WeekDayRange> days) Set the list of WeekDayRange objectsvoidsetFallBack(boolean fallBack) Set the fallback flag for this rulevoidsetHolidays(@Nullable List<Holiday> holidays) Set the List of Holiday objectsvoidsetModifier(RuleModifier modifier) voidsetMonthdays(@Nullable List<DateRange> monthdays) Deprecated.Use setDates insteadvoidSet the list of TimeSpan objectsvoidsetTwentyfourseven(boolean twentyfourseven) voidSet the List of WeekRange objectsvoidSet the List of YearRange objectsCreate a string that identifies which class created it for debugging and testingtoString()
-
Constructor Details
-
Rule
public Rule()Default constructor -
Rule
Copy constructor- Parameters:
r- the rule to copy
-
-
Method Details
-
toString
-
toDebugString
Create a string that identifies which class created it for debugging and testing- Returns:
- the output of toString with the class name prepended
-
equals
-
hashCode
public int hashCode() -
isMergeableWith
Returns true if the input only differs in the days and times objects Current considers comments significant- Parameters:
r- rule to test against- Returns:
- true if r can be merged with this rule
-
isFallBack
public boolean isFallBack()- Returns:
- the fallBack
-
isAdditive
public boolean isAdditive()- Returns:
- true if this rule does not overwrite rules for days with previous rules
-
getComment
- Returns:
- the comment
-
isTwentyfourseven
public boolean isTwentyfourseven()- Returns:
- the twentyfourseven
-
setTwentyfourseven
public void setTwentyfourseven(boolean twentyfourseven) - Parameters:
twentyfourseven- the twentyfourseven to set
-
getYears
Get a List of YearRange objects- Returns:
- a List of YearRange objects or null if none exist
-
getWeeks
Get a List of WeekRange objects- Returns:
- a List of WeekRange objects or null if none exist
-
getDates
Get a List of DateRange objects- Returns:
- a List of DateRange objects or null if none exist
-
getHolidays
Get a List of Holiday objects- Returns:
- a List of Holiday objects or null if none exists
-
getDays
Get a List of WeekDayRange objects- Returns:
- a List of WeekDayRange objects or null if none exists
-
getTimes
Get a List of TimeSpan objects- Returns:
- a List of TimeSpan objects or null if none exists
-
getModifier
Get the RuleModifier- Returns:
- the modifier or null if none set
-
setFallBack
public void setFallBack(boolean fallBack) Set the fallback flag for this rule- Parameters:
fallBack- if true this is a fallback rule
-
setAdditive
public void setAdditive(boolean additive) Set the additive flag for this rule- Parameters:
additive- if true this is an additive rule
-
setComment
Set the comment for this rule- Parameters:
comment- the comment to set
-
setYears
Set the List of YearRange objects- Parameters:
years- the List of YearRange objects or null
-
setWeeks
Set the List of WeekRange objects- Parameters:
weeks- the List of WeekRange objects or null
-
setMonthdays
Deprecated.Use setDates insteadSet the list of DateRange objects- Parameters:
monthdays- a List of DateRange objects or null
-
setDates
Set the list of DateRange objects- Parameters:
dates- a List of DateRange objects or null
-
setHolidays
Set the List of Holiday objects- Parameters:
holidays- the List of Holiday objects or null
-
setDays
Set the list of WeekDayRange objects- Parameters:
days- a List of WeekDayRange objects or null
-
setTimes
Set the list of TimeSpan objects- Parameters:
times- a List of TimeSpan objects or null
-
setModifier
- Parameters:
modifier- the modifier to set
-
isEmpty
public boolean isEmpty()Check if this rule actually contains something- Returns:
- true if empty
-
copy
Description copied from interface:CopyCreate a copy of the objecz- Returns:
- a copy of the object
-