KickJava   Java API By Example, From Geeks To Geeks.

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


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

7 package com.ibm.icu.util;
8 import com.ibm.icu.util.TimeZone;
9 import java.util.Date JavaDoc;
10 import java.util.Locale JavaDoc;
11
12 /**
13  * <code>JapaneseCalendar</code> is a subclass of <code>GregorianCalendar</code>
14  * that numbers years and eras based on the reigns of the Japanese emperors.
15  * The Japanese calendar is identical to the Gregorian calendar in all respects
16  * except for the year and era. The ascension of each emperor to the throne
17  * begins a new era, and the years of that era are numbered starting with the
18  * year of ascension as year 1.
19  * <p>
20  * Note that in the year of an imperial ascension, there are two possible sets
21  * of year and era values: that for the old era and for the new. For example, a
22  * new era began on January 7, 1989 AD. Strictly speaking, the first six days
23  * of that year were in the Showa era, e.g. "January 6, 64 Showa", while the rest
24  * of the year was in the Heisei era, e.g. "January 7, 1 Heisei". This class
25  * handles this distinction correctly when computing dates. However, in lenient
26  * mode either form of date is acceptable as input.
27  * <p>
28  * In modern times, eras have started on January 8, 1868 AD, Gregorian (Meiji),
29  * July 30, 1912 (Taisho), December 25, 1926 (Showa), and January 7, 1989 (Heisei). Constants
30  * for these eras, suitable for use in the <code>ERA</code> field, are provided
31  * in this class. Note that the <em>number</em> used for each era is more or
32  * less arbitrary. Currently, the era starting in 1053 AD is era #0; however this
33  * may change in the future as we add more historical data. Use the predefined
34  * constants rather than using actual, absolute numbers.
35  * <p>
36  * This class should not be subclassed.</p>
37  * <p>
38  * JapaneseCalendar usually should be instantiated using
39  * {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
40  * with the tag <code>"@calendar=japanese"</code>.</p>
41  *
42  * @see com.ibm.icu.util.GregorianCalendar
43  * @see com.ibm.icu.util.Calendar
44  *
45  * @author Laura Werner
46  * @author Alan Liu
47  * @stable ICU 2.8
48  */

