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
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]English names for days of the week.static final intFriday (day 5 of the week).static final intMonday (day 1 of the week).static final intSaturday (day 6 of the week).static final intSunday (day 0 of the week).static final intThursday (day 4 of the week).static final intTuesday (day 2 of the week).static final intWednesday (day 3 of the week).Fields inherited from class AlternateCalendar
EPOCH, JD_EPOCH, rd, unicode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidkDayAfter(int weekday) Adjusts this date to the first occurrence of the specified weekday after the current date.voidkDayBefore(int weekday) Adjusts this date to the last occurrence of the specified weekday before the current date.voidkDayNearest(int weekday) Adjusts this date to the specified weekday nearest to the current date.voidkDayOnOrAfter(int weekday) Adjusts this date to the specified weekday on or after the current date.voidkDayOnOrBefore(int weekday) Adjusts this date to the specified weekday on or before the current date.voidnthKDay(int n, int weekday) Adjusts this date to the nth occurrence of the specified weekday relative to the current date.intweekDay()Returns the day of the week for the current date.Returns the name of the current weekday.Methods inherited from class AlternateCalendar
add, amod, difference, difference, floorDiv, fromJD, isAfter, isBefore, mod, mod, recomputeFromRD, recomputeRD, set, subtract, toJD, toJD, toRD, toString
-
Field Details
-
SUNDAY
public static final int SUNDAYSunday (day 0 of the week).- See Also:
-
MONDAY
public static final int MONDAYMonday (day 1 of the week).- See Also:
-
TUESDAY
public static final int TUESDAYTuesday (day 2 of the week).- See Also:
-
WEDNESDAY
public static final int WEDNESDAYWednesday (day 3 of the week).- See Also:
-
THURSDAY
public static final int THURSDAYThursday (day 4 of the week).- See Also:
-
FRIDAY
public static final int FRIDAYFriday (day 5 of the week).- See Also:
-
SATURDAY
public static final int SATURDAYSaturday (day 6 of the week).- See Also:
-
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
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)
-