Source Code Cross Referenced for CalendarTests.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » test » serializable » 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.dev.test.serializable 
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:
009:        package com.ibm.icu.dev.test.serializable;
010:
011:        import java.util.Locale;
012:
013:        import com.ibm.icu.util.BuddhistCalendar;
014:        import com.ibm.icu.util.Calendar;
015:        import com.ibm.icu.util.ChineseCalendar;
016:        import com.ibm.icu.util.CopticCalendar;
017:        import com.ibm.icu.util.EthiopicCalendar;
018:        import com.ibm.icu.util.GregorianCalendar;
019:        import com.ibm.icu.util.HebrewCalendar;
020:        import com.ibm.icu.util.IslamicCalendar;
021:        import com.ibm.icu.util.JapaneseCalendar;
022:        import com.ibm.icu.util.TimeZone;
023:
024:        /**
025:         * @author emader
026:         *
027:         * TODO To change the template for this generated type comment go to
028:         * Window - Preferences - Java - Code Style - Code Templates
029:         */
030:        public class CalendarTests {
031:            static class CalendarHandler implements  SerializableTest.Handler {
032:                public Object[] getTestObjects() {
033:                    Locale locales[] = SerializableTest.getLocales();
034:                    TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles");
035:                    Calendar calendars[] = new Calendar[locales.length];
036:
037:                    for (int i = 0; i < locales.length; i += 1) {
038:                        calendars[i] = Calendar.getInstance(pst, locales[i]);
039:                    }
040:
041:                    return calendars;
042:                }
043:
044:                public boolean hasSameBehavior(Object a, Object b) {
045:                    Calendar cal_a = (Calendar) a;
046:                    Calendar cal_b = (Calendar) b;
047:                    long now = System.currentTimeMillis();
048:
049:                    cal_a.setTimeInMillis(now);
050:                    cal_a.roll(Calendar.MONTH, 1);
051:
052:                    cal_b.setTimeInMillis(now);
053:                    cal_b.roll(Calendar.MONTH, 1);
054:
055:                    return cal_a.getTime().equals(cal_a.getTime());
056:                }
057:            }
058:
059:            static class BuddhistCalendarHandler extends CalendarHandler {
060:                public Object[] getTestObjects() {
061:                    Locale locales[] = SerializableTest.getLocales();
062:                    TimeZone tst = TimeZone.getTimeZone("Asia/Bangkok");
063:                    BuddhistCalendar calendars[] = new BuddhistCalendar[locales.length];
064:
065:                    for (int i = 0; i < locales.length; i += 1) {
066:                        calendars[i] = new BuddhistCalendar(tst, locales[i]);
067:                    }
068:
069:                    return calendars;
070:                }
071:            }
072:
073:            static class ChineseCalendarHandler extends CalendarHandler {
074:                public Object[] getTestObjects() {
075:                    Locale locales[] = SerializableTest.getLocales();
076:                    TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai");
077:                    ChineseCalendar calendars[] = new ChineseCalendar[locales.length];
078:
079:                    for (int i = 0; i < locales.length; i += 1) {
080:                        calendars[i] = new ChineseCalendar(cst, locales[i]);
081:                    }
082:
083:                    return calendars;
084:                }
085:            }
086:
087:            static class CopticCalendarHandler extends CalendarHandler {
088:                public Object[] getTestObjects() {
089:                    Locale locales[] = SerializableTest.getLocales();
090:                    TimeZone ast = TimeZone.getTimeZone("Europe/Athens");
091:                    CopticCalendar calendars[] = new CopticCalendar[locales.length];
092:
093:                    for (int i = 0; i < locales.length; i += 1) {
094:                        calendars[i] = new CopticCalendar(ast, locales[i]);
095:                    }
096:
097:                    return calendars;
098:                }
099:            }
100:
101:            static class EthiopicCalendarHandler extends CalendarHandler {
102:                public Object[] getTestObjects() {
103:                    Locale locales[] = SerializableTest.getLocales();
104:                    TimeZone ast = TimeZone.getTimeZone("Africa/Addis_Ababa");
105:                    EthiopicCalendar calendars[] = new EthiopicCalendar[locales.length];
106:
107:                    for (int i = 0; i < locales.length; i += 1) {
108:                        calendars[i] = new EthiopicCalendar(ast, locales[i]);
109:                    }
110:
111:                    return calendars;
112:                }
113:            }
114:
115:            static class GregorianCalendarHandler extends CalendarHandler {
116:                public Object[] getTestObjects() {
117:                    Locale locales[] = SerializableTest.getLocales();
118:                    TimeZone pst = TimeZone.getTimeZone("America/Los_Angeles");
119:                    GregorianCalendar calendars[] = new GregorianCalendar[locales.length];
120:
121:                    for (int i = 0; i < locales.length; i += 1) {
122:                        calendars[i] = new GregorianCalendar(pst, locales[i]);
123:                    }
124:
125:                    return calendars;
126:                }
127:            }
128:
129:            static class HebrewCalendarHandler extends CalendarHandler {
130:                public Object[] getTestObjects() {
131:                    Locale locales[] = SerializableTest.getLocales();
132:                    TimeZone jst = TimeZone.getTimeZone("Asia/Jerusalem");
133:                    HebrewCalendar calendars[] = new HebrewCalendar[locales.length];
134:
135:                    for (int i = 0; i < locales.length; i += 1) {
136:                        calendars[i] = new HebrewCalendar(jst, locales[i]);
137:                    }
138:
139:                    return calendars;
140:                }
141:            }
142:
143:            static class IslamicCalendarHandler extends CalendarHandler {
144:                public Object[] getTestObjects() {
145:                    Locale locales[] = SerializableTest.getLocales();
146:                    TimeZone cst = TimeZone.getTimeZone("Africa/Cairo");
147:                    IslamicCalendar calendars[] = new IslamicCalendar[locales.length];
148:
149:                    for (int i = 0; i < locales.length; i += 1) {
150:                        calendars[i] = new IslamicCalendar(cst, locales[i]);
151:                    }
152:
153:                    return calendars;
154:                }
155:            }
156:
157:            static class JapaneseCalendarHandler extends CalendarHandler {
158:                public Object[] getTestObjects() {
159:                    Locale locales[] = SerializableTest.getLocales();
160:                    TimeZone jst = TimeZone.getTimeZone("Asia/Tokyo");
161:                    JapaneseCalendar calendars[] = new JapaneseCalendar[locales.length];
162:
163:                    for (int i = 0; i < locales.length; i += 1) {
164:                        calendars[i] = new JapaneseCalendar(jst, locales[i]);
165:                    }
166:
167:                    return calendars;
168:                }
169:            }
170:
171:            public static void main(String[] args) {
172:                //nothing needed yet...
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.