Class Recurring

java.lang.Object
com.aoapps.hodgepodge.schedule.Recurring
Direct Known Subclasses:
Recurring.DayOfWeekList, Recurring.Every, Recurring.EveryByDayOfWeek, Recurring.EveryByMonth, Recurring.MonthList

public abstract class Recurring extends Object
Author:
AO Industries, Inc.
  • Field Details

    • EVERYDAY

      public static final Recurring EVERYDAY
    • WEEKDAYS

      public static final Recurring WEEKDAYS
    • WEEKLY

      public static final Recurring WEEKLY
    • MONTHLY

      public static final Recurring MONTHLY
    • YEARLY

      public static final Recurring YEARLY
  • Constructor Details

    • Recurring

      public Recurring()
  • Method Details

    • parse

      public static Recurring parse(String recurring) throws IllegalArgumentException
      Parses a human-readable representation of a recurring schedule. All parsing case-insensitive. Supported values are:
      • "everyday" - Task must be done every day
      • "weekdays" - Monday through Friday (no holidays scheduled - yet)
      • "on day-of-week-list" - on a comma-separated list of days of the week. The day of the week for the "on" date must be in this list. Example: "on Mondays, Wednesdays, Fridays". Example: "on Monday, Wednesday, Friday". Example: "On mon, tue, Sat". Example: "on Mondays, Wednesday, Fri".
      • "weekly" - recurring on the same day every week.
      • "monthly" - recurring on the same day every month. If the day is past the last day of the month, the last day of the month is used.
      • "yearly" - recurring on the same day every year. If the day is past the last day of the month for a given year, the last day of the month is used. (Only affects February 29th)
      • "every (other|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|###) {days|weeks|months|years|day-of-week|month-of-year}" - recurring every unit days. For "months", if the day is past the last day of the month, the last day of the month is used. For "day-of-week", is named day such as "every other Friday" or "every 4 Mondays". For "month-of-year", is named month such as "every other March" or "every 3 Januaries".
      Parameters:
      recurring - when null, returns null
      Throws:
      IllegalArgumentException - if unable to parse recurring
    • equals

      public abstract boolean equals(Object o)
      Recurring schedules are equal when they have both the same type and schedule.
      Overrides:
      equals in class Object
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • getRecurringDisplay

      public abstract String getRecurringDisplay()
    • checkScheduleFrom

      public String checkScheduleFrom(Calendar from, String attribute)
      Checks if the schedule can start on the given day. Returns null if OK or a string reason of why not OK.
    • getScheduleIterator

      public abstract Iterator<Calendar> getScheduleIterator(Calendar from)
      Gets an iterator over dates in the YYYY-MM-DD format. The iteration starts at the given date.