Class EasterRule

java.lang.Object
com.ibm.icu.util.EasterRule
All Implemented Interfaces:
DateRule

class EasterRule extends Object implements DateRule
  • Field Details

    • daysAfterEaster

      private int daysAfterEaster
    • calendar

      private GregorianCalendar calendar
  • Constructor Details

    • EasterRule

      public EasterRule(int daysAfterEaster, boolean isOrthodox)
  • Method Details

    • firstAfter

      public Date firstAfter(Date start)
      Return the first occurrence of this rule on or after the given date
      Specified by:
      firstAfter in interface DateRule
      Parameters:
      start - Only occurrances on or after this date are returned.
      Returns:
      The date on which this event occurs, or null if it does not occur on or after the start date.
      See Also:
    • firstBetween

      public Date firstBetween(Date start, Date end)
      Return the first occurrence of this rule on or after the given start date and before the given end date.
      Specified by:
      firstBetween in interface DateRule
      Parameters:
      start - Only occurrances on or after this date are returned.
      end - Only occurrances before this date are returned.
      Returns:
      The date on which this event occurs, or null if it does not occur between the start and end dates.
      See Also:
    • isOn

      public boolean isOn(Date date)
      Return true if the given Date is on the same day as Easter
      Specified by:
      isOn in interface DateRule
      Parameters:
      date - The date to check.
      Returns:
      true if this event occurs on the given date.
    • isBetween

      public boolean isBetween(Date start, Date end)
      Return true if Easter occurs between the two dates given
      Specified by:
      isBetween in interface DateRule
    • doFirstBetween

      private Date doFirstBetween(Date start, Date end)
    • computeInYear

      private Date computeInYear(Date date, GregorianCalendar cal)
      Compute the month and date on which this holiday falls in the year containing the date "date". First figure out which date Easter lands on in this year, and then add the offset for this holiday to get the right date.

      The algorithm here is taken from the Calendar FAQ.