java.lang.Object
org.holiday.calendar.observance.ca.BoxingDayCAD
All Implemented Interfaces:
Function<Integer,LocalDate>, Predicate<Integer>, Observance

public class BoxingDayCAD extends Object implements Observance
Observance of Boxing Day for the Bank of Canada (Lynx) settlement calendar.

Boxing Day (26 December) must be computed in tandem with Christmas Day (25 December) because the two holidays can collide when Christmas falls on a weekend. The framework's DateRoll mechanism operates independently per holiday and cannot detect when Christmas Day has already consumed 26 December as its observed Monday substitute. This observance therefore encapsulates the full substitution logic for the Christmas/Boxing Day pair:

  • Dec 25 = Saturday → Christmas observed Mon 27; Boxing Day (Dec 26 = Sunday) observed Tue 28.
  • Dec 25 = Sunday → Christmas observed Mon 26; Boxing Day displaced to Tue 27.
  • Dec 26 = Saturday (Christmas is Friday) → Christmas not rolled; Boxing Day observed Mon 28.
  • Dec 26 = Sunday (Christmas is Saturday — covered by first case above; or Christmas is a different weekday) → Boxing Day observed Mon 27.
  • All other cases → Boxing Day observed on its natural date, 26 December.
Author:
Dave Joyce
  • Constructor Details

    • BoxingDayCAD

      public BoxingDayCAD()
  • Method Details

    • apply

      public LocalDate apply(Integer year)
      Specified by:
      apply in interface Function<Integer,LocalDate>
    • test

      public boolean test(Integer year)
      Description copied from interface: Observance
      Determines whether this observance applies to the specified year.
      Specified by:
      test in interface Observance
      Specified by:
      test in interface Predicate<Integer>
      Parameters:
      year - year of potential observance
      Returns:
      true if the input year applies for this observance, otherwise false