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