Class SevenDaysWeek

java.lang.Object
org.episteme.social.history.calendars.AlternateCalendar
org.episteme.social.history.calendars.SevenDaysWeek
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BahaiCalendar, MonthDayYear

public abstract class SevenDaysWeek extends AlternateCalendar
Abstract base class for calendar systems that use a seven-day week. Provides methods for weekday calculations and finding specific days of the week relative to a given date.

Day numbering follows ISO convention where Sunday = 0 through Saturday = 6.

Since:
1.0
Version:
2.0
Author:
Mark E. Shoulson (original implementation), Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Field Details

    • SUNDAY

      public static final int SUNDAY
      Sunday (day 0 of the week).
      See Also:
    • MONDAY

      public static final int MONDAY
      Monday (day 1 of the week).
      See Also:
    • TUESDAY

      public static final int TUESDAY
      Tuesday (day 2 of the week).
      See Also:
    • WEDNESDAY

      public static final int WEDNESDAY
      Wednesday (day 3 of the week).
      See Also:
    • THURSDAY

      public static final int THURSDAY
      Thursday (day 4 of the week).
      See Also:
    • FRIDAY

      public static final int FRIDAY
      Friday (day 5 of the week).
      See Also:
    • SATURDAY

      public static final int SATURDAY
      Saturday (day 6 of the week).
      See Also:
    • DAY_NAMES

      public static final String[] DAY_NAMES
      English names for days of the week.
  • Constructor Details

    • SevenDaysWeek

      public SevenDaysWeek()
      Default constructor.
  • Method Details

    • weekDay

      public int weekDay()
      Returns the day of the week for the current date.
      Returns:
      the weekday (0 = Sunday, 6 = Saturday)
    • weekDayName

      public String weekDayName()
      Returns the name of the current weekday.
      Returns:
      the weekday name (e.g., "Monday")
    • kDayOnOrBefore

      public void kDayOnOrBefore(int weekday)
      Adjusts this date to the specified weekday on or before the current date.
      Parameters:
      weekday - the target weekday (0-6)
    • kDayOnOrAfter

      public void kDayOnOrAfter(int weekday)
      Adjusts this date to the specified weekday on or after the current date.
      Parameters:
      weekday - the target weekday (0-6)
    • kDayNearest

      public void kDayNearest(int weekday)
      Adjusts this date to the specified weekday nearest to the current date.
      Parameters:
      weekday - the target weekday (0-6)
    • kDayAfter

      public void kDayAfter(int weekday)
      Adjusts this date to the first occurrence of the specified weekday after the current date.
      Parameters:
      weekday - the target weekday (0-6)
    • kDayBefore

      public void kDayBefore(int weekday)
      Adjusts this date to the last occurrence of the specified weekday before the current date.
      Parameters:
      weekday - the target weekday (0-6)
    • nthKDay

      public void nthKDay(int n, int weekday)
      Adjusts this date to the nth occurrence of the specified weekday relative to the current date. Positive n means forward, negative n means backward.
      Parameters:
      n - the occurrence count (positive = forward, negative = backward)
      weekday - the target weekday (0-6)