java.lang.Object
org.holiday.calendar.FloatingHoliday
- All Implemented Interfaces:
Holiday
A holiday which occurs on a different date every year. Examples of floating
holidays are Diwali and
Easter. Calculation of
the observed date of a floating holiday can vary widely in complexity.
- Author:
- Dave Joyce
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.holiday.calendar.Holiday
Holiday.HolidayBuilder, Holiday.Type -
Constructor Summary
ConstructorsConstructorDescriptionFloatingHoliday(String name, String description, Observance observance) Construct a new instance that isrollableby default.FloatingHoliday(String name, String description, Observance observance, boolean rollable) Construct a new instance with explicit rollable control. -
Method Summary
Modifier and TypeMethodDescriptiondateForYear(int year) Calculate the date of this holiday for the specified year.booleanGet the description (if any) of this holiday.getName()Get the name of this holiday.inthashCode()booleanDetermine if this holiday supports date rolling for actual observance on a holiday calendar.toString()
-
Constructor Details
-
FloatingHoliday
Construct a new instance with explicit rollable control. -
FloatingHoliday
Construct a new instance that isrollableby default.
-
-
Method Details
-
getName
Description copied from interface:HolidayGet the name of this holiday. -
getDescription
Description copied from interface:HolidayGet the description (if any) of this holiday.- Specified by:
getDescriptionin interfaceHoliday- Returns:
- holiday description
-
isRollable
public boolean isRollable()Description copied from interface:HolidayDetermine if this holiday supports date rolling for actual observance on a holiday calendar.- Specified by:
isRollablein interfaceHoliday- Returns:
trueif the date of occurrence for this holiday may be rolled for observance,falseotherwise
-
getObservance
-
dateForYear
Description copied from interface:HolidayCalculate the date of this holiday for the specified year. The date returned by this method may be adjusted to a different date of observance by the associatedholiday calendar.- Specified by:
dateForYearin interfaceHoliday- Parameters:
year- full calendar year (e.g. 1977, 2021)- Returns:
- date of this holiday, or
emptyif not observed on the specified year
-
equals
-
hashCode
public int hashCode() -
toString
-