49 public class JapaneseCalendar extends GregorianCalendar {
50     // jdk1.4.2 serialver
51
private static final long serialVersionUID = -2977189902603704691L;
52
53     private static String JavaDoc copyright = "Copyright \u00a9 1998 IBM Corp. All Rights Reserved.";
54
55     //-------------------------------------------------------------------------
56
// Constructors...
57
//-------------------------------------------------------------------------
58

59     /**
60      * Constructs a default <code>JapaneseCalendar</code> using the current time
61      * in the default time zone with the default locale.
62      * @stable ICU 2.8
63      */

64     public JapaneseCalendar() {
65         super();
66     }
67
68     /**
69      * Constructs a <code>JapaneseCalendar</code> based on the current time
70      * in the given time zone with the default locale.
71      * @param zone the given time zone.
72      * @stable ICU 2.8
73      */

74     public JapaneseCalendar(TimeZone zone) {
75         super(zone);
76     }
77
78     /**
79      * Constructs a <code>JapaneseCalendar</code> based on the current time
80      * in the default time zone with the given locale.
81      * @param aLocale the given locale.
82      * @stable ICU 2.8
83      */

84     public JapaneseCalendar(Locale JavaDoc aLocale) {
85         super(aLocale);
86     }
87
88     /**
89      * Constructs a <code>JapaneseCalendar</code> based on the current time
90      * in the default time zone with the given locale.
91      * @param locale the given ulocale.
92      * @draft ICU 3.2
93      * @provisional This API might change or be removed in a future release.
94      */

95     public JapaneseCalendar(ULocale locale) {
96         super(locale);
97     }
98
99     /**
100      * Constructs a <code>JapaneseCalendar</code> based on the current time
101      * in the given time zone with the given locale.
102      *
103      * @param zone the given time zone.
104      *
105      * @param aLocale the given locale.
106      * @stable ICU 2.8
107      */

108     public JapaneseCalendar(TimeZone zone, Locale JavaDoc aLocale) {
109         super(zone, aLocale);
110     }
111
112     /**
113      * Constructs a <code>JapaneseCalendar</code> based on the current time
114      * in the given time zone with the given locale.
115      *
116      * @param zone the given time zone.
117      *
118      * @param locale the given ulocale.
119      * @draft ICU 3.2
120      * @provisional This API might change or be removed in a future release.
121      */

122     public JapaneseCalendar(TimeZone zone, ULocale locale) {
123         super(zone, locale);
124     }
125
126     /**
127      * Constructs a <code>JapaneseCalendar</code> with the given date set
128      * in the default time zone with the default locale.
129      *
130      * @param date The date to which the new calendar is set.
131      * @stable ICU 2.8
132      */

133     public JapaneseCalendar(Date JavaDoc date) {
134         this();
135         setTime(date);
136     }
137
138     /**
139      * Constructs a <code>JapaneseCalendar</code> with the given date set
140      * in the default time zone with the default locale.
141      *
142      * @param era The imperial era used to set the calendar's {@link #ERA ERA} field.
143      * Eras are numbered starting with the Tenki era, which
144      * began in 1053 AD Gregorian, as era zero. Recent
145      * eras can be specified using the constants
146      * {@link #MEIJI} (which started in 1868 AD),
147      * {@link #TAISHO} (1912 AD),
148      * {@link #SHOWA} (1926 AD), and
149      * {@link #HEISEI} (1989 AD).
150      *
151      * @param year The value used to set the calendar's {@link #YEAR YEAR} field,
152      * in terms of the era.
153      *
154      * @param month The value used to set the calendar's {@link #MONTH MONTH} field.
155      * The value is 0-based. e.g., 0 for January.
156      *
157      * @param date The value used to set the calendar's DATE field.
158      * @stable ICU 2.8
159      */

160     public JapaneseCalendar(int era, int year, int month, int date) {
161         super(year, month, date);
162         set(ERA, era);
163     }
164
165     /**
166      * Constructs a <code>JapaneseCalendar</code> with the given date set
167      * in the default time zone with the default locale.
168      *
169      * @param year The value used to set the calendar's {@link #YEAR YEAR} field,
170      * in the era Heisei, the most current at the time this
171      * class was last updated.
172      *
173      * @param month The value used to set the calendar's {@link #MONTH MONTH} field.
174      * The value is 0-based. e.g., 0 for January.
175      *
176      * @param date The value used to set the calendar's {@link #DATE DATE} field.
177      * @stable ICU 2.8
178      */

179     public JapaneseCalendar(int year, int month, int date) {
180         super(year, month, date);
181         set(ERA, CURRENT_ERA);
182     }
183
184     /**
185      * Constructs a <code>JapaneseCalendar</code> with the given date
186      * and time set for the default time zone with the default locale.
187      *
188      * @param year The value used to set the calendar's {@link #YEAR YEAR} time field,
189      * in the era Heisei, the most current at the time of this
190      * writing.
191      *
192      * @param month The value used to set the calendar's {@link #MONTH MONTH} time field.
193      * The value is 0-based. e.g., 0 for January.
194      *
195      * @param date The value used to set the calendar's {@link #DATE DATE} time field.
196      *
197      * @param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
198      *
199      * @param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
200      *
201      * @param second The value used to set the calendar's {@link #SECOND SECOND} time field.
202      * @stable ICU 2.8
203      */

204     public JapaneseCalendar(int year, int month, int date, int hour,
205                              int minute, int second)
206     {
207         super(year, month, date, hour, minute, second);
208         set(ERA, CURRENT_ERA);
209     }
210
211     //-------------------------------------------------------------------------
212

213     /**
214      * @stable ICU 2.8
215      */

216     protected int handleGetExtendedYear() {
217         int year;
218         if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR &&
219             newerField(EXTENDED_YEAR, ERA) == EXTENDED_YEAR) {
220             year = internalGet(EXTENDED_YEAR, 1);
221         } else {
222             // extended year is a gregorian year, where 1 = 1AD, 0 = 1BC, -1 = 2BC, etc
223
year = internalGet(YEAR, 1) // pin to minimum of year 1 (first year)
224
+ ERAS[internalGet(ERA, CURRENT_ERA) * 3] // add gregorian starting year
225
- 1; // Subtract one because year starts at 1
226
}
227         return year;
228     }
229     
230     /**
231      * Called by handleComputeJulianDay. Returns the default month (0-based) for the year,
232      * taking year and era into account. Defaults to 0 (JANUARY) for Gregorian.
233      * @param extendedYear the extendedYear, as returned by handleGetExtendedYear
234      * @return the default month
235      * @provisional ICU 3.6
236      * @draft ICU 3.6
237      * @see #MONTH
238      */

