Package ch.poole.openinghoursparser
Class Rule
- java.lang.Object
-
- ch.poole.openinghoursparser.Rule
-
- All Implemented Interfaces:
Copy<ch.poole.openinghoursparser.Element>
public class Rule extends java.lang.ObjectContainer for objects from the opening_hours specification
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Rulecopy()Create a copy of the objeczbooleanequals(java.lang.Object other)java.lang.StringgetComment()@Nullable java.util.List<DateRange>getDates()Get a List of DateRange objects@Nullable java.util.List<WeekDayRange>getDays()Get a List of WeekDayRange objects@Nullable java.util.List<Holiday>getHolidays()Get a List of Holiday objects@Nullable RuleModifiergetModifier()Get the RuleModifier@Nullable java.util.List<TimeSpan>getTimes()Get a List of TimeSpan objects@Nullable java.util.List<WeekRange>getWeeks()Get a List of WeekRange objects@Nullable java.util.List<YearRange>getYears()Get a List of YearRange objectsinthashCode()booleanisAdditive()booleanisEmpty()Check if this rule actually contains somethingbooleanisFallBack()booleanisMergeableWith(Rule r)Returns true if the input only differs in the days and times objects Current considers comments significantbooleanisTwentyfourseven()voidsetAdditive(boolean additive)Set the additive flag for this rulevoidsetComment(@Nullable java.lang.String comment)Set the comment for this rulevoidsetDates(@Nullable java.util.List<DateRange> dates)Set the list of DateRange objectsvoidsetDays(@Nullable java.util.List<WeekDayRange> days)Set the list of WeekDayRange objectsvoidsetFallBack(boolean fallBack)Set the fallback flag for this rulevoidsetHolidays(@Nullable java.util.List<Holiday> holidays)Set the List of Holiday objectsvoidsetModifier(RuleModifier modifier)voidsetMonthdays(@Nullable java.util.List<DateRange> monthdays)Deprecated.Use setDates insteadvoidsetTimes(@Nullable java.util.List<TimeSpan> times)Set the list of TimeSpan objectsvoidsetTwentyfourseven(boolean twentyfourseven)voidsetWeeks(@Nullable java.util.List<WeekRange> weeks)Set the List of WeekRange objectsvoidsetYears(@Nullable java.util.List<YearRange> years)Set the List of YearRange objectsjava.lang.StringtoDebugString()Create a string that identifies which class created it for debugging and testingjava.lang.StringtoString()
-
-
-
Constructor Detail
-
Rule
public Rule()
Default constructor
-
Rule
public Rule(@NotNull @NotNull Rule r)Copy constructor- Parameters:
r- the rule to copy
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.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
-
equals
public boolean equals(java.lang.Object other)
-
hashCode
public int hashCode()
-
isMergeableWith
public boolean isMergeableWith(Rule r)
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
public java.lang.String getComment()
- Returns:
- the comment
-
isTwentyfourseven
public boolean isTwentyfourseven()
- Returns:
- the twentyfourseven
-
setTwentyfourseven
public void setTwentyfourseven(boolean twentyfourseven)
- Parameters:
twentyfourseven- the twentyfourseven to set
-
getYears
@Nullable public @Nullable java.util.List<YearRange> getYears()
Get a List of YearRange objects- Returns:
- a List of YearRange objects or null if none exist
-
getWeeks
@Nullable public @Nullable java.util.List<WeekRange> getWeeks()
Get a List of WeekRange objects- Returns:
- a List of WeekRange objects or null if none exist
-
getDates
@Nullable public @Nullable java.util.List<DateRange> getDates()
Get a List of DateRange objects- Returns:
- a List of DateRange objects or null if none exist
-
getHolidays
@Nullable public @Nullable java.util.List<Holiday> getHolidays()
Get a List of Holiday objects- Returns:
- a List of Holiday objects or null if none exists
-
getDays
@Nullable public @Nullable java.util.List<WeekDayRange> getDays()
Get a List of WeekDayRange objects- Returns:
- a List of WeekDayRange objects or null if none exists
-
getTimes
@Nullable public @Nullable java.util.List<TimeSpan> getTimes()
Get a List of TimeSpan objects- Returns:
- a List of TimeSpan objects or null if none exists
-
getModifier
@Nullable public @Nullable RuleModifier 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
public void setComment(@Nullable @Nullable java.lang.String comment)Set the comment for this rule- Parameters:
comment- the comment to set
-
setYears
public void setYears(@Nullable @Nullable java.util.List<YearRange> years)Set the List of YearRange objects- Parameters:
years- the List of YearRange objects or null
-
setWeeks
public void setWeeks(@Nullable @Nullable java.util.List<WeekRange> weeks)Set the List of WeekRange objects- Parameters:
weeks- the List of WeekRange objects or null
-
setMonthdays
@Deprecated public void setMonthdays(@Nullable @Nullable java.util.List<DateRange> monthdays)Deprecated.Use setDates insteadSet the list of DateRange objects- Parameters:
monthdays- a List of DateRange objects or null
-
setDates
public void setDates(@Nullable @Nullable java.util.List<DateRange> dates)Set the list of DateRange objects- Parameters:
dates- a List of DateRange objects or null
-
setHolidays
public void setHolidays(@Nullable @Nullable java.util.List<Holiday> holidays)Set the List of Holiday objects- Parameters:
holidays- the List of Holiday objects or null
-
setDays
public void setDays(@Nullable @Nullable java.util.List<WeekDayRange> days)Set the list of WeekDayRange objects- Parameters:
days- a List of WeekDayRange objects or null
-
setTimes
public void setTimes(@Nullable @Nullable java.util.List<TimeSpan> times)Set the list of TimeSpan objects- Parameters:
times- a List of TimeSpan objects or null
-
setModifier
public void setModifier(RuleModifier modifier)
- Parameters:
modifier- the modifier to set
-
isEmpty
public boolean isEmpty()
Check if this rule actually contains something- Returns:
- true if empty
-
-