여기서 영구 달력 생산은 주로 캘린더 클래스와 GregorianCalendar 클래스를 사용합니다. 먼저 기본 사항을 검토합시다.
기본 부분
1. 캘린더 클래스.
1. 주요 필드 :
연도 (연도), 월 (월 1 일), 날짜 (1 월), 시간 (아침 또는 오후의 시간을 나타냄), Hour_f_day (하루의 시간을 나타냅니다), day_of_week (주 1 주 수를 나타냄), day_of_month (연도의 주 수를 나타냄) 월 주 수), Week_of_year (연도의 주 수를 나타냅니다)
2. 캘린더 클래스 객체를 얻습니다.
// 캘린더 클래스의 정적 메소드 GetInstance를 통과합니다. Calendar Ca = Calendar.getInstance ();
3 주요 방법
void set (int field, int value) // 연도 날짜 등과 같은 필드 캘린더 클래스의 매개 변수 .... void set (int 연도, int month, int date) // 연도, 월 및 일을 설정합니다. void set (int 연도, int 달, int 날짜, int 시간, int minute) // 연도, 월, 일, 시간, 시간 및 분) // 연도, 월, 일, 시간, 분, 두 번째 void settime (날짜) 설정; // 주어진 날짜 로이 캘린더의 시간을 설정합니다. int get (int field) // 주어진 캘린더 필드의 값을 반환합니다. 예 : int month = acobj.get (calendar.month); date gettime () // 캘린더 시간 값을 나타내는 날짜 개체를 반환합니다. Long GetTimeInmillis () // 1970.1.1 00:00:00에서 캘린더까지 밀리 초 수를 반환합니다. void add (int field, amont); // 달력 규칙에 따라 주어진 달력 필드에 지정된 시간을 추가하거나 빼십시오. 추가하거나 빼낼 수 있습니다. 예를 들어 : caobj.add (calendar.month, 1) 다음 달.
2. GregorianCalendar 클래스.
1.이 클래스 객체를 얻으십시오
Calendar CA = New GregorianCalendar () // 기본 현재 모멘트. Calendar CA = New GregorianCanlendar (int 연도, int Month, Int Dayofmonth) // 처음에는 지정된 연도, 월 및 일을 가진 Gregorian 클래스 객체입니다. Calendar Ca = New Gregoriancanlendar (int 연도, int 달, int dayofmonth, int himpday, int minute) Gregorian 클래스 객체는 처음에 지정된 연도, 월 및 일을 가지고 있습니다. Calendar CA = New GregorianCanlendar (int 연도, int의 달, int dayofmonth, int hourofday, int minute, int second) // 처음에는 지정된 연도, 월 및 일을 가진 Gregorian 클래스 객체입니다. 위는 모두 기본 로케일과 기본 시간대 객체를 얻어 얻습니다.
2. 사용법 사용은 주로 모기 클래스 캘린더를 상속합니다.
예제 섹션
3. 영구 달력 코드
package com.via.mce.monthcalendar.utils; import java.util.calendar; import java.util.date; import java.util.gregoriancalendar; import java.util.hashmap;/*** lunar 캘린더. <br> * 음력 달력의 1901 년에서 2100 년 사이의 연도, 월 및 이전 태양열의 크기를 저장 한 다음이 데이터를 기반으로 계산합니다. <br> * <br> * 음력에 대한 몇 가지 상수 속성 필드가 추가되었으며 get () 메소드를 사용하여 캘린더의 해당 값을 얻을 수 있습니다. <br> * Lunar Calendar 연도, 월 및 주간은 set ()/add ()/roll () 메소드를 사용하여 설정할 수도 있고 다른 음력 속성은 자동으로 계산됩니다. <br> * 또한, Getchinese (Int Field) 방법은 음력 달력의 중국어 텍스트를 얻기 위해 제공됩니다 (음력 달력 속성 및 주에만 적용 가능). <br> * <ul> * <li> Chinese_year -Lunar Year </li> * <li> 중국어 월 - Lunar Month </li> * <li> Chinese_date -Lunar Day </li> * <li> Chinese_sectional_term- 월의 태양열 </li> * <li> Chinese_section_ter- 음력의 하늘의 줄기 </li> * <li> 중국어 _arthly_branch- 음력의 지구 지점 </li> * <li> 중국어 </li> * <li> 중국어 _term_or_date- 날에 태양 용어가 있다면, 그것은 솔라 용어를 나타냅니다. 그렇지 않으면, 날이 하루의 첫날이라면, 달의 달을 나타냅니다. 그렇지 않으면 음력을 나타냅니다. * </ul> * 참고 : <br> * 달력 클래스의 설정으로 인해 Gregorian Month는 0에서 시작됩니다. 모든 방법은이 협약을 따릅니다. <br> * 그러나 모든 음력 속성은 1부터 시작합니다. 달력에 의해 제공된 방법에서도 달의 달은 1로 시작하여 음모의 달을 나타냅니다. <br> * CLEAR () 메소드는 음력 달력과 그레고리 캘린더 날짜가 일치하지 않거나 예상 재설정 효과를 달성 할 수 없습니다. 가능한 한 피해야합니다. <br> * Gregorian 캘린더 날짜 문자열을 얻기 위해 GetSimpleDatestring ()을 사용할 때 Gregorian Calendar의 달이 수정되었습니다. <br> * getSimpleChinesEdatestring ()을 사용하여 음력 달력 날짜 문자열을 얻을 때 음력 도약의 달은 *로 표시됩니다. <br> * * @version 0.12 2011-9-5 <br> * <blockquote> 음력 달력의 첫 달을 사용하여 달력을 초기화 할 때 달력이 죽은주기에 갇힌 문제를 해결했습니다. </blockquote> * @version 0.11 2009-12-27 <br> * <blockquote> 중국 달력을 얻을 때 음력 달력이 계산되지 않은 문제를 해결했습니다. <br> * 필드를 추가하여 Design 캘린더의 디스플레이 방법을 모방하기 위해 중국어 _term_or_date를 추가하십시오. 그 날에 태양열이있는 경우, 음력의 첫날 인 경우 태양열 용어를 나타냅니다. </blockquote> * @version 0.10 2009-12-22 */public final class chinesecalendar 확장 gregoriancalendar {private static final long serialversionuid = 8l; / ** 음력 연도*/ 공개 정적 최종 최종 int Chinese_year = 801; / ** 음력 월*/ 공개 정적 최종 int int Chinese_month = 802; / ** 음력의 날*/ public static final int Chinese_date = 803; / ** 그 달의 태양 기어 (이전 태양 기어)에 해당하는 Gregorian Day*/ public static final int intectional_term = 804; / ** 그 달의 태양 기어 (다음 태양 기어)에 해당하는 그레고리의 날*/ public static final int Chinese_principle_term = 805; / ** 하늘의 줄기*/ 공공 정적 최종 최종 int Chinese_heavenly_stem = 806; / ** 지구 분기*/ 공개 정적 최종 최종 int Chinese_earthly_Branch = 807; / ** 조디악 표지판 (조디악 표지판)*/ public static final int Chinese_zodiac = 808; / ** 태양 기어 또는 음력의 날*/ 공개 정적 최종 최종 int Chinese_term_or_date = 888; // Skywang에 의해 추가/ ** 음력 축제*/ public static final int lunar_festival = 809; / ** 태양 기어*/ public static final int solar_festival = 810; / ** 태양열*/ 공개 정적 최종 int int Chinese_term = 811; / ** 달 또는 달의 날*/ 공개 정적 최종 최종 int Chinese_month_or_date = 812; / ** 축제 또는 태양 기간 또는 음력의 날*/ 공개 정적 최종 int festival_or_term_or_date = 813; 개인 int Chineseyear; 개인 int chinesemonth; // 1로 시작하고 음수는 Leap Month Private int chinesedate를 나타냅니다. 개인 int 섹션 용어; // Gregorian Day Private int 원칙; // Gregorian Day Private Boolean은 ChineseFieldsComputed입니다. // 음력 날짜가 계산되고 확인되었는지 여부는 개인 부울 Aresolartermscomputed; // 태양열이 계산 및 확인되었는지 여부는 개인 부울 LastSetchinese; // 음력 속성의 마지막 설정입니다./** 현재 시간을 사용하여 인스턴스를 구성하십시오. */ public chinesecalendar () {super (); } /** 지정된 시간을 사용하여 인스턴스를 구성합니다. */ public chinesecalendar (날짜 d) {super.settime (d); } /** 지정된 시간을 사용하여 인스턴스를 구성합니다. */ public chinesecalendar (캘린더 c) {this (c.gettime ()); } /** 지정된 Gregorian 날짜를 사용하여 인스턴스를 구성합니다. */ public chinesecalendar (int y, int m, int d) {super (y, m, d); } /*** 지정된 날짜가있는 인스턴스를 구성합니다. * * @param ischinese *는 음력 날짜 * @param y * @param m * @param d */ public chinesecalendar (boolean ischinese, int y, int m, int d) {if (ischinese) {set (chanese_year, y); set (Chinese_month, m); set (Chinese_date, d); } else {set (y, m, d); }} public void set (int field, int value) {computeIfned (필드); if (ischinesefield (field)) {// lunar 캘린더 속성 스위치 (필드) {case Chinese_year : Chineseyear = value; 부서지다; Case Chinese_month : Chinesemonth = value; 부서지다; Case Chinese_date : chinesedate = value; 부서지다; 기본값 : New New OregalArgumentException ( "지원되지 않은 필드 설정 :" + 필드); } lastsetchinese = true; } else {// 비 루나 캘린더 속성 Super.set (필드, 값); lastsetchinese = false; } arefieldsset = false; arechinesefieldscomputed = false; aresolartermscomputed = false; } public int get (int field) {computeIfneed (필드); if (! ischinesefield (field)) {return super.get (필드); } switch (필드) {Case Chinese_Year : return Chineseyear; Case Chinese_month : Return Chinesemonth; Case Chinese_date : return chinesedate; Case Chinese_Sectional_term : 반환 단면 말; Case Chinese_principle_term : 반환 원칙; Case Chinese_heavenly_stem : return (중국어 -4) % 10 + 1; Case Chinese_earthly_Branch : Case Chinese_Zodiac : return (Chineseyear -4) % 12 + 1; CASE Chinese_month_or_date : if (get (winer_date) == 1) {return Chinese_month; } else {return Chinese_date; } case Chinese_term_or_Date : int 옵션; if (get (calendar.date) == get (chinese_sectional_term)) {옵션 = chinese_sectional_term; } else if (get (calendar.date) == get (intren_principle_term)) {옵션 = chinese_principle_term; } else if (get (chinese_date) == 1) {옵션 = 중국어 _month; } else {옵션 = 중국어 _date; } 반환 옵션; 기본값 : New New OregalArgumentException을 던지십시오 ( "지원되지 않은 필드 get :" + field); }} public void add (int field, int umoll) {computeIfned (필드); if (! ischinesefield (field)) {super.add (필드, 금); lastsetchinese = false; arechinesefieldscomputed = false; aresolartermscomputed = false; 반품; } switch (필드) {Case Chinese_Year : ChineseYear += 금액; 부서지다; CASE Chinese_Month : for (int i = 0; i <alks; i ++) {Chinesemonth = nextchinesemonth (Chineseyear, Chinesemonth); if (chinesemonth == 1) {중국어 ++; } } 부서지다; Case Chinese_date : int maxdate = daysInchinesemonth (Chineseyear, Chinesemonth); for (int i = 0; i <ands; i ++) {chinesedate ++; if (chinesedate> maxdate) {chinesedate = 1; Chinesemonth = NextChinesemonth (Chineseyear, Chinesemonth); if (chinesemonth == 1) {중국어 ++; } maxDate = daySinchinesemonth (중국어, Chinesemonth); }} 기본값 : 새로운 불법 행정 exception 던지기 ( "지원되지 않은 필드 :" + 필드); } lastsetchinese = true; arefieldsset = false; arechinesefieldscomputed = false; aresolartermscomputed = false; } public void roll (int field, int umoll) {computeIfned (필드); if (! ischinesefield (field)) {super.roll (필드, 금); lastsetchinese = false; arechinesefieldscomputed = false; aresolartermscomputed = false; 반품; } switch (필드) {Case Chinese_Year : ChineseYear += 금액; 부서지다; CASE Chinese_Month : for (int i = 0; i <alks; i ++) {Chinesemonth = nextchinesemonth (Chineseyear, Chinesemonth); } 부서지다; Case Chinese_date : int maxdate = daysInchinesemonth (Chineseyear, Chinesemonth); for (int i = 0; i <ands; i ++) {chinesedate ++; if (chinesedate> maxdate) {chinesedate = 1; }} 기본값 : 새로운 불법 행정 exception 던지기 ( "지원되지 않은 필드 :" + 필드); } lastsetchinese = true; arefieldsset = false; arechinesefieldscomputed = false; aresolartermscomputed = false; } /*** 속성의 중국어를 얻으십시오. 사용할 수있는 속성 필드는 day_of_week 및 모든 음력 필드입니다. * * @param field * @return */ public String getchinese (int field) {computeIfned (field); 스위치 (필드) {Case Chinese_year : return getchinese (intereh_heavenly_stem) + getchinese (Chinese_earthly_Branch) + "Year"; Case Chinese_month : if (Chinesemonth> 0) return ChinesemonthNames [Chinesemonth] + "Month"; 그렇지 않으면 "leap" + chinesemonthnames [-chinesemonth] + "month"를 반환합니다. CASE Chinese_Date : return chineseDateNames [chinesedate]; CASE Chinese_Sectional_term : return sectionternames [get (calendar.month)]; Case Chinese_principle_term : return inrincipletermNames [get (calendar.month)]; Case Chinese_heavenly_stem : return stemnames [get (field)]; CASE Chinese_earthly_Branch : return branchnames [get (field)]; Case Chinese_Zodiac : return AnimalNames [get (field)]; case calendar.day_of_week : return chineseweeknames [get (field)]; CASE Chinese_term_or_Date : return getchinese (get (get (chanese_term_or_date)); 사례 lunar_festival : return getLunarFestival (); Case Solar_Festival : return getSolarFestival (); Case Festival_or_term_or_date : return getFestivalorTerMordate (); // todo check case chinese_month_or_date : return getchinese (get (chinese_month_or_date)); Case Chinese_term : return getChineseTerm (); 기본값 : New New OregalArgumentException을 던지십시오 ( "지원되지 않은 Field Chinese Get :" + Field); }} public string getSimpleGregriandAtestring () {return new StringBuffer (). Append (get (Year)). Append ( "-") .Append (get (Month) + 1) .append ( "-"). Append (get (date)) .toString (); } public string getSimpleChinesEdatestring () {return new StringBuffer () .append (get (chinese_year)) .Append ( "-") .Append (get (chinese_month)> 0? "" + get (chinese_month) : "*" + (-get (get (get (get)) } public string getChinesEdatestring () {return new StringBuffer (). Append (getchinese (interchinese (iniation_year)) .Append (getchinese (chinese_month)) .Append (getchinese (interchinese (intern_date)). toString (); } public String toString () {StringBuffer buf = new StringBuffer (); buf.append (getsimplegregoriandatestring ()). Append ( "|") .append (getchinese (day_of_week)). Append ( "| [Lunar Calendar]" ") .Append (get (intere (iniations (chinese_sectional_term)). Append ( "day") .append (getchinese (chinese_sectional_term)). Append ( "") .Append (get (get (chanese_principle_term)). Append ( "Day") .append (getchinese (getchinese (chinese_principle_term)); return buf.tostring (); } /** * Determine whether it is a lunar attribute* * @param field * @return */ private boolean isChineseField(int field) { switch (field) { case CHINESE_YEAR: case CHINESE_MONTH: case CHINESE_DATE: case CHINESE_SECTIONAL_TERM: case CHINESE_PRINCIPLE_TERM: case CHINESE_HEAVENLY_STEM: case CHINESE_EARTHLY_BRANCH: case CHINESE_ZODIAC: case Chinese_term_or_date : Case Chinese_month_or_date : true를 반환합니다. 기본값 : 거짓을 반환합니다. }} / ** * 태양열과 관련된 속성 여부를 결정하십시오 * @param field * @return * / private boolean ischineseTermsfield (int field) {switch (field) {case Chinese_Sectional_term : Case Chinese_Principle_term : case Chinese_term_or_date : Return true; 기본값 : 거짓을 반환합니다. }} /** * 지난 시간에 설정된 속성이 이번에 설정 또는 획득 할 것과 같지 않은 경우 (Lunar Calendar /Gregorian Calendar), <br> * 예를 들어, 마지막으로 설정 한 시간은 음력 캘린더였으며 이제 Gregorian Calendar를 설정하거나 얻으려고합니다. 날짜. * * @param field */ private void computeIfned (int field) {if (ischinesefield (field)) {if (! lastsetchinese &&! arechinesefieldscomputed) {super.complete (); computechinesefields (); arefieldsset = true; arechinesefieldscomputed = true; aresolartermscomputed = false; } if (ischineseTermsfield (필드) &&! aresolartermscomputed) {computesolarterms (); aresolartermscomputed = true; }} else {if (lastSetchInese &&! areFieldSset) {compitheGregorianFields (); super.complete (); arefieldsset = true; arechinesefieldscomputed = true; aresolartermscomputed = false; }}}} / *** 음력 날짜를 사용하여 Gregoriandate* / private void compithorianfields () {int y = ChineseYear; int m = chinesemonth; int d = chinesedate; arechinesefieldscomputed = true; arefieldsset = true; lastsetchinese = false; // (y <1900) y = 1899 인 경우 날짜 범위를 조정합니다. 그렇지 않으면 (y> 2100) y = 2101; if (m <-12) m = -12; 그렇지 않으면 (m> 12) m = 12; if (d <1) d = 1; 그렇지 않으면 (d> 30) d = 30; int dateint = y * 10000 + math.abs (m) * 100 + d; if (dateInt <19001111) {// 너무 작은 세트 (1901, Calendar.jaruary, 1); super.complete (); } else if (dateInt> 21001201) {// 너무 큰 세트 (2100, calendar.december, 31); super.complete (); } else {if (math.abs (m)> 12) {m = 12; } int days = chinesecalendar.daysinchinesemonth (y, m); if (days == 0) {m = -m; days = chinesecalendar.daysinchinesemonth (y, m); } if (d> days) {d = 일; } set (y, math.abs (m) -1, d); computechinesefields (); int 금액 = 0; while (chineseyear! = y || chinesemonth! = m) {금액 += daysinchinesemonth (Chineseyear, Chinesemonth); Chinesemonth = NextChinesemonth (Chineseyear, Chinesemonth); if (chinesemonth == 1) {중국어 ++; }} 금액 += d -chinesedate; super.add (calendar.date, 금액); } computechinesefields (); } / *** Gregorian 날짜* / private void computechinesefields () {int gregorianyear = internalget (calendar.year)을 사용하여 음력 날짜를 계산합니다. int gregorianmonth = 내부 세트 (calendar.month) + 1; int gregoriandate = 내부 세트 (calendar.date); if (gregorianyear <1901 || gregorianyear> 2100) {return; } int Startyear, StartMonth, StartDate; if (gregorianyear <2000) {Startyear = baseyear; StartMonth = Basemonth; startDate = 기반; 중국어 = BaseChineseyear; Chinesemonth = Basechinesemonth; Chinesedate = Basechinesedate; } else {// 두 번째 해당 일은 컴퓨팅 효율을 향상시키는 데 사용됩니다. // 2000 년 1 월 1 일, 해당 음력 4697 (1999), StartYear = baseyear + 99; startmonth = 1; startDate = 1; 중국어 = BaseChineseyear + 99; Chinesemonth = 11; chinesedate = 25; } int daysDiff = 0; // (int i = startyear; i <gregorianyear; i ++) {if (isgregorianleapyear (i)) {daysdiff+= 366; // 도약 연도} else {daysDiff += 365; }} // 월 (int i = startmonth; i <gregorianmonth; i ++) {daysDiff+= daysingRegorianMonth (Gregorianyear, i -1); } // daydaysdiff += gregoriandate -StartDate; chinesedate += daysdiff; int lastdate = daysInchinesemonth (ChineseYear, Chinesemonth); while (chinesedate> lastdate) {chinesedate- = lastdate; Chinesemonth = NextChinesemonth (Chineseyear, Chinesemonth); if (chinesemonth == 1) {중국어 ++; } lastdate = daysInchinesemonth (ChineseYear, Chinesemonth); }} / *** 태양열 계산* / private void computesOlarterms () {int gregorianyear = internalget (calendar.year); int gregorianmonth = 내부 세트 (calendar.month); if (gregorianyear <1901 || gregorianyear> 2100) {return; } sectionalterm = sectionalterm (gregorianyear, gregorianmonth); 원칙 = 원칙 (Gregorianyear, Gregorianmonth); } / * 다음은 정적 방법입니다 ~ * / / ** * 그레고리 연도의 윤년 * * @param year * @return * / public static boolean isgregorianleapyear (int year) {boolean isleap = false; if (년 % 4 == 0) {isleap = true; } if (Year % 100 == 0) {isleap = false; } if (Year % 400 == 0) {isleap = true; } 반환 ISLEAP; } /*** Gregorian 년의 일 수를 계산하고 Gregorian Month는 0에서 시작합니다! * * @param y * @param m * @return */ public static int daysingregorianmonth (int y, int m) {int d = daysingregorianmonth [m]; if (m == calendar.february && isgregorianleapyear (y)) {d ++; // Gregorian 년의 도약 연도에 하루 더 하루} 반환 d; } /*** Gregorian 달의 태양열을 계산하고 Gregorian Month는 0에서 시작합니다! * * * @param y * @param m * @return */ public static int 섹션 말단 (int y, int m) {m ++; if (y <1901 || y> 2100) {return 0; } int index = 0; int ry = y -baseyear + 1; while (ry> = sectionaltermyear [m -1] [index]) {index ++; } int term = sectionaltermmap [m -1] [4 * index + ry % 4]; if ((ry == 121) && (m == 4)) {term = 5; } if ((ry == 132) && (m == 4)) {term = 5; } if ((ry == 194) && (m == 6)) {term = 6; } 반품 용어; } /*** Gregorian 년의 Zhongqi를 계산하고 Gregorian Month는 0에서 시작합니다! * * @param y * @param m * @return */ public static int principleterm (int y, int m) {m ++; if (y <1901 || y> 2100) {return 0; } int index = 0; int ry = y -baseyear + 1; while (ry> = principleterMyear [m -1] [index]) {index ++; } int term = principaltermmap [m -1] [4 * index + ry % 4]; if ((ry == 171) && (m == 3)) {term = 21; } if ((ry == 181) && (m == 5)) {term = 21; } 반품 용어; } / ** * 음력 연도의 일수를 계산 * * @param y * @param m * @return * / public static int daysinchinesemonth (int y, int m) {// 참고 : Leap Month m <0 int index = y -basechineseyear + baseindex; int v = 0; int l = 0; int d = 30; if (1 <= m && m <= 8) {v = chinesemonths [2 * index]; l = m -1; if (((v >> l) & 0x01) == 1) {d = 29; }} else if (9 <= m && m <= 12) {v = chinesemonths [2 * index + 1]; l = m -9; if (((v >> l) & 0x01) == 1) {d = 29; }} else {v = chinesemonths [2 * index + 1]; v = (v >> 4) & 0x0f; if (v! = math.abs (m)) {d = 0; } else {d = 29; for (int i = 0; i <bigleapmonthyears.length; i ++) {if (bigleapmonthyears [i] == index) {d = 30; 부서지다; }}}} return d; } / ** * 음력의 다음 달 계산 * * @param y * @param m * @return * / public static int nextchinesemonth (int y, int m) {int n = math.abs (m) + 1; if (m> 0) {int index = y- BaseChineseyear + BaseIndex; int v = chinesemonths [2 * index + 1]; v = (v >> 4) & 0x0f; if (v == m) {n = -m; }} if (n == 13) {n = 1; } return n; } /* 캘린더 첫날 날짜* / 개인 정적 최종 int baseyear = 1901; 개인 정적 최종 INT Basemonth = 1; 개인 정적 최종 int 기반 = 1; 비공개 정적 최종 int baseindex = 0; 개인 정적 최종 최종 INT BASECHINESEYEAR = 1900; 개인 정적 최종 최종 INT BaseChinesemonth = 11; 개인 정적 최종 INT int BaseChinesedate = 11; /* 중국 문자열*/ 개인 정적 최종 문자열 [] chineseweeknames = { "", "일요일", "월요일", "화요일", "목요일", "금요일", "토요일"}; 개인 정적 최종 문자열 [] chinesemonthnames = { "", "첫 번째", "3", "Four", "Six", "Seven", "Seven", "8", "Nine", "Ten", "Ten", "Eleven", "Twelve"}; 개인 정적 최종 문자열 [] chinesedatenames = { "", "첫 번째", "첫 번째", "네 번째", "5", "6 번째", "Seventh", "8 번째", "Nine", "Nine", "Tenth", "Tenth", "Tenth", "Tenth", "Tenth", "Tenth", "" "," "", "" "," "", "" "," "" "," ","Tenth "" "10 번째", "10 번째", "10 번째", "10 번째", "10 번째", "10 번째", "10 번째", "10 번째", "10 번째"}; 개인 정적 최종 문자열 [] PrincipleTermNames = { "대수", "빗물", "스프링 춘분", "녹색 비", "여름 태양", "녹색 여름", "녹색 여름", "녹색 여름", "여름 솔라", "녹색 여름", "Starry Summer", "9 월 equinox", "Frost Fall", "Solst", "" "" "," "" "}; 개인 정적 최종 문자열 [] Sectionnernames = { "Little Cold", "Bird Spring", "Jingzhe", "Qingming", "Begin of Summer", "Graining Seeds", "Little Heat", "Bird Autumn", "White Dew", "Cold Dew", "Breaking Winter", "High Snow"}; 개인 정적 최종 문자열 [] stemnames = { "", "jia", "yi", "bing", "ding", "wu", "ji", "geng", "xin", "ren", "gui"}; 개인 정적 최종 문자열 [] BranchNames = { "", "Zi", "ug", "yin", "mao", "chen", "si", "wu", "shen", "you", "xu", "hai"}; 개인 정적 최종 문자열 [] 동물성 최종 문자열 = { "", "rat", "ox", "tiger", "rabbit", "dragon", "뱀", "말", "양", "원숭이", "치킨", "개", "돼지"}; / * 다음은 데이터 압축 테이블 ~ */ private static final int [] bigleapmonthyears = {6, 14, 19, 25, 33, 36, 38, 41, 44, 52, 55, 79, 117, 136, 147, 150, 155, 158, 185, 193}; 개인 정적 최종 char [] [] sectionaltermmap = {{{7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 4, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3}, {6, 6, 6, 7, 6, 6, 6, 6, 5, 5, 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8, 8, 8, 7, 7, 8, 8, 7, 7, 7, 8, 7, 7, 7, 7, 6, 7, 7, 7, 6, 6, 7, 7, 6, 6, 6, 7, 7}}; 개인 정적 최종 문자 [] [] Sectionaltermyear = {{{13, 49, 85, 117, 149, 185, 201, 250, 250}, {13, 45, 81, 117, 149, 185, 201, 250}, {13, 48, 84, 112, 148, 184, 200, 201, 250}, {13, 45, 108, 108 172, 200, 201, 250}, {13, 44, 72, 104, 132, 168, 200, 201, 250}, {5, 33, 68, 96, 124, 152, 188, 200, 201}, {29, 57, 85, 120, 148, 176, 200, 201, 250}, {13, 76, 104, 132 200, 201}, {25, 60, 88, 120, 148, 184, 200, 201, 250}, {16, 44, 76, 108, 144, 172, 200, 201, 250}, {28, 60, 92, 124, 160, 192, 200, 201, 250}, {17, 53, 85, 124, 156, 188, 200, 250 개인 정적 최종 문자 [] [] 원칙적 문자 map = {{{21, 21, 21, 21, 21, 20, 21, 21, 21, 20, 20, 20, 21, 21, 20, 20, 20, 20, 20, 20, 20, 19, 20, 20, 20, 19, 20, 19, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20}. 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18}, {21, 21, 21, 21, 22, 21, 21, 21, 21, 20, 21, 21, 21, 20, 20, 21, 21, 20, 20, 20, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 20, 20, 20, 20, 20, 19, 19, 20, 20, 19, 19, 19, 19, 20, 20, 20}, {21, 22, 22, 22, 21, 21, 22, 22, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 20, 20, 21, 20, 20, 20, 20, 21, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 22, 21, 21, 21, 21, 20, 21, 21, 20, 20, 21, 21, 21}, {23, 23, 24, 24, 23, 23, 22, 22, 23, 23, 23, 22, 23, 23, 22, 22, 23, 22, 22, 22, 22, 22, 22, 22, 23}, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 22, 23, 24, 23, 23, 23, 23, 23, 22, 23, 23, 22, 22, 23, 23, 22, 22, 22, 23, 23}, {23, 24, 24, 23, 23, 24, 24, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 23, 23, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 23, 23, 23, 23, 24, 24, 23, 23, 23, 23, 23, 23, 23, 22, 23, 23, 23, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 23, 23, 22, 22, 23, 23, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 21, 22, 22, 22, 21, 22, 22, 21, 21, 21, 22, 21, 21, 21, 21, 22}}; Private STATIC Final char [] [] PrincipleTermyear = {{13, 45, 81, 113, 149, 185, 201}, {21, 57, 93, 125, 161, 193, 201}, {21, 56, 88, 120, 152, 188, 200, 201}, {21, 49, 81, 116, 14, 176,, 200,, 201} 49, 201}, {28, 60, 88, 116, 148, 180, 200, 201}, {25, 53, 84, 112, 144, 172, 200, 201}, {29, 57, 89, 120, 148, 180, 200, 200, {17, 45, 73, 108, 140, 168, 200, 200, 200, 200,} 124, 160, 192, 200, 201}, {16, 44, 80, 112, 148, 180, 200, 201}, {17, 53, 88, 120, 156, 188, 200, 201}}; 개인 정적 최종 문자 [] daysingregorianmonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31}; 개인 정적 최종 char [] chinesemonths = {0x00, 0x04, 0xad, 0x08, 0x5a, 0x01, 0xd5, 0x54, 0xb4, 0x09, 0x64, 0x05, 0x59, 0x45, 0x95, 0x95, 0x0a, 0xa6, 0x55, 0x55, 0x04, 0x04. 0xad, 0x08, 0x5a, 0x62, 0xda, 0x04, 0xb4, 0x05, 0xb4, 0x55, 0x52, 0x0d, 0x94, 0x0a, 0x4a, 0x2a, 0x56, 0x02, 0x6d, 0x71, 0x6d, 0x6d, 0x6d, 0x6d. 0x02, 0xd2, 0x52, 0xa9, 0x05, 0x49, 0x0d, 0x2a, 0x45, 0x2b, 0x09, 0x56, 0x01, 0xb5, 0x20, 0x6d, 0x01, 0x59, 0x69, 0xd4, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x24. 0xa9, 0x56, 0xa5, 0x04, 0x2b, 0x09, 0x9e, 0x38, 0xb6, 0x08, 0xec, 0x74, 0x6c, 0x05, 0xd4, 0x0a, 0xe4, 0x6a, 0x52, 0x05, 0x05, 0x0a, 0x42, 0x5b, 0x04, 0xb6, 0x04, 0xb4, 0x22, 0x6a, 0x05, 0x52, 0x75, 0xc9, 0x0a, 0x52, 0x05, 0x35, 0x55, 0x4d, 0x0a, 0x5a, 0x02, 0x5d, 0x5d, 0x5d. 0xb5, 0x02, 0x6a, 0x8a, 0x68, 0x05, 0xa9, 0x0a, 0x8a, 0x6a, 0x2a, 0x05, 0x2d, 0x09, 0xaa, 0x48, 0x5a, 0x01, 0xb5, 0x09, 0x09, 0x39, 0x39, 0x09. 0x05, 0x25, 0x75, 0x95, 0x0a, 0x96, 0x04, 0x4d, 0x54, 0xad, 0x04, 0xda, 0x04, 0xd4, 0x44, 0xb4, 0x05, 0x54, 0x85, 0x52, 0x0d, 0x0d, 0x0d, 0x52. 0x56, 0x6a, 0x56, 0x02, 0x6a, 0x41, 0xda, 0x02, 0xb2, 0xa1, 0xa9, 0x05, 0x49, 0x0d, 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, 0x02, 0xb5, 0x02, 0x31, 0x69, 0x31, 0x73, 0xa9, 0x0a, 0x4a, 0x05, 0x2d, 0x2d, 0x4a. 0x2d, 0x09, 0x5a, 0x01, 0xd5, 0x48, 0xb4, 0x09, 0x68, 0x89, 0x54, 0x0b, 0xa4, 0x0a, 0xa5, 0x6a, 0x95, 0x04, 0xad, 0x08, 0x6a, 0x6a, 0x6a, 0x6a, 0x08. 0x04, 0x74, 0x05, 0xb0, 0x25, 0x54, 0x03}; 개인 문자열 getChineseTerm () {if (get (calendar.date) == get (chinese_sectional_term)) {return sectionaltermnames [get (get (calendar.month)]; } else if (get (calendar.date) == get (chanese_principle_term)) {return areperterMnames [get (calendar.month)]; } else return null; } // skywang 개인 문자열 getLunarFestival () {int day = get (intereal_date); int month = get (Chinese_month); 문자열 stoday = day <10? "0" + Day : "" + Day; 문자열 smonth = month <10? "0"+(Month) : "+(Month); return lfestival.get (smonth+stoday);} private string getAollFestival () {int day = get (calendar.date); int month = get (calendar.month); String stoday = day <10?"0 "+Day :" "+Day <+(Month+1)); 반환 sfestival.get (smonth+stoday); } private String getFestivalorTerMordate () {String ret; if ((ret = getsolarfestival ())! = null) retoret ret; if ((ret = getLunarfestival ())! = null) retur ret; return getchinese (get (chinese_term_or_date)); } // Gregorian Festival Private Static Hashmap <String, String> sfestival = new Hashmap <String, String> (); // Lunar 개입 개인 정적 해시 맵 <String, String> lfestival = new Hashmap <String, String> (); static {sfestival.put ( "0101", "New Year 's Day"); sfestival.put ( "0214", "Valenteen Day"); sfestival.put ( "0308", "여자의 날"); sfestival.put ( "0312", "Arbor Day"); sfestival.put ( "0401", "April 's Day"); sfestival.put ( "0501", "노동절"); sfestival.put ( "0504", "Youth Day"); sfestival.put ( "0601", "Children 's Day"); sfestival.put ( "0701", "Centering Day"); sfestival.put ( "0801", "Army Day"); sfestival.put ( "0910", "교사의 날"); sfestival.put ( "1001", "National Day"); sFestival.put("1031","Halloween"); // sFestival.put("1112","Birthday of Sun Yat-sen"); sFestival.put("1225","Christmas"); lFestival.put("0101","Spring Festival"); // lFestival.put("0102","Quan 2"); // lFestival.put("0103","Quan 3"); lFestival.put("0115","Lantern Festival"); lFestival.put("0505","Dragon Boat Festival"); lFestival.put("0707","Qianxi Festival"); lFestival.put("0815","Mid-Autumn Festival"); lFestival.put("0909","Dongyang Festival"); lFestival.put("1208","Laba Festival"); // lFestival.put("1299","New Year's Eve"); }}