239     protected int getDefaultMonthInYear(int extendedYear)
240     {
241       int era = internalGet(ERA, CURRENT_ERA);
242       //computeFields(status); // No need to compute fields here - expect the caller already did so.
243

244       // Find out if we are at the edge of an era
245
if(extendedYear == ERAS[era*3]) {
246         return ERAS[(era*3)+1] // month..
247
-1; // return 0-based month
248
} else {
249         return super.getDefaultMonthInYear(extendedYear);
250       }
251     }
252
253     /**
254      * Called by handleComputeJulianDay. Returns the default day (1-based) for the month,
255      * taking currently-set year and era into account. Defaults to 1 for Gregorian.
256      * @param extendedYear the extendedYear, as returned by handleGetExtendedYear
257      * @param month the month, as returned by getDefaultMonthInYear
258      * @return the default day of the month
259      * @draft ICU 3.6
260      * @provisional ICU 3.6
261      * @see #DAY_OF_MONTH
262      */

263     protected int getDefaultDayInMonth(int extendedYear, int month) {
264       int era = internalGet(ERA, CURRENT_ERA);
265           
266       if(extendedYear == ERAS[era*3]) { // if it is year 1..
267
if(month == ((ERAS[(era*3)+1])-1)) { // if it is the emperor's first month..
268
return ERAS[(era*3)+2]; // return the D_O_M of acession
269
}
270       }
271
272       return super.getDefaultDayInMonth(extendedYear, month);
273     }
274
275     /**
276      * @stable ICU 2.8
277      */

