572 //-----------------------------------------------------------------------
573 /**
574 * Returns an array containing the Hijrah year, month and day
575 * computed from the epoch day.
576 *
577 * @param epochDay the EpochDay
578 * @return int[0] = YEAR, int[1] = MONTH, int[2] = DATE
579 */
580 int[] getHijrahDateInfo(int epochDay) {
581 checkCalendarInit(); // ensure that the chronology is initialized
582 if (epochDay < minEpochDay || epochDay >= maxEpochDay) {
583 throw new DateTimeException("Hijrah date out of range");
584 }
585
586 int epochMonth = epochDayToEpochMonth(epochDay);
587 int year = epochMonthToYear(epochMonth);
588 int month = epochMonthToMonth(epochMonth);
589 int day1 = epochMonthToEpochDay(epochMonth);
590 int date = epochDay - day1; // epochDay - dayOfEpoch(year, month);
591
592 int dateInfo[] = new int[3];
593 dateInfo[0] = year;
594 dateInfo[1] = month + 1; // change to 1-based.
595 dateInfo[2] = date + 1; // change to 1-based.
596 return dateInfo;
597 }
598
599 /**
600 * Return the epoch day computed from Hijrah year, month, and day.
601 *
602 * @param prolepticYear the year to represent, 0-origin
603 * @param monthOfYear the month-of-year to represent, 1-origin
604 * @param dayOfMonth the day-of-month to represent, 1-origin
605 * @return the epoch day
606 */
607 long getEpochDay(int prolepticYear, int monthOfYear, int dayOfMonth) {
608 checkCalendarInit(); // ensure that the chronology is initialized
609 checkValidMonth(monthOfYear);
610 int epochMonth = yearToEpochMonth(prolepticYear) + (monthOfYear - 1);
611 if (epochMonth < 0 || epochMonth >= hijrahEpochMonthStartDays.length) {
612 throw new DateTimeException("Invalid Hijrah date, year: " +
|
572 //-----------------------------------------------------------------------
573 /**
574 * Returns an array containing the Hijrah year, month and day
575 * computed from the epoch day.
576 *
577 * @param epochDay the EpochDay
578 * @return int[0] = YEAR, int[1] = MONTH, int[2] = DATE
579 */
580 int[] getHijrahDateInfo(int epochDay) {
581 checkCalendarInit(); // ensure that the chronology is initialized
582 if (epochDay < minEpochDay || epochDay >= maxEpochDay) {
583 throw new DateTimeException("Hijrah date out of range");
584 }
585
586 int epochMonth = epochDayToEpochMonth(epochDay);
587 int year = epochMonthToYear(epochMonth);
588 int month = epochMonthToMonth(epochMonth);
589 int day1 = epochMonthToEpochDay(epochMonth);
590 int date = epochDay - day1; // epochDay - dayOfEpoch(year, month);
591
592 int[] dateInfo = new int[3];
593 dateInfo[0] = year;
594 dateInfo[1] = month + 1; // change to 1-based.
595 dateInfo[2] = date + 1; // change to 1-based.
596 return dateInfo;
597 }
598
599 /**
600 * Return the epoch day computed from Hijrah year, month, and day.
601 *
602 * @param prolepticYear the year to represent, 0-origin
603 * @param monthOfYear the month-of-year to represent, 1-origin
604 * @param dayOfMonth the day-of-month to represent, 1-origin
605 * @return the epoch day
606 */
607 long getEpochDay(int prolepticYear, int monthOfYear, int dayOfMonth) {
608 checkCalendarInit(); // ensure that the chronology is initialized
609 checkValidMonth(monthOfYear);
610 int epochMonth = yearToEpochMonth(prolepticYear) + (monthOfYear - 1);
611 if (epochMonth < 0 || epochMonth >= hijrahEpochMonthStartDays.length) {
612 throw new DateTimeException("Invalid Hijrah date, year: " +
|