001: /*
002: *******************************************************************************
003: * Copyright (C) 2005-2006, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: */
007: package com.ibm.icu.util;
008:
009: import java.util.Date;
010: import java.util.Locale;
011:
012: /**
013: * Implement the Coptic calendar system.
014: * <p>
015: * CopticCalendar usually should be instantiated using
016: * {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
017: * with the tag <code>"@calendar=coptic"</code>.</p>
018: *
019: * @see com.ibm.icu.util.Calendar
020: * @draft ICU 3.4
021: * @provisional This API might change or be removed in a future release.
022: */
023: public final class CopticCalendar extends CECalendar {
024: // jdk1.4.2 serialver
025: private static final long serialVersionUID = 5903818751846742911L;
026:
027: /**
028: * Constant for \u03c9\u03bf\u03b3\u03c4/\u062a\ufeee\ufe97,
029: * the 1st month of the Coptic year.
030: * @draft ICU 3.4
031: * @provisional This API might change or be removed in a future release.
032: */
033: public static final int TOUT = 0;
034:
035: /**
036: * Constant for \u03a0\u03b1\u03bf\u03c0\u03b9/\ufeea\ufe91\ufe8e\ufe91,
037: * the 2nd month of the Coptic year.
038: * @draft ICU 3.4
039: * @provisional This API might change or be removed in a future release.
040: */
041: public static final int BABA = 1;
042:
043: /**
044: * Constant for \u0391\u03b8\u03bf\u03c1/\u0631\ufeee\ufe97\ufe8e\ufeeb,
045: * the 3rd month of the Coptic year.
046: * @draft ICU 3.4
047: * @provisional This API might change or be removed in a future release.
048: */
049: public static final int HATOR = 2;
050:
051: /**
052: * Constant for \u03a7\u03bf\u03b9\u03b1\u03ba/\ufeda\ufeec\ufef4\ufedb,
053: * the 4th month of the Coptic year.
054: * @draft ICU 3.4
055: * @provisional This API might change or be removed in a future release.
056: */
057: public static final int KIAHK = 3;
058:
059: /**
060: * Constant for \u03a4\u03c9\u03b2\u03b9/\u0637\ufeee\ufe92\ufeeb,
061: * the 5th month of the Coptic year.
062: * @draft ICU 3.4
063: * @provisional This API might change or be removed in a future release.
064: */
065: public static final int TOBA = 4;
066:
067: /**
068: * Constant for \u039c\u03b5\u03e3\u03b9\u03c1/\ufeae\ufef4\ufeb8\ufee3\u0623,
069: * the 6th month of the Coptic year.
070: * @draft ICU 3.4
071: * @provisional This API might change or be removed in a future release.
072: */
073: public static final int AMSHIR = 5;
074:
075: /**
076: * Constant for \u03a0\u03b1\u03c1\u03b5\u03bc\u03e9\u03b1\u03c4/\u062a\ufe8e\ufeec\ufee3\ufeae\ufe91,
077: * the 7th month of the Coptic year.
078: * @draft ICU 3.4
079: * @provisional This API might change or be removed in a future release.
080: */
081: public static final int BARAMHAT = 6;
082:
083: /**
084: * Constant for \u03a6\u03b1\u03c1\u03bc\u03bf\u03b8\u03b9/\u0647\u062f\ufeee\ufee3\ufeae\ufe91,
085: * the 8th month of the Coptic year.
086: * @draft ICU 3.4
087: * @provisional This API might change or be removed in a future release.
088: */
089: public static final int BARAMOUDA = 7;
090:
091: /**
092: * Constant for \u03a0\u03b1\u03e3\u03b1\u03bd/\ufeb2\ufee8\ufeb8\ufe91,
093: * the 9th month of the Coptic year.
094: * @draft ICU 3.4
095: * @provisional This API might change or be removed in a future release.
096: */
097: public static final int BASHANS = 8;
098:
099: /**
100: * Constant for \u03a0\u03b1\u03c9\u03bd\u03b9/\ufeea\ufee7\u0624\ufeee\ufe91,
101: * the 10th month of the Coptic year.
102: * @draft ICU 3.4
103: * @provisional This API might change or be removed in a future release.
104: */
105: public static final int PAONA = 9;
106:
107: /**
108: * Constant for \u0395\u03c0\u03b7\u03c0/\ufe90\ufef4\ufe91\u0623,
109: * the 11th month of the Coptic year.
110: * @draft ICU 3.4
111: * @provisional This API might change or be removed in a future release.
112: */
113: public static final int EPEP = 10;
114:
115: /**
116: * Constant for \u039c\u03b5\u03f2\u03c9\u03c1\u03b7/\u0649\ufeae\ufeb4\ufee3,
117: * the 12th month of the Coptic year.
118: * @draft ICU 3.4
119: * @provisional This API might change or be removed in a future release.
120: */
121: public static final int MESRA = 11;
122:
123: /**
124: * Constant for \u03a0\u03b9\u03ba\u03bf\u03b3\u03eb\u03b9
125: * \u03bc\u03b1\u03b2\u03bf\u03c4/\ufeae\ufef4\ufed0\ufebc\ufedf\u0627
126: * \ufeae\ufeec\ufeb8\ufedf\u0627,
127: * the 13th month of the Coptic year.
128: * @draft ICU 3.4
129: * @provisional This API might change or be removed in a future release.
130: */
131: public static final int NASIE = 12;
132:
133: private static final int JD_EPOCH_OFFSET = 1824665;
134:
135: // init base class value, common to all constructors
136: {
137: jdEpochOffset = JD_EPOCH_OFFSET;
138: }
139:
140: /**
141: * Constructs a default <code>CopticCalendar</code> using the current time
142: * in the default time zone with the default locale.
143: *
144: * @draft ICU 3.4
145: * @provisional This API might change or be removed in a future release.
146: */
147: public CopticCalendar() {
148: super ();
149: }
150:
151: /**
152: * Constructs a <code>CopticCalendar</code> based on the current time
153: * in the given time zone with the default locale.
154: *
155: * @param zone The time zone for the new calendar.
156: *
157: * @draft ICU 3.4
158: * @provisional This API might change or be removed in a future release.
159: */
160: public CopticCalendar(TimeZone zone) {
161: super (zone);
162: }
163:
164: /**
165: * Constructs a <code>CopticCalendar</code> based on the current time
166: * in the default time zone with the given locale.
167: *
168: * @param aLocale The locale for the new calendar.
169: * @draft ICU 3.4
170: * @provisional This API might change or be removed in a future release.
171: */
172: public CopticCalendar(Locale aLocale) {
173: super (aLocale);
174: }
175:
176: /**
177: * Constructs a <code>CopticCalendar</code> based on the current time
178: * in the default time zone with the given locale.
179: *
180: * @param locale The icu locale for the new calendar.
181: *
182: * @draft ICU 3.4
183: * @provisional This API might change or be removed in a future release.
184: */
185: public CopticCalendar(ULocale locale) {
186: super (locale);
187: }
188:
189: /**
190: * Constructs a <code>CopticCalendar</code> based on the current time
191: * in the given time zone with the given locale.
192: *
193: * @param zone The time zone for the new calendar.
194: * @param aLocale The locale for the new calendar.
195: *
196: * @draft ICU 3.4
197: * @provisional This API might change or be removed in a future release.
198: */
199: public CopticCalendar(TimeZone zone, Locale aLocale) {
200: super (zone, aLocale);
201: }
202:
203: /**
204: * Constructs a <code>CopticCalendar</code> based on the current time
205: * in the given time zone with the given locale.
206: *
207: * @param zone The time zone for the new calendar.
208: * @param locale The icu locale for the new calendar.
209: *
210: * @draft ICU 3.4
211: * @provisional This API might change or be removed in a future release.
212: */
213: public CopticCalendar(TimeZone zone, ULocale locale) {
214: super (zone, locale);
215: }
216:
217: /**
218: * Constructs a <code>CopticCalendar</code> with the given date set
219: * in the default time zone with the default locale.
220: *
221: * @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
222: * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
223: * The value is 0-based. e.g., 0 for Tout.
224: * @param date The value used to set the calendar's {@link #DATE DATE} time field.
225: *
226: * @draft ICU 3.4
227: * @provisional This API might change or be removed in a future release.
228: */
229: public CopticCalendar(int year, int month, int date) {
230: super (year, month, date);
231: }
232:
233: /**
234: * Constructs a <code>CopticCalendar</code> with the given date set
235: * in the default time zone with the default locale.
236: *
237: * @param date The date to which the new calendar is set.
238: *
239: * @draft ICU 3.4
240: * @provisional This API might change or be removed in a future release.
241: */
242: public CopticCalendar(Date date) {
243: super (date);
244: }
245:
246: /**
247: * Constructs a <code>CopticCalendar</code> with the given date
248: * and time set for the default time zone with the default locale.
249: *
250: * @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
251: * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
252: * The value is 0-based. e.g., 0 for Tout.
253: * @param date The value used to set the calendar's {@link #DATE DATE} time field.
254: * @param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
255: * @param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
256: * @param second The value used to set the calendar's {@link #SECOND SECOND} time field.
257: *
258: * @draft ICU 3.4
259: * @provisional This API might change or be removed in a future release.
260: */
261: public CopticCalendar(int year, int month, int date, int hour,
262: int minute, int second) {
263: super (year, month, date, hour, minute, second);
264: }
265:
266: /**
267: * Convert an Coptic year, month, and day to a Julian day.
268: *
269: * @param year the year
270: * @param month the month
271: * @param date the day
272: *
273: * @draft ICU 3.4
274: * @provisional This API might change or be removed in a future release.
275: */
276: public static int copticToJD(long year, int month, int date) {
277: return ceToJD(year, month, date, JD_EPOCH_OFFSET);
278: }
279:
280: /**
281: * @internal ICU 3.4
282: * @deprecated This API is ICU internal only.
283: */
284: public static Integer[] getDateFromJD(int julianDay) {
285: return getDateFromJD(julianDay, JD_EPOCH_OFFSET);
286: }
287:
288: /**
289: * Return the current Calendar type.
290: * @return type of calendar (gregorian, etc.)
291: * @internal ICU 3.4
292: * @deprecated This API is ICU internal only.
293: */
294: public String getType() {
295: return "coptic";
296: }
297: }
|