278     protected void handleComputeFields(int julianDay) {
279         super.handleComputeFields(julianDay);
280         int year = internalGet(EXTENDED_YEAR);
281
282         int low = 0;
283
284         // Short circuit for recent years. Most modern computations will
285
// occur in the current era and won't require the binary search.
286
// Note that if the year is == the current era year, then we use
287
// the binary search to handle the month/dom comparison.
288
if (year > ERAS[ERAS.length - 3]) {
289             low = CURRENT_ERA;
290         } else {
291             // Binary search
292
int high = ERAS.length / 3;
293         
294             while (low < high - 1) {
295                 int i = (low + high) / 2;
296                 int diff = year - ERAS[i*3];
297
298                 // If years are the same, then compare the months, and if those
299
// are the same, compare days of month. In the ERAS array
300
// months are 1-based for easier maintenance.
301
if (diff == 0) {
302                     diff = internalGet(MONTH) - (ERAS[i*3 + 1] - 1);
303                     if (diff == 0) {
304                         diff = internalGet(DAY_OF_MONTH) - ERAS[i*3 + 2];
305                     }
306                 }
307                 if (diff >= 0) {
308                     low = i;
309                 } else {
310                     high = i;
311                 }
312             }
313         }
314
315         // Now we've found the last era that starts before this date, so
316
// adjust the year to count from the start of that era. Note that
317
// all dates before the first era will fall into the first era by
318
// the algorithm.
319
internalSet(ERA, low);
320         internalSet(YEAR, year - ERAS[low*3] + 1);
321     }
322
323     private static final int[] ERAS = {
324     // Gregorian date of each emperor's ascension
325
// Years are AD, months are 1-based.
326
// Year Month Day
327
645, 6, 19, // Taika
328
650, 2, 15, // Hakuchi
329
672, 1, 1, // Hakuho
330
686, 7, 20, // Shucho
331
701, 3, 21, // Taiho
332
704, 5, 10, // Keiun
333
708, 1, 11, // Wado
334
715, 9, 2, // Reiki
335
717, 11, 17, // Yoro
336
724, 2, 4, // Jinki
337
729, 8, 5, // Tempyo
338
749, 4, 14, // Tempyo-kampo
339
749, 7, 2, // Tempyo-shoho
340
757, 8, 18, // Tempyo-hoji
341
765, 1, 7, // Tempho-jingo
342
767, 8, 16, // Jingo-keiun
343
770, 10, 1, // Hoki
344
781, 1, 1, // Ten-o
345
782, 8, 19, // Enryaku
346
806, 5, 18, // Daido
347
810, 9, 19, // Konin
348
824, 1, 5, // Tencho
349
834, 1, 3, // Showa
350
848, 6, 13, // Kajo
351
851, 4, 28, // Ninju
352
854, 11, 30, // Saiko
353
857, 2, 21, // Tennan
354
859, 4, 15, // Jogan
355
877, 4, 16, // Genkei
356
885, 2, 21, // Ninna
357
889, 4, 27, // Kampyo
358
898, 4, 26, // Shotai
359
901, 7, 15, // Engi
360
923, 4, 11, // Encho
361
931, 4, 26, // Shohei
362
938, 5, 22, // Tengyo
363
947, 4, 22, // Tenryaku
364
957, 10, 27, // Tentoku
365
961, 2, 16, // Owa
366
964, 7, 10, // Koho
367
968, 8, 13, // Anna
368
970, 3, 25, // Tenroku
369
973, 12, 20, // Ten-en
370
976, 7, 13, // Jogen
371
978, 11, 29, // Tengen
372
983, 4, 15, // Eikan
373
985, 4, 27, // Kanna
374
987, 4, 5, // Ei-en
375
989, 8, 8, // Eiso
376
990, 11, 7, // Shoryaku
377
995, 2, 22, // Chotoku
378
999, 1, 13, // Choho
379
1004, 7, 20, // Kanko
380
1012, 12, 25, // Chowa
381
1017, 4, 23, // Kannin
382
1021, 2, 2, // Jian
383
1024, 7, 13, // Manju
384
1028, 7, 25, // Chogen
385
1037, 4, 21, // Choryaku
386
1040, 11, 10, // Chokyu
387
1044, 11, 24, // Kantoku
388
1046, 4, 14, // Eisho
389
1053, 1, 11, // Tengi
390
1058, 8, 29, // Kohei
391
1065, 8, 2, // Jiryaku
392
1069, 4, 13, // Enkyu
393
1074, 8, 23, // Shoho
394
1077, 11, 17, // Shoryaku
395
1081, 2, 10, // Eiho
396
1084, 2, 7, // Otoku
397
1087, 4, 7, // Kanji
398
1094, 12, 15, // Kaho
399
1096, 12, 17, // Eicho
400
1097, 11, 21, // Shotoku
401
1099, 8, 28, // Kowa
402
1104, 2, 10, // Choji
403
1106, 4, 9, // Kasho
404
1108, 8, 3, // Tennin
405
1110, 7, 13, // Ten-ei
406
1113, 7, 13, // Eikyu
407
1118, 4, 3, // Gen-ei
408
1120, 4, 10, // Hoan
409
1124, 4, 3, // Tenji
410
1126, 1, 22, // Daiji
411
1131, 1, 29, // Tensho
412
1132, 8, 11, // Chosho
413
1135, 4, 27, // Hoen
414
1141, 7, 10, // Eiji
415
1142, 4, 28, // Koji
416
1144, 2, 23, // Tenyo
417
1145, 7, 22, // Kyuan
418
1151, 1, 26, // Ninpei
419
1154, 10, 28, // Kyuju
420
1156, 4, 27, // Hogen
421
1159, 4, 20, // Heiji
422
1160, 1, 10, // Eiryaku
423
1161, 9, 4, // Oho
424
1163, 3, 29, // Chokan
425
1165, 6, 5, // Eiman
426
1166, 8, 27, // Nin-an
427
1169, 4, 8, // Kao
428
1171, 4, 21, // Shoan
429
1175, 7, 28, // Angen
430
1177, 8, 4, // Jisho
431
1181, 7, 14, // Yowa
432
1182, 5, 27, // Juei
433
1184, 4, 16, // Genryuku
434
1185, 8, 14, // Bunji
435
1190, 4, 11, // Kenkyu
436
1199, 4, 27, // Shoji
437
1201, 2, 13, // Kennin
438
1204, 2, 20, // Genkyu
439
1206, 4, 27, // Ken-ei
440
1207, 10, 25, // Shogen
441
1211, 3, 9, // Kenryaku
442
1213, 12, 6, // Kenpo
443
1219, 4, 12, // Shokyu
444
1222, 4, 13, // Joo
445
1224, 11, 20, // Gennin
446
1225, 4, 20, // Karoku
447
1227, 12, 10, // Antei
448
1229, 3, 5, // Kanki
449
1232, 4, 2, // Joei
450
1233, 4, 15, // Tempuku
451
1234, 11, 5, // Bunryaku
452
1235, 9, 19, // Katei
453
1238, 11, 23, // Ryakunin
454
1239, 2, 7, // En-o
455
1240, 7, 16, // Ninji
456
1243, 2, 26, // Kangen
457
1247, 2, 28, // Hoji
458
1249, 3, 18, // Kencho
459
1256, 10, 5, // Kogen
460
1257, 3, 14, // Shoka
461
1259, 3, 26, // Shogen
462
1260, 4, 13, // Bun-o
463
1261, 2, 20, // Kocho
464
1264, 2, 28, // Bun-ei
465
1275, 4, 25, // Kenji
466
1278, 2, 29, // Koan
467
1288, 4, 28, // Shoo
468
1293, 8, 55, // Einin
469
1299, 4, 25, // Shoan
470
1302, 11, 21, // Kengen
471
1303, 8, 5, // Kagen
472
1306, 12, 14, // Tokuji
473
1308, 10, 9, // Enkei
474
1311, 4, 28, // Ocho
475
1312, 3, 20, // Showa
476
1317, 2, 3, // Bunpo
477
1319, 4, 28, // Geno
478
1321, 2, 23, // Genkyo
479
1324, 12, 9, // Shochu
480
1326, 4, 26, // Kareki
481
1329, 8, 29, // Gentoku
482
1331, 8, 9, // Genko
483
1334, 1, 29, // Kemmu
484
1336, 2, 29, // Engen
485
1340, 4, 28, // Kokoku
486
1346, 12, 8, // Shohei
487
1370, 7, 24, // Kentoku
488
1372, 4, 1, // Bunch\u0169
489
1375, 5, 27, // Tenju
490
1379, 3, 22, // Koryaku
491
1381, 2, 10, // Kowa
492
1384, 4, 28, // Gench\u0169
493
1384, 2, 27, // Meitoku
494
1387, 8, 23, // Kakei
495
1389, 2, 9, // Koo
496
1390, 3, 26, // Meitoku
497
1394, 7, 5, // Oei
498
1428, 4, 27, // Shocho
499
1429, 9, 5, // Eikyo
500
1441, 2, 17, // Kakitsu
501
1444, 2, 5, // Bun-an
502
1449, 7, 28, // Hotoku
503
1452, 7, 25, // Kyotoku
504
1455, 7, 25, // Kosho
505
1457, 9, 28, // Choroku
506
1460, 12, 21, // Kansho
507
1466, 2, 28, // Bunsho
508
1467, 3, 3, // Onin
509
1469, 4, 28, // Bunmei
510
1487, 7, 29, // Chokyo
511
1489, 8, 21, // Entoku
512
1492, 7, 19, // Meio
513
1501, 2, 29, // Bunki
514
1504, 2, 30, // Eisho
515
1521, 8, 23, // Taiei
516
1528, 8, 20, // Kyoroku
517
1532, 7, 29, // Tenmon
518
1555, 10, 23, // Koji
519
1558, 2, 28, // Eiroku
520
1570, 4, 23, // Genki
521
1573, 7, 28, // Tensho
522
1592, 12, 8, // Bunroku
523
1596, 10, 27, // Keicho
524
1615, 7, 13, // Genwa
525
1624, 2, 30, // Kan-ei
526
1644, 12, 16, // Shoho
527
1648, 2, 15, // Keian
528
1652, 9, 18, // Shoo
529
1655, 4, 13, // Meiryaku
530
1658, 7, 23, // Manji
531
1661, 4, 25, // Kanbun
532
1673, 9, 21, // Enpo
533
1681, 9, 29, // Tenwa
534
1684, 2, 21, // Jokyo
535
1688, 9, 30, // Genroku
536
1704, 3, 13, // Hoei
537
1711, 4, 25, // Shotoku
538
1716, 6, 22, // Kyoho
539
1736, 4, 28, // Genbun
540
1741, 2, 27, // Kanpo
541
1744, 2, 21, // Enkyo
542
1748, 7, 12, // Kan-en
543
1751, 10, 27, // Horyaku
544
1764, 6, 2, // Meiwa
545
1772, 11, 16, // An-ei
546
1781, 4, 2, // Tenmei
547
1789, 1, 25, // Kansei
548
1801, 2, 5, // Kyowa
549
1804, 2, 11, // Bunka
550
1818, 4, 22, // Bunsei
551
1830, 12, 10, // Tenpo
552
1844, 12, 2, // Koka
553
1848, 2, 28, // Kaei
554
1854, 11, 27, // Ansei
555
1860, 3, 18, // Man-en
556
1861, 2, 19, // Bunkyu
557
1864, 2, 20, // Genji
558
1865, 4, 7, // Keio
559
1868, 9, 8, // Meiji
560
1912, 7, 30, // Taisho
561
1926, 12, 25, // Showa
562
1989, 1, 8, // Heisei
563
};
564
565     //-------------------------------------------------------------------------
566
// Public constants for some of the recent eras that folks might use...
567
//-------------------------------------------------------------------------
568

