9d9045be0af15b1a56b12e0deea0f00eea1fa8e3
[jalviewjs.git] / site / j2s / java / text / DateFormatSymbols.js
1 Clazz.declarePackage ("java.text");\r
2 Clazz.load (["java.util.Hashtable"], "java.text.DateFormatSymbols", ["java.lang.IllegalArgumentException", "$.InternalError", "java.util.Arrays", "java.util.Locale", "jssun.util.resources.LocaleData"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.eras = null;\r
5 this.months = null;\r
6 this.shortMonths = null;\r
7 this.weekdays = null;\r
8 this.shortWeekdays = null;\r
9 this.ampms = null;\r
10 this.zoneStrings = null;\r
11 this.isZoneStringsSet = false;\r
12 this.localPatternChars = null;\r
13 this.locale = null;\r
14 Clazz.instantialize (this, arguments);\r
15 }, java.text, "DateFormatSymbols", null, Cloneable);\r
16 Clazz.makeConstructor (c$, \r
17 function () {\r
18 this.initializeData (java.util.Locale.getDefault ());\r
19 });\r
20 Clazz.makeConstructor (c$, \r
21 function (locale) {\r
22 this.initializeData (locale);\r
23 }, "java.util.Locale");\r
24 c$.getInstance = Clazz.defineMethod (c$, "getInstance", \r
25 function () {\r
26 return java.text.DateFormatSymbols.getInstance (java.util.Locale.getDefault ());\r
27 });\r
28 c$.getInstance = Clazz.defineMethod (c$, "getInstance", \r
29 function (locale) {\r
30 return  new java.text.DateFormatSymbols (locale);\r
31 }, "java.util.Locale");\r
32 Clazz.defineMethod (c$, "getEras", \r
33 function () {\r
34 return this.duplicate (this.eras);\r
35 });\r
36 Clazz.defineMethod (c$, "setEras", \r
37 function (newEras) {\r
38 this.eras = this.duplicate (newEras);\r
39 }, "~A");\r
40 Clazz.defineMethod (c$, "getMonths", \r
41 function () {\r
42 return this.duplicate (this.months);\r
43 });\r
44 Clazz.defineMethod (c$, "setMonths", \r
45 function (newMonths) {\r
46 this.months = this.duplicate (newMonths);\r
47 }, "~A");\r
48 Clazz.defineMethod (c$, "getShortMonths", \r
49 function () {\r
50 return this.duplicate (this.shortMonths);\r
51 });\r
52 Clazz.defineMethod (c$, "setShortMonths", \r
53 function (newShortMonths) {\r
54 this.shortMonths = this.duplicate (newShortMonths);\r
55 }, "~A");\r
56 Clazz.defineMethod (c$, "getWeekdays", \r
57 function () {\r
58 return this.duplicate (this.weekdays);\r
59 });\r
60 Clazz.defineMethod (c$, "setWeekdays", \r
61 function (newWeekdays) {\r
62 this.weekdays = this.duplicate (newWeekdays);\r
63 }, "~A");\r
64 Clazz.defineMethod (c$, "getShortWeekdays", \r
65 function () {\r
66 return this.duplicate (this.shortWeekdays);\r
67 });\r
68 Clazz.defineMethod (c$, "setShortWeekdays", \r
69 function (newShortWeekdays) {\r
70 this.shortWeekdays = this.duplicate (newShortWeekdays);\r
71 }, "~A");\r
72 Clazz.defineMethod (c$, "getAmPmStrings", \r
73 function () {\r
74 return this.duplicate (this.ampms);\r
75 });\r
76 Clazz.defineMethod (c$, "setAmPmStrings", \r
77 function (newAmpms) {\r
78 this.ampms = this.duplicate (newAmpms);\r
79 }, "~A");\r
80 Clazz.defineMethod (c$, "setZoneStrings", \r
81 function (newZoneStrings) {\r
82 var aCopy =  new Array (newZoneStrings.length);\r
83 for (var i = 0; i < newZoneStrings.length; ++i) {\r
84 if (newZoneStrings[i].length < 5) {\r
85 throw  new IllegalArgumentException ();\r
86 }aCopy[i] = this.duplicate (newZoneStrings[i]);\r
87 }\r
88 this.zoneStrings = aCopy;\r
89 this.isZoneStringsSet = true;\r
90 }, "~A");\r
91 Clazz.defineMethod (c$, "getLocalPatternChars", \r
92 function () {\r
93 return  String.instantialize (this.localPatternChars);\r
94 });\r
95 Clazz.defineMethod (c$, "setLocalPatternChars", \r
96 function (newLocalPatternChars) {\r
97 this.localPatternChars =  String.instantialize (newLocalPatternChars);\r
98 }, "~S");\r
99 Clazz.defineMethod (c$, "clone", \r
100 function () {\r
101 try {\r
102 var other = Clazz.superCall (this, java.text.DateFormatSymbols, "clone", []);\r
103 this.copyMembers (this, other);\r
104 return other;\r
105 } catch (e) {\r
106 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {\r
107 throw  new InternalError ();\r
108 } else {\r
109 throw e;\r
110 }\r
111 }\r
112 });\r
113 Clazz.overrideMethod (c$, "hashCode", \r
114 function () {\r
115 var hashcode = 0;\r
116 return hashcode;\r
117 });\r
118 Clazz.defineMethod (c$, "equals", \r
119 function (obj) {\r
120 if (this === obj) return true;\r
121 if (obj == null || this.getClass () !== obj.getClass ()) return false;\r
122 var that = obj;\r
123 return (java.util.Arrays.equals (this.eras, that.eras) && java.util.Arrays.equals (this.months, that.months) && java.util.Arrays.equals (this.shortMonths, that.shortMonths) && java.util.Arrays.equals (this.weekdays, that.weekdays) && java.util.Arrays.equals (this.shortWeekdays, that.shortWeekdays) && java.util.Arrays.equals (this.ampms, that.ampms) && ((this.localPatternChars != null && this.localPatternChars.equals (that.localPatternChars)) || (this.localPatternChars == null && that.localPatternChars == null)));\r
124 }, "~O");\r
125 c$.cacheLookup = Clazz.defineMethod (c$, "cacheLookup", \r
126  function (desiredLocale) {\r
127 var rb = java.text.DateFormatSymbols.cachedLocaleData.get (desiredLocale);\r
128 if (rb == null) {\r
129 rb = jssun.util.resources.LocaleData.getDateFormatData (desiredLocale);\r
130 java.text.DateFormatSymbols.cachedLocaleData.put (desiredLocale, rb);\r
131 }return rb;\r
132 }, "java.util.Locale");\r
133 Clazz.defineMethod (c$, "initializeData", \r
134  function (desiredLocale) {\r
135 var i;\r
136 var resource = java.text.DateFormatSymbols.cacheLookup (desiredLocale);\r
137 this.eras = resource.getObject ("Eras");\r
138 this.months = resource.getStringArray ("MonthNames");\r
139 this.shortMonths = resource.getStringArray ("MonthAbbreviations");\r
140 var lWeekdays = resource.getStringArray ("DayNames");\r
141 this.weekdays =  new Array (8);\r
142 this.weekdays[0] = "";\r
143 for (i = 0; i < lWeekdays.length; i++) this.weekdays[i + 1] = lWeekdays[i];\r
144 \r
145 var sWeekdays = resource.getStringArray ("DayAbbreviations");\r
146 this.shortWeekdays =  new Array (8);\r
147 this.shortWeekdays[0] = "";\r
148 for (i = 0; i < sWeekdays.length; i++) this.shortWeekdays[i + 1] = sWeekdays[i];\r
149 \r
150 this.ampms = resource.getStringArray ("AmPmMarkers");\r
151 this.localPatternChars = resource.getString ("DateTimePatternChars");\r
152 this.locale = desiredLocale;\r
153 }, "java.util.Locale");\r
154 Clazz.defineMethod (c$, "duplicate", \r
155  function (srcArray) {\r
156 var dstArray =  new Array (srcArray.length);\r
157 System.arraycopy (srcArray, 0, dstArray, 0, srcArray.length);\r
158 return dstArray;\r
159 }, "~A");\r
160 Clazz.defineMethod (c$, "copyMembers", \r
161  function (src, dst) {\r
162 dst.eras = this.duplicate (src.eras);\r
163 dst.months = this.duplicate (src.months);\r
164 dst.shortMonths = this.duplicate (src.shortMonths);\r
165 dst.weekdays = this.duplicate (src.weekdays);\r
166 dst.shortWeekdays = this.duplicate (src.shortWeekdays);\r
167 dst.ampms = this.duplicate (src.ampms);\r
168 if (src.zoneStrings != null) {\r
169 if (dst.zoneStrings == null) {\r
170 dst.zoneStrings =  new Array (src.zoneStrings.length);\r
171 }for (var i = 0; i < dst.zoneStrings.length; ++i) {\r
172 dst.zoneStrings[i] = this.duplicate (src.zoneStrings[i]);\r
173 }\r
174 } else {\r
175 dst.zoneStrings = null;\r
176 }dst.localPatternChars =  String.instantialize (src.localPatternChars);\r
177 }, "java.text.DateFormatSymbols,java.text.DateFormatSymbols");\r
178 Clazz.defineStatics (c$,\r
179 "patternChars", "GyMdkHmsSEDFwWahKzZ",\r
180 "millisPerHour", 3600000);\r
181 c$.cachedLocaleData = c$.prototype.cachedLocaleData =  new java.util.Hashtable (3);\r
182 });\r