KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > icu > text > ChineseDateFormatSymbols


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

6 package com.ibm.icu.text;
7
8 import com.ibm.icu.impl.CalendarData;
9 import com.ibm.icu.util.*;
10 import java.util.Locale JavaDoc;
11
12 /**
13  * A subclass of {@link DateFormatSymbols} for {@link ChineseDateFormat}.
14  * This class contains additional symbols corresponding to the
15  * <code>ChineseCalendar.IS_LEAP_MONTH</code> field.
16  *
17  * @see ChineseDateFormat
18  * @see com.ibm.icu.util.ChineseCalendar
19  * @author Alan Liu
20  * @stable ICU 2.0
21  */

22 public class ChineseDateFormatSymbols extends DateFormatSymbols {
23     // Generated by serialver from JDK 1.4.1_01
24
static final long serialVersionUID = 6827816119783952890L;
25     
26     /**
27      * Package-private array that ChineseDateFormat needs to be able to
28      * read.
29      */

30     String JavaDoc isLeapMonth[]; // Do NOT add =null initializer
31

32     /**
33      * Construct a ChineseDateFormatSymbols for the default locale.
34      * @stable ICU 2.0
35      */

36     public ChineseDateFormatSymbols() {
37         this(ULocale.getDefault());
38     }
39
40     /**
41      * Construct a ChineseDateFormatSymbols for the provided locale.
42      * @param locale the locale
43      * @stable ICU 2.0
44      */

45     public ChineseDateFormatSymbols(Locale JavaDoc locale) {
46         super(ChineseCalendar.class, ULocale.forLocale(locale));
47     }
48
49     /**
50      * Construct a ChineseDateFormatSymbols for the provided locale.
51      * @param locale the locale
52      * @draft ICU 3.2
53      * @provisional This API might change or be removed in a future release.
54      */

55     public ChineseDateFormatSymbols(ULocale locale) {
56         super(ChineseCalendar.class, locale);
57     }
58
59     /**
60      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.
61      * @param cal the Calendar
62      * @param locale the locale
63      * @stable ICU 2.0
64      */

65     public ChineseDateFormatSymbols(Calendar cal, Locale JavaDoc locale) {
66         super(cal==null?null:cal.getClass(), locale);
67     }
68
69     /**
70      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.
71      * @param cal the Calendar
72      * @param locale the locale
73      * @draft ICU 3.2
74      * @provisional This API might change or be removed in a future release.
75      */

76     public ChineseDateFormatSymbols(Calendar cal, ULocale locale) {
77         super(cal == null ? null : cal.getClass(), locale);
78     }
79
80     // New API
81
/**
82      * @stable ICU 2.0
83      */

84     public String JavaDoc getLeapMonth(int isLeapMonth) {
85         return this.isLeapMonth[isLeapMonth];
86     }
87
88     /**
89      * @stable ICU 3.0
90      */

91     protected void initializeData(ULocale loc, CalendarData calData) {
92         super.initializeData(loc, calData);
93         isLeapMonth = calData.getStringArray("isLeapMonth");
94     }
95
96     void initializeData(DateFormatSymbols dfs) {
97         super.initializeData(dfs);
98         if (dfs instanceof ChineseDateFormatSymbols) {
99             this.isLeapMonth = ((ChineseDateFormatSymbols)dfs).isLeapMonth;
100         }
101     }
102 }
103
Popular Tags