569     // Constant for the current era. This must be regularly updated.
570
/**
571      * @stable ICU 2.8
572      */

573     static public final int CURRENT_ERA = (ERAS.length / 3) - 1;
574     
575     /**
576      * Constant for the era starting on Sept. 8, 1868 AD.
577      * @stable ICU 2.8
578      */

579     static public final int MEIJI = CURRENT_ERA - 3;
580
581     /**
582      * Constant for the era starting on July 30, 1912 AD.
583      * @stable ICU 2.8
584      */

585     static public final int TAISHO = CURRENT_ERA - 2;
586     
587     /**
588      * Constant for the era starting on Dec. 25, 1926 AD.
589      * @stable ICU 2.8
590      */

591     static public final int SHOWA = CURRENT_ERA - 1;
592
593     /**
594      * Constant for the era starting on Jan. 7, 1989 AD.
595      * @stable ICU 2.8
596      */

597     static public final int HEISEI = CURRENT_ERA;
598
599     /**
600      * Partial limits table for limits that differ from GregorianCalendar's.
601      * The YEAR max limits are filled in the first time they are needed.
602      */

603     private static int LIMITS[][] = {
604         // Minimum Greatest Least Maximum
605
// Minimum Maximum
606
{ 0, 0, CURRENT_ERA, CURRENT_ERA }, // ERA
607
{ 1, 1, 0, 0 }, // YEAR
608
};
609
610     private static boolean YEAR_LIMIT_KNOWN = false;
611
612     /**
613      * Override GregorianCalendar. We should really handle YEAR_WOY and
614      * EXTENDED_YEAR here too to implement the 1..5000000 range, but it's
615      * not critical.
616      * @stable ICU 2.8
617      */

