]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_2_1-src/src/com/ibm/icu/text/ChineseDateFormatSymbols.java
icu4jsrc
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / icu / text / ChineseDateFormatSymbols.java
1 /****************************************************************************\r
2  * Copyright (C) 2000-2008, International Business Machines Corporation and\r
3  * others. All Rights Reserved.\r
4  ****************************************************************************\r
5  */\r
6 \r
7 package com.ibm.icu.text;\r
8 \r
9 import com.ibm.icu.impl.CalendarData;\r
10 import com.ibm.icu.util.*;\r
11 import java.util.Locale;\r
12 \r
13 /**\r
14  * A subclass of {@link DateFormatSymbols} for {@link ChineseDateFormat}.\r
15  * This class contains additional symbols corresponding to the\r
16  * <code>ChineseCalendar.IS_LEAP_MONTH</code> field.\r
17  *\r
18  * @see ChineseDateFormat\r
19  * @see com.ibm.icu.util.ChineseCalendar\r
20  * @author Alan Liu\r
21  * @stable ICU 2.0\r
22  */\r
23 public class ChineseDateFormatSymbols extends DateFormatSymbols {\r
24     // Generated by serialver from JDK 1.4.1_01\r
25     static final long serialVersionUID = 6827816119783952890L;\r
26     \r
27     /*\r
28      * Package-private array that ChineseDateFormat needs to be able to\r
29      * read.\r
30      */\r
31     String isLeapMonth[]; // Do NOT add =null initializer\r
32 \r
33     /**\r
34      * Construct a ChineseDateFormatSymbols for the default locale.\r
35      * @stable ICU 2.0\r
36      */\r
37     public ChineseDateFormatSymbols() {\r
38         this(ULocale.getDefault());\r
39     }\r
40 \r
41     /**\r
42      * Construct a ChineseDateFormatSymbols for the provided locale.\r
43      * @param locale the locale\r
44      * @stable ICU 2.0\r
45      */\r
46     public ChineseDateFormatSymbols(Locale locale) {\r
47         super(ChineseCalendar.class, ULocale.forLocale(locale));\r
48     }\r
49 \r
50     /**\r
51      * Construct a ChineseDateFormatSymbols for the provided locale.\r
52      * @param locale the locale\r
53      * @stable ICU 3.2\r
54      */\r
55     public ChineseDateFormatSymbols(ULocale locale) {\r
56         super(ChineseCalendar.class, locale);\r
57     }\r
58 \r
59     /**\r
60      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.\r
61      * @param cal the Calendar\r
62      * @param locale the locale\r
63      * @stable ICU 2.0\r
64      */\r
65     public ChineseDateFormatSymbols(Calendar cal, Locale locale) {\r
66         super(cal==null?null:cal.getClass(), locale);\r
67     }\r
68 \r
69     /**\r
70      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.\r
71      * @param cal the Calendar\r
72      * @param locale the locale\r
73      * @stable ICU 3.2\r
74      */\r
75     public ChineseDateFormatSymbols(Calendar cal, ULocale locale) {\r
76         super(cal == null ? null : cal.getClass(), locale);\r
77     }\r
78 \r
79     // New API\r
80     /**\r
81      * @stable ICU 2.0\r
82      */\r
83     public String getLeapMonth(int leap) {\r
84         return isLeapMonth[leap];\r
85     }\r
86 \r
87     /**\r
88      * {@inheritDoc}\r
89      * @stable ICU 3.0\r
90      */\r
91     protected void initializeData(ULocale loc, CalendarData calData) {\r
92         super.initializeData(loc, calData);\r
93         isLeapMonth = calData.getStringArray("isLeapMonth");\r
94     }\r
95 \r
96     void initializeData(DateFormatSymbols dfs) {\r
97         super.initializeData(dfs);\r
98         if (dfs instanceof ChineseDateFormatSymbols) {\r
99             this.isLeapMonth = ((ChineseDateFormatSymbols)dfs).isLeapMonth;\r
100         }\r
101     }\r
102 }\r