Class MonthDayYear
java.lang.Object
org.episteme.social.history.calendars.AlternateCalendar
org.episteme.social.history.calendars.SevenDaysWeek
org.episteme.social.history.calendars.MonthDayYear
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ChineseCalendar, GregorianCalendar, HebrewCalendar, IslamicCalendar, ModifiedFrenchCalendar, OldHinduSolarCalendar, PersianCalendar
Abstract base class for calendar systems that use a month-day-year date representation.
Extends
SevenDaysWeek to include weekday calculations.
Subclasses must implement:
monthName()- Returns the name of the current monthgetSuffix()- Returns an era suffix (e.g., "CE", "BCE")getMonths()- Returns an enumeration of all month namesAlternateCalendar.recomputeRD()- Computes Rata Die from date fieldsAlternateCalendar.recomputeFromRD()- Computes date fields from Rata Die
- 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 TypeFieldDescriptionprotected intThe day of the month (1-31 for most calendars).protected intThe month (1-12 for most calendars).protected intThe year (negative values typically represent BCE years).Fields inherited from class SevenDaysWeek
DAY_NAMES, FRIDAY, MONDAY, SATURDAY, SUNDAY, THURSDAY, TUESDAY, WEDNESDAYFields inherited from class AlternateCalendar
EPOCH, JD_EPOCH, rd, unicode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetDay()Returns the day of the month.intgetMonth()Returns the month.abstract Enumeration<String> Returns an enumeration of all month names for this calendar.protected abstract StringReturns the era suffix for display (e.g., "CE", "BCE", "AH").intgetYear()Returns the year.protected abstract StringReturns the name of the current month.voidset(int year, int month, int day) Sets the calendar to the specified date and recomputes the Rata Die.toString()Returns a string representation of this date.Methods 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, recomputeFromRD, recomputeRD, set, subtract, toJD, toJD, toRD
-
Field Details
-
month
protected int monthThe month (1-12 for most calendars). -
day
protected int dayThe day of the month (1-31 for most calendars). -
year
protected int yearThe year (negative values typically represent BCE years).
-
-
Constructor Details
-
MonthDayYear
public MonthDayYear()Default constructor.
-
-
Method Details
-
getDay
public int getDay()Returns the day of the month.- Returns:
- the day (typically 1-31)
-
getMonth
public int getMonth()Returns the month.- Returns:
- the month (typically 1-12)
-
getYear
public int getYear()Returns the year.- Returns:
- the year (negative for BCE)
-
set
public void set(int year, int month, int day) Sets the calendar to the specified date and recomputes the Rata Die.- Parameters:
year- the yearmonth- the monthday- the day of month
-
toString
Returns a string representation of this date.- Specified by:
toStringin classAlternateCalendar- Returns:
- formatted date string
-
monthName
Returns the name of the current month.- Returns:
- the month name
-
getSuffix
Returns the era suffix for display (e.g., "CE", "BCE", "AH").- Returns:
- the suffix string
-
getMonths
Returns an enumeration of all month names for this calendar.- Returns:
- month names enumeration
-