618     protected int handleGetLimit(int field, int limitType) {
619         switch (field) {
620         case ERA:
621             return LIMITS[field][limitType];
622         case YEAR:
623             if (!YEAR_LIMIT_KNOWN) {
624                 int min = ERAS[3] - ERAS[0];
625                 int max = min;
626                 for (int i=6; i<ERAS.length; i+=3) {
627                     int d = ERAS[i] - ERAS[i-3];
628                     if (d < min) {
629                         min = d;
630                     }
631                     if (d > max) {
632                         max = d;
633                     }
634                 }
635                 LIMITS[field][LEAST_MAXIMUM] = ++min; // 1-based
636
LIMITS[field][MAXIMUM] = ++max; // 1-based
637

638                 YEAR_LIMIT_KNOWN=true;
639             }
640             return LIMITS[field][limitType];
641         default:
642             return super.handleGetLimit(field, limitType);
643         }
644     }
645
646     /**
647      * Return the current Calendar type.
648      * @return type of calendar (gregorian, etc.)
649      * @internal ICU 3.0
650      * @deprecated This API is ICU internal only.
651      */

652     public String JavaDoc getType() {
653         return "japanese";
654     }
655
656     /*
657     private static CalendarFactory factory;
658     public static CalendarFactory factory() {
659         if (factory == null) {
660             factory = new CalendarFactory() {
661                 public Calendar create(TimeZone tz, ULocale loc) {
662                     return new JapaneseCalendar(tz, loc);
663                 }
664
665                 public String factoryName() {
666                     return "Japanese";
667                 }
668             };
669         }
670         return factory;
671     }
672     */

673 }
674
Popular Tags