Source Code Cross Referenced for SimpleHoliday.java in  » Internationalization-Localization » icu4j » com » ibm » icu » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *******************************************************************************
003:         * Copyright (C) 1996-2006, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */
007:
008:        package com.ibm.icu.util;
009:
010:        import java.util.Date;
011:        import com.ibm.icu.util.Calendar;
012:        import com.ibm.icu.util.GregorianCalendar;
013:
014:        /**
015:         * A holiday whose date can be represented by a month, day, and optionally day of week
016:         * in the Gregorian calendar.
017:         *
018:         * @draft ICU 2.8 (retainAll)
019:         * @provisional This API might change or be removed in a future release.
020:         */
021:        public class SimpleHoliday extends Holiday {
022:            /**
023:             * Construct an object representing a holiday
024:             *
025:             * @param month         The month in which this holiday occurs (0-based)
026:             * @param dayOfMonth    The date within the month (1-based).
027:             *
028:             * @param name  The name of this holiday.  This string is used as a key
029:             *              to look up the holiday's name a resource bundle.
030:             *              If the name is not found in the resource bundle,
031:             *              getDisplayName will return this string instead.
032:             *
033:             * @see Holiday#getDisplayName(java.util.Locale)
034:             * @draft ICU 2.8
035:             * @provisional This API might change or be removed in a future release.
036:             */
037:            public SimpleHoliday(int month, int dayOfMonth, String name) {
038:                super (name, new SimpleDateRule(month, dayOfMonth));
039:            }
040:
041:            /**
042:             * Construct an object representing a holiday
043:             *
044:             * @param month         The month in which this holiday occurs (0-based)
045:             * @param dayOfMonth    The date within the month (1-based).
046:             *
047:             * @param name  The name of this holiday.  This string is used as a key
048:             *              to look up the holiday's name a resource bundle.
049:             *              If the name is not found in the resource bundle,
050:             *              getDisplayName will return this string instead.
051:             *
052:             * @see Holiday#getDisplayName(java.util.Locale)
053:             * @draft ICU 2.8
054:             * @provisional This API might change or be removed in a future release.
055:             */
056:            public SimpleHoliday(int month, int dayOfMonth, String name,
057:                    int startYear) {
058:                super (name, rangeRule(startYear, 0, new SimpleDateRule(month,
059:                        dayOfMonth)));
060:            }
061:
062:            /**
063:             * Construct an object representing a holiday
064:             *
065:             * @param month         The month in which this holiday occurs (0-based)
066:             * @param dayOfMonth    The date within the month (1-based).
067:             *
068:             * @param name  The name of this holiday.  This string is used as a key
069:             *              to look up the holiday's name a resource bundle.
070:             *              If the name is not found in the resource bundle,
071:             *              getDisplayName will return this string instead.
072:             *
073:             * @see Holiday#getDisplayName(java.util.Locale)
074:             * @draft ICU 2.8
075:             * @provisional This API might change or be removed in a future release.
076:             */
077:            public SimpleHoliday(int month, int dayOfMonth, String name,
078:                    int startYear, int endYear) {
079:                super (name, rangeRule(startYear, endYear, new SimpleDateRule(
080:                        month, dayOfMonth)));
081:            }
082:
083:            /** // TODO: remove
084:             * Construct an object representing a holiday
085:             *
086:             * @param month The month in which this holiday occurs (0-based)
087:             *
088:             * @param dayOfMonth A date within the month (1-based).  The
089:             *      interpretation of this parameter depends on the value of
090:             *      <code>dayOfWeek</code>.
091:             *
092:             * @param dayOfWeek The day of the week on which this holiday occurs.
093:             *      The following values are legal: <ul>
094:             *      <li>dayOfWeek == 0 - use dayOfMonth only
095:             *      <li>dayOfWeek < 0  - use last -dayOfWeek before or on dayOfMonth
096:             *      <li>dayOfWeek > 0  - use first dayOfWeek after or on dayOfMonth
097:             *      </ul>
098:             *
099:             * @param name  The name of this holiday.  This string is used as a key
100:             *              to look up the holiday's name a resource bundle.
101:             *              If the name is not found in the resource bundle,
102:             *              getDisplayName will return this string instead.
103:             *
104:             * @see Holiday#getDisplayName(java.util.Locale)
105:             * @draft ICU 2.8
106:             * @provisional This API might change or be removed in a future release.
107:             */
108:            public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek,
109:                    String name) {
110:                super (name, new SimpleDateRule(month, dayOfMonth,
111:                        dayOfWeek > 0 ? dayOfWeek : -dayOfWeek, dayOfWeek > 0));
112:            }
113:
114:            /**
115:             * @draft ICU 2.8
116:             * @provisional This API might change or be removed in a future release.
117:             */
118:            public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek,
119:                    String name, int startYear) {
120:                super (name, rangeRule(startYear, 0, new SimpleDateRule(month,
121:                        dayOfMonth, dayOfWeek > 0 ? dayOfWeek : -dayOfWeek,
122:                        dayOfWeek > 0)));
123:            }
124:
125:            /**
126:             * @draft ICU 2.8
127:             * @provisional This API might change or be removed in a future release.
128:             */
129:            public SimpleHoliday(int month, int dayOfMonth, int dayOfWeek,
130:                    String name, int startYear, int endYear) {
131:                super (name, rangeRule(startYear, endYear, new SimpleDateRule(
132:                        month, dayOfMonth, dayOfWeek > 0 ? dayOfWeek
133:                                : -dayOfWeek, dayOfWeek > 0)));
134:            }
135:
136:            private static DateRule rangeRule(int startYear, int endYear,
137:                    DateRule rule) {
138:                if (startYear == 0 && endYear == 0) {
139:                    return rule;
140:                }
141:
142:                RangeDateRule rangeRule = new RangeDateRule();
143:
144:                if (startYear != 0) {
145:                    Calendar start = new GregorianCalendar(startYear,
146:                            Calendar.JANUARY, 1);
147:                    rangeRule.add(start.getTime(), rule);
148:                } else {
149:                    rangeRule.add(rule);
150:                }
151:                if (endYear != 0) {
152:                    Date end = new GregorianCalendar(endYear,
153:                            Calendar.DECEMBER, 31).getTime();
154:                    rangeRule.add(end, null);
155:                }
156:
157:                return rangeRule;
158:            }
159:
160:            /* Constants for holidays that are common throughout the Western
161:             * and Christian worlds.... */
162:
163:            /**
164:             * New Year's Day - January 1st
165:             * @draft ICU 2.8
166:             * @provisional This API might change or be removed in a future release.
167:             */
168:            public static final SimpleHoliday NEW_YEARS_DAY = new SimpleHoliday(
169:                    Calendar.JANUARY, 1, "New Year's Day");
170:
171:            /**
172:             * Epiphany, January 6th
173:             * @draft ICU 2.8
174:             * @provisional This API might change or be removed in a future release.
175:             */
176:            public static final SimpleHoliday EPIPHANY = new SimpleHoliday(
177:                    Calendar.JANUARY, 6, "Epiphany");
178:
179:            /**
180:             * May Day, May 1st
181:             * @draft ICU 2.8
182:             * @provisional This API might change or be removed in a future release.
183:             */
184:            public static final SimpleHoliday MAY_DAY = new SimpleHoliday(
185:                    Calendar.MAY, 1, "May Day");
186:
187:            /**
188:             * Assumption, August 15th
189:             * @draft ICU 2.8
190:             * @provisional This API might change or be removed in a future release.
191:             */
192:            public static final SimpleHoliday ASSUMPTION = new SimpleHoliday(
193:                    Calendar.AUGUST, 15, "Assumption");
194:
195:            /**
196:             * All Saints' Day, November 1st
197:             * @draft ICU 2.8
198:             * @provisional This API might change or be removed in a future release.
199:             */
200:            public static final SimpleHoliday ALL_SAINTS_DAY = new SimpleHoliday(
201:                    Calendar.NOVEMBER, 1, "All Saints' Day");
202:
203:            /**
204:             * All Souls' Day, November 1st
205:             * @draft ICU 2.8
206:             * @provisional This API might change or be removed in a future release.
207:             */
208:            public static final SimpleHoliday ALL_SOULS_DAY = new SimpleHoliday(
209:                    Calendar.NOVEMBER, 2, "All Souls' Day");
210:
211:            /**
212:             * Immaculate Conception, December 8th
213:             * @draft ICU 2.8
214:             * @provisional This API might change or be removed in a future release.
215:             */
216:            public static final SimpleHoliday IMMACULATE_CONCEPTION = new SimpleHoliday(
217:                    Calendar.DECEMBER, 8, "Immaculate Conception");
218:
219:            /**
220:             * Christmas Eve, December 24th
221:             * @draft ICU 2.8
222:             * @provisional This API might change or be removed in a future release.
223:             */
224:            public static final SimpleHoliday CHRISTMAS_EVE = new SimpleHoliday(
225:                    Calendar.DECEMBER, 24, "Christmas Eve");
226:
227:            /**
228:             * Christmas, December 25th
229:             * @draft ICU 2.8
230:             * @provisional This API might change or be removed in a future release.
231:             */
232:            public static final SimpleHoliday CHRISTMAS = new SimpleHoliday(
233:                    Calendar.DECEMBER, 25, "Christmas");
234:
235:            /**
236:             * Boxing Day, December 26th
237:             * @draft ICU 2.8
238:             * @provisional This API might change or be removed in a future release.
239:             */
240:            public static final SimpleHoliday BOXING_DAY = new SimpleHoliday(
241:                    Calendar.DECEMBER, 26, "Boxing Day");
242:
243:            /**
244:             * Saint Stephen's Day, December 26th
245:             * @draft ICU 2.8
246:             * @provisional This API might change or be removed in a future release.
247:             */
248:            public static final SimpleHoliday ST_STEPHENS_DAY = new SimpleHoliday(
249:                    Calendar.DECEMBER, 26, "St. Stephen's Day");
250:
251:            /**
252:             * New Year's Eve, December 31st
253:             * @draft ICU 2.8
254:             * @provisional This API might change or be removed in a future release.
255:             */
256:            public static final SimpleHoliday NEW_YEARS_EVE = new SimpleHoliday(
257:                    Calendar.DECEMBER, 31, "New Year's Eve");
258:
259:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.