KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > icu > util > CopticCalendar


1 /*
2  *******************************************************************************
3  * Copyright (C) 2005-2006, International Business Machines Corporation and *
4  * others. All Rights Reserved. *
5  *******************************************************************************
6  */

7 package com.ibm.icu.util;
8
9 import java.util.Date JavaDoc;
10 import java.util.Locale JavaDoc;
11
12 /**
13  * Implement the Coptic calendar system.
14  * <p>
15  * CopticCalendar usually should be instantiated using
16  * {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
17  * with the tag <code>"@calendar=coptic"</code>.</p>
18  *
19  * @see com.ibm.icu.util.Calendar
20  * @draft ICU 3.4
21  * @provisional This API might change or be removed in a future release.
22  */

23 public final class CopticCalendar extends CECalendar
24 {
25     // jdk1.4.2 serialver
26
private static final long serialVersionUID = 5903818751846742911L;
27
28     /**
29      * Constant for ????/???,
30      * the 1st month of the Coptic year.
31      * @draft ICU 3.4
32      * @provisional This API might change or be removed in a future release.
33      */

34     public static final int TOUT = 0;
35
36     /**
37      * Constant for ?????/????,
38      * the 2nd month of the Coptic year.
39      * @draft ICU 3.4
40      * @provisional This API might change or be removed in a future release.
41      */

42     public static final int BABA = 1;
43
44     /**
45      * Constant for ????/?????,
46      * the 3rd month of the Coptic year.
47      * @draft ICU 3.4
48      * @provisional This API might change or be removed in a future release.
49      */

50     public static final int HATOR = 2;
51
52     /**
53      * Constant for ?????/????,
54      * the 4th month of the Coptic year.
55      * @draft ICU 3.4
56      * @provisional This API might change or be removed in a future release.
57      */

58     public static final int KIAHK = 3;
59
60     /**
61      * Constant for ????/????,
62      * the 5th month of the Coptic year.
63      * @draft ICU 3.4
64      * @provisional This API might change or be removed in a future release.
65      */

66     public static final int TOBA = 4;
67
68     /**
69      * Constant for ?????/?????,
70      * the 6th month of the Coptic year.
71      * @draft ICU 3.4
72      * @provisional This API might change or be removed in a future release.
73      */

74     public static final int AMSHIR = 5;
75
76     /**
77      * Constant for ????????/??????,
78      * the 7th month of the Coptic year.
79      * @draft ICU 3.4
80      * @provisional This API might change or be removed in a future release.
81      */

82     public static final int BARAMHAT = 6;
83
84     /**
85      * Constant for ???????/??????,
86      * the 8th month of the Coptic year.
87      * @draft ICU 3.4
88      * @provisional This API might change or be removed in a future release.
89      */

90     public static final int BARAMOUDA = 7;
91
92     /**
93      * Constant for ?????/????,
94      * the 9th month of the Coptic year.
95      * @draft ICU 3.4
96      * @provisional This API might change or be removed in a future release.
97      */

98     public static final int BASHANS = 8;
99
100     /**
101      * Constant for ?????/?????,
102      * the 10th month of the Coptic year.
103      * @draft ICU 3.4
104      * @provisional This API might change or be removed in a future release.
105      */

106     public static final int PAONA = 9;
107
108     /**
109      * Constant for ????/????,
110      * the 11th month of the Coptic year.
111      * @draft ICU 3.4
112      * @provisional This API might change or be removed in a future release.
113      */

114     public static final int EPEP = 10;
115
116     /**
117      * Constant for ??????/????,
118      * the 12th month of the Coptic year.
119      * @draft ICU 3.4
120      * @provisional This API might change or be removed in a future release.
121      */

122     public static final int MESRA = 11;
123
124     /**
125      * Constant for ???????
126      * ?????/??????
127      * ?????,
128      * the 13th month of the Coptic year.
129      * @draft ICU 3.4
130      * @provisional This API might change or be removed in a future release.
131      */

132     public static final int NASIE = 12;
133   
134     private static final int JD_EPOCH_OFFSET = 1824665;
135
136     // init base class value, common to all constructors
137
{
138         jdEpochOffset = JD_EPOCH_OFFSET;
139     }
140
141     /**
142      * Constructs a default <code>CopticCalendar</code> using the current time
143      * in the default time zone with the default locale.
144      *
145      * @draft ICU 3.4
146      * @provisional This API might change or be removed in a future release.
147      */

148     public CopticCalendar() {
149         super();
150     }
151
152     /**
153      * Constructs a <code>CopticCalendar</code> based on the current time
154      * in the given time zone with the default locale.
155      *
156      * @param zone The time zone for the new calendar.
157      *
158      * @draft ICU 3.4
159      * @provisional This API might change or be removed in a future release.
160      */

161     public CopticCalendar(TimeZone zone) {
162         super(zone);
163     }
164
165     /**
166      * Constructs a <code>CopticCalendar</code> based on the current time
167      * in the default time zone with the given locale.
168      *
169      * @param aLocale The locale for the new calendar.
170      * @draft ICU 3.4
171      * @provisional This API might change or be removed in a future release.
172      */

173     public CopticCalendar(Locale JavaDoc aLocale) {
174         super(aLocale);
175     }
176
177     /**
178      * Constructs a <code>CopticCalendar</code> based on the current time
179      * in the default time zone with the given locale.
180      *
181      * @param locale The icu locale for the new calendar.
182      *
183      * @draft ICU 3.4
184      * @provisional This API might change or be removed in a future release.
185      */

186     public CopticCalendar(ULocale locale) {
187         super(locale);
188     }
189
190     /**
191      * Constructs a <code>CopticCalendar</code> based on the current time
192      * in the given time zone with the given locale.
193      *
194      * @param zone The time zone for the new calendar.
195      * @param aLocale The locale for the new calendar.
196      *
197      * @draft ICU 3.4
198      * @provisional This API might change or be removed in a future release.
199      */

200     public CopticCalendar(TimeZone zone, Locale JavaDoc aLocale) {
201         super(zone, aLocale);
202     }
203     
204     /**
205      * Constructs a <code>CopticCalendar</code> based on the current time
206      * in the given time zone with the given locale.
207      *
208      * @param zone The time zone for the new calendar.
209      * @param locale The icu locale for the new calendar.
210      *
211      * @draft ICU 3.4
212      * @provisional This API might change or be removed in a future release.
213      */

214     public CopticCalendar(TimeZone zone, ULocale locale) {
215         super(zone, locale);
216     }
217     
218     /**
219      * Constructs a <code>CopticCalendar</code> with the given date set
220      * in the default time zone with the default locale.
221      *
222      * @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
223      * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
224      * The value is 0-based. e.g., 0 for Tout.
225      * @param date The value used to set the calendar's {@link #DATE DATE} time field.
226      *
227      * @draft ICU 3.4
228      * @provisional This API might change or be removed in a future release.
229      */

230     public CopticCalendar(int year, int month, int date) {
231         super(year, month, date);
232     }
233
234     /**
235      * Constructs a <code>CopticCalendar</code> with the given date set
236      * in the default time zone with the default locale.
237      *
238      * @param date The date to which the new calendar is set.
239      *
240      * @draft ICU 3.4
241      * @provisional This API might change or be removed in a future release.
242      */

243     public CopticCalendar(Date JavaDoc date) {
244         super(date);
245     }
246
247     /**
248      * Constructs a <code>CopticCalendar</code> with the given date
249      * and time set for the default time zone with the default locale.
250      *
251      * @param year The value used to set the calendar's {@link #YEAR YEAR} time field.
252      * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
253      * The value is 0-based. e.g., 0 for Tout.
254      * @param date The value used to set the calendar's {@link #DATE DATE} time field.
255      * @param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
256      * @param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
257      * @param second The value used to set the calendar's {@link #SECOND SECOND} time field.
258      *
259      * @draft ICU 3.4
260      * @provisional This API might change or be removed in a future release.
261      */

262     public CopticCalendar(int year, int month, int date, int hour,
263                           int minute, int second) {
264         super(year, month, date, hour, minute, second);
265     }
266
267     /**
268      * Convert an Coptic year, month, and day to a Julian day.
269      *
270      * @param year the year
271      * @param month the month
272      * @param date the day
273      *
274      * @draft ICU 3.4
275      * @provisional This API might change or be removed in a future release.
276      */

277     public static int copticToJD(long year, int month, int date) {
278         return ceToJD(year, month, date, JD_EPOCH_OFFSET);
279     }
280     
281     /**
282      * @internal ICU 3.4
283      * @deprecated This API is ICU internal only.
284      */

285     public static Integer JavaDoc[] getDateFromJD(int julianDay) {
286         return getDateFromJD(julianDay, JD_EPOCH_OFFSET);
287     }
288
289     /**
290      * Return the current Calendar type.
291      * @return type of calendar (gregorian, etc.)
292      * @internal ICU 3.4
293      * @deprecated This API is ICU internal only.
294      */

295     public String JavaDoc getType() {
296         return "coptic";
297     }
298 }
299
300
Popular Tags