ealet
Class Calendar

java.lang.Object
  extended by ealet.Calendar

public class Calendar
extends java.lang.Object

Ethiopian calendar generator including monthly, annual, and moving holidays. It is limited to CE (Common Era); that is, from 00. The calendar calculation, religious and national holidays system is based on Dr. Getatchew Haile's book "Bahra Hassab" published in 2000.

This class can be used for these specific tasks.

Each calendar is generated and organized in a set of linked-list data structure. The following crude figure shows how that structure looks like.
             ---------   ---------   ---------
    Year     |  Sep  |---|  Oct  |---|  Nov  |--- ...
             ---------   ---------   ---------
                 +           +           +
                 |           |           |
                 |           |           |
             ---------   ---------   ---------   -------------
    Day     |  Mon   |   |  Tue  |   |  Thu  |---|  holiday  |....
             ---------   ---------   ---------   -------------
                 .           .           .
                 .           .           .
                 .           .           .
 
Some important terms:


Constructor Summary
Calendar(int year)
          Constructor: A linked-list for months is constructed.
 
Method Summary
static java.lang.String getDay(int month, int date, int ce)
          Returns the day of the given date.
static int getEthiopianDayIndex(int month, int date, int year)
          Determines what the day is for a given Ethiopian date.
 java.util.LinkedList[] getEthiopianGregorianCalendar()
          This method generates the calendar for the requested year.
 java.lang.String getGregorianDay(int ce, int month, int date)
          Returns the day of a given Gregorian date
 int getMetqee(int ce)
          Returns the metqee for the given year
 java.lang.String getNewYearDay(int ce)
          Returns the Ethiopian new year day which will be used as starting day for the given year
 void insertAnnualHoliday()
          The method prepares annual holidays with integer array.
 void insertMonthlyHoliday()
          It prepares monthly holidays with integer array.
 void insertMovingHolidays()
          Fasting holidays are variables since they are calcualted based on moon's epect.
static Day toEthiopian(int month, int date, int year)
          The method performs conversion from Gregorian date to Ethiopian.
static Day toGregorian(int month, int date, int year)
          The method performs conversion from Ethiopian date to Gregorian.
static int whenIsEthNewYearInGregSeptember(int year)
          Ethiopian new year occurs either on Gregorian September 11/12.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Calendar

public Calendar(int year)
Constructor: A linked-list for months is constructed. *

Parameters:
year - the year to which a calendar will be built
Method Detail

getMetqee

public int getMetqee(int ce)
Returns the metqee for the given year

Parameters:
ce - a year for which metqee is generated
Returns:
metiqee is equal to 30 - abekitee
Since:
2.0

getNewYearDay

public java.lang.String getNewYearDay(int ce)
Returns the Ethiopian new year day which will be used as starting day for the given year

Parameters:
ce - A year for which metqee is generated
Returns:
The name of the first day in String form
Since:
2.0

getDay

public static java.lang.String getDay(int month,
                                      int date,
                                      int ce)
Returns the day of the given date. It starts counting from Tuesday of BCE era 1st day to arrive to the right one.

Parameters:
month - Ethiopian month
date - Ethiopian date
ce - Ethiopian Common Era year
Returns:
The day of the given date in String form
Since:
2.0

insertMonthlyHoliday

public void insertMonthlyHoliday()
It prepares monthly holidays with integer array. It fetches each Day instance and adds the monthly holidays to its list. These holidays will be mapped to proper names by the XMLer class during transformation. For that purpose, the XMLer class utilizes a properties file.

The properties file is "ealet_holiday_properties.xml" and has the following form.

The key and values ares

     1         abo
     ^          ^
    key       value
     ^          ^
     |          |
     |           ----- the name of the holiday
     | 
      ----- the date of the month to the holiday belongs
 

Since:
2.0

insertAnnualHoliday

public void insertAnnualHoliday()
The method prepares annual holidays with integer array. It fetches each Day instance from the calendar and inserts these holidays. The month and date where each annual holiday occurs is used in combination as a key in the holiday properties file and used by the XMLer class during transformation to retrieve the holiday names.

The properties file is "ealet_holiday_properties.xml" and has the following field and value content.

The key and values ares

    1-1     Enkutatash
     ^          ^
    key       value
     ^          ^
     |          |
     |           ----- the name of the holiday
     | 
      ----- the 1st is month while the 2nd is date
 

Since:
2.0

insertMovingHolidays

public void insertMovingHolidays()
Fasting holidays are variables since they are calcualted based on moon's epect. The 1st fasting holiday is Nenewei and it is calculated using metiqee and tewissak. The remaining fasting holidays can be determined based on Nenewei since their ranges are known.

As each fasting holiday is calculated, an instance of the Day class is created and inserted into the calendar under each proper month and date. This method must be called after the main calendar is built; that is. after the calendarYear linked list is completely built. Failing to do so will result fatal error.

Since:
2.0

getGregorianDay

public java.lang.String getGregorianDay(int ce,
                                        int month,
                                        int date)
Returns the day of a given Gregorian date

Parameters:
month - Gregorian calendar month
date - Gregorian calendar date
ce - Gregorian calendar year
Returns:
The name of the day on the given Gregorian date
Since:
2.0

whenIsEthNewYearInGregSeptember

public static int whenIsEthNewYearInGregSeptember(int year)
Ethiopian new year occurs either on Gregorian September 11/12. If the year preceeding the new year is a leap year, Paguemain will have 6 days; therefore, Ethiopian new year occurs on Gregorian September 12. This method determines when new year occurs on Gregorian September.

Parameters:
year - Ethiopian year
Returns:
The date of September when Ethiopian new year occurs
Since:
2.0

toGregorian

public static Day toGregorian(int month,
                              int date,
                              int year)
The method performs conversion from Ethiopian date to Gregorian. Breifely,

Parameters:
month - Ethiopian calendar month
date - Ethiopian calendar date
year - Ethiopian calendar year
Returns:
Ethiopian day

toEthiopian

public static Day toEthiopian(int month,
                              int date,
                              int year)
The method performs conversion from Gregorian date to Ethiopian. Breifely,

Parameters:
month - Gregorian calendar month
date - Gregorian calendar date
year - Gregorian calendar year
Returns:
Gregorian day

getEthiopianDayIndex

public static int getEthiopianDayIndex(int month,
                                       int date,
                                       int year)
Determines what the day is for a given Ethiopian date. It starts counting from 5500, the number of years in BCE, continuing the BC years. The 1st day starts with "Tuesday".

Parameters:
month - Ethiopian month
date - Ethiopian date
year - Ethiopian year
Returns:
Ethiopian day

getEthiopianGregorianCalendar

public java.util.LinkedList[] getEthiopianGregorianCalendar()
This method generates the calendar for the requested year. It involves a serious of steps. Finally, it returns an array of a linked list consisting of the calendar.

Since:
2.0