Class ISOCalendar
java.lang.Object
org.episteme.social.history.calendars.AlternateCalendar
org.episteme.social.history.calendars.SevenDaysWeek
org.episteme.social.history.calendars.MonthDayYear
org.episteme.social.history.calendars.GregorianCalendar
org.episteme.social.history.calendars.ISOCalendar
- All Implemented Interfaces:
Serializable
Implementation of the ISO 8601 week-date calendar.
The ISO week-date system is an international standard for representing
dates using week numbers instead of months.
Key features:
- Year-week-day format (e.g., 2024-W01-1)
- Weeks start on Monday (day 1) and end on Sunday (day 7)
- Week 1 contains January 4th (or the first Thursday of January)
- Years have either 52 or 53 weeks
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Field Summary
Fields inherited from class GregorianCalendar
EPOCH, MONTHSFields inherited from class MonthDayYear
monthFields inherited from class SevenDaysWeek
DAY_NAMES, FRIDAY, MONDAY, SATURDAY, SUNDAY, THURSDAY, TUESDAY, WEDNESDAYFields inherited from class AlternateCalendar
JD_EPOCH, rd, unicode -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ISOCalendar object.ISOCalendar(int i, int j, int k) Creates a new ISOCalendar object.ISOCalendar(long l) Creates a new ISOCalendar object.ISOCalendar(AlternateCalendar altcalendar) Creates a new ISOCalendar object. -
Method Summary
Modifier and TypeMethodDescriptionintgetDay()Returns the ISO day number.intgetMonth()Returns 0 as ISO weeks are not defined within standard months.intgetWeek()Returns the ISO week number.intgetYear()Returns the ISO year.static voidMain method for testing the ISOCalendar implementation.protected voidRecomputes the ISO week components from the current Rata Die number.protected voidRecomputes the Rata Die number from current week components.voidset(int i, int j, int k) Sets the ISO week components and recomputes the date.toString()Returns a string representation of the ISO week-date.Methods inherited from class GregorianCalendar
dayNumber, daysLeft, getMonths, getSuffix, isLeapYear, monthName, setMethods inherited from class SevenDaysWeek
kDayAfter, kDayBefore, kDayNearest, kDayOnOrAfter, kDayOnOrBefore, nthKDay, weekDay, weekDayNameMethods inherited from class AlternateCalendar
add, amod, difference, difference, floorDiv, fromJD, isAfter, isBefore, mod, mod, subtract, toJD, toJD, toRD
-
Constructor Details
-
ISOCalendar
public ISOCalendar(long l) Creates a new ISOCalendar object.- Parameters:
l- the Rata Die number.
-
ISOCalendar
public ISOCalendar(int i, int j, int k) Creates a new ISOCalendar object.- Parameters:
i- the week number.j- the day of week.k- the year.
-
ISOCalendar
public ISOCalendar()Creates a new ISOCalendar object. -
ISOCalendar
Creates a new ISOCalendar object.- Parameters:
altcalendar- another calendar to initialize from.
-
-
Method Details
-
set
public void set(int i, int j, int k) Sets the ISO week components and recomputes the date.- Overrides:
setin classMonthDayYear- Parameters:
i- the week.j- the day.k- the year.
-
getYear
public int getYear()Returns the ISO year.- Overrides:
getYearin classMonthDayYear- Returns:
- the year.
-
recomputeRD
protected void recomputeRD()Recomputes the Rata Die number from current week components.- Overrides:
recomputeRDin classGregorianCalendar
-
recomputeFromRD
protected void recomputeFromRD()Recomputes the ISO week components from the current Rata Die number.- Overrides:
recomputeFromRDin classGregorianCalendar
-
getWeek
public int getWeek()Returns the ISO week number.- Returns:
- the week number (1-53).
-
getDay
public int getDay()Returns the ISO day number.- Overrides:
getDayin classMonthDayYear- Returns:
- the day number (1-7).
-
toString
Returns a string representation of the ISO week-date.- Overrides:
toStringin classGregorianCalendar- Returns:
- the date string.
-
getMonth
public int getMonth()Returns 0 as ISO weeks are not defined within standard months.- Overrides:
getMonthin classMonthDayYear- Returns:
- 0.
-
main
Main method for testing the ISOCalendar implementation.- Parameters:
args- command line arguments.
-