1 Clazz.declarePackage ("java.text");
2 Clazz.load (["java.util.Hashtable"], "java.text.DateFormatSymbols", ["java.lang.IllegalArgumentException", "$.InternalError", "java.util.Arrays", "java.util.Locale", "jssun.util.resources.LocaleData"], function () {
3 c$ = Clazz.decorateAsClass (function () {
6 this.shortMonths = null;
8 this.shortWeekdays = null;
10 this.zoneStrings = null;
11 this.isZoneStringsSet = false;
12 this.localPatternChars = null;
14 Clazz.instantialize (this, arguments);
15 }, java.text, "DateFormatSymbols", null, Cloneable);
16 Clazz.makeConstructor (c$,
18 this.initializeData (java.util.Locale.getDefault ());
20 Clazz.makeConstructor (c$,
22 this.initializeData (locale);
23 }, "java.util.Locale");
24 c$.getInstance = Clazz.defineMethod (c$, "getInstance",
26 return java.text.DateFormatSymbols.getInstance (java.util.Locale.getDefault ());
28 c$.getInstance = Clazz.defineMethod (c$, "getInstance",
30 return new java.text.DateFormatSymbols (locale);
31 }, "java.util.Locale");
32 Clazz.defineMethod (c$, "getEras",
34 return this.duplicate (this.eras);
36 Clazz.defineMethod (c$, "setEras",
38 this.eras = this.duplicate (newEras);
40 Clazz.defineMethod (c$, "getMonths",
42 return this.duplicate (this.months);
44 Clazz.defineMethod (c$, "setMonths",
45 function (newMonths) {
46 this.months = this.duplicate (newMonths);
48 Clazz.defineMethod (c$, "getShortMonths",
50 return this.duplicate (this.shortMonths);
52 Clazz.defineMethod (c$, "setShortMonths",
53 function (newShortMonths) {
54 this.shortMonths = this.duplicate (newShortMonths);
56 Clazz.defineMethod (c$, "getWeekdays",
58 return this.duplicate (this.weekdays);
60 Clazz.defineMethod (c$, "setWeekdays",
61 function (newWeekdays) {
62 this.weekdays = this.duplicate (newWeekdays);
64 Clazz.defineMethod (c$, "getShortWeekdays",
66 return this.duplicate (this.shortWeekdays);
68 Clazz.defineMethod (c$, "setShortWeekdays",
69 function (newShortWeekdays) {
70 this.shortWeekdays = this.duplicate (newShortWeekdays);
72 Clazz.defineMethod (c$, "getAmPmStrings",
74 return this.duplicate (this.ampms);
76 Clazz.defineMethod (c$, "setAmPmStrings",
78 this.ampms = this.duplicate (newAmpms);
80 Clazz.defineMethod (c$, "setZoneStrings",
81 function (newZoneStrings) {
82 var aCopy = new Array (newZoneStrings.length);
83 for (var i = 0; i < newZoneStrings.length; ++i) {
84 if (newZoneStrings[i].length < 5) {
85 throw new IllegalArgumentException ();
86 }aCopy[i] = this.duplicate (newZoneStrings[i]);
88 this.zoneStrings = aCopy;
89 this.isZoneStringsSet = true;
91 Clazz.defineMethod (c$, "getLocalPatternChars",
93 return String.instantialize (this.localPatternChars);
95 Clazz.defineMethod (c$, "setLocalPatternChars",
96 function (newLocalPatternChars) {
97 this.localPatternChars = String.instantialize (newLocalPatternChars);
99 Clazz.defineMethod (c$, "clone",
102 var other = Clazz.superCall (this, java.text.DateFormatSymbols, "clone", []);
103 this.copyMembers (this, other);
106 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
107 throw new InternalError ();
113 Clazz.overrideMethod (c$, "hashCode",
118 Clazz.defineMethod (c$, "equals",
120 if (this === obj) return true;
121 if (obj == null || this.getClass () !== obj.getClass ()) return false;
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)));
125 c$.cacheLookup = Clazz.defineMethod (c$, "cacheLookup",
126 function (desiredLocale) {
127 var rb = java.text.DateFormatSymbols.cachedLocaleData.get (desiredLocale);
129 rb = jssun.util.resources.LocaleData.getDateFormatData (desiredLocale);
130 java.text.DateFormatSymbols.cachedLocaleData.put (desiredLocale, rb);
132 }, "java.util.Locale");
133 Clazz.defineMethod (c$, "initializeData",
134 function (desiredLocale) {
136 var resource = java.text.DateFormatSymbols.cacheLookup (desiredLocale);
137 this.eras = resource.getObject ("Eras");
138 this.months = resource.getStringArray ("MonthNames");
139 this.shortMonths = resource.getStringArray ("MonthAbbreviations");
140 var lWeekdays = resource.getStringArray ("DayNames");
141 this.weekdays = new Array (8);
142 this.weekdays[0] = "";
143 for (i = 0; i < lWeekdays.length; i++) this.weekdays[i + 1] = lWeekdays[i];
145 var sWeekdays = resource.getStringArray ("DayAbbreviations");
146 this.shortWeekdays = new Array (8);
147 this.shortWeekdays[0] = "";
148 for (i = 0; i < sWeekdays.length; i++) this.shortWeekdays[i + 1] = sWeekdays[i];
150 this.ampms = resource.getStringArray ("AmPmMarkers");
151 this.localPatternChars = resource.getString ("DateTimePatternChars");
152 this.locale = desiredLocale;
153 }, "java.util.Locale");
154 Clazz.defineMethod (c$, "duplicate",
155 function (srcArray) {
156 var dstArray = new Array (srcArray.length);
157 System.arraycopy (srcArray, 0, dstArray, 0, srcArray.length);
160 Clazz.defineMethod (c$, "copyMembers",
161 function (src, dst) {
162 dst.eras = this.duplicate (src.eras);
163 dst.months = this.duplicate (src.months);
164 dst.shortMonths = this.duplicate (src.shortMonths);
165 dst.weekdays = this.duplicate (src.weekdays);
166 dst.shortWeekdays = this.duplicate (src.shortWeekdays);
167 dst.ampms = this.duplicate (src.ampms);
168 if (src.zoneStrings != null) {
169 if (dst.zoneStrings == null) {
170 dst.zoneStrings = new Array (src.zoneStrings.length);
171 }for (var i = 0; i < dst.zoneStrings.length; ++i) {
172 dst.zoneStrings[i] = this.duplicate (src.zoneStrings[i]);
175 dst.zoneStrings = null;
176 }dst.localPatternChars = String.instantialize (src.localPatternChars);
177 }, "java.text.DateFormatSymbols,java.text.DateFormatSymbols");
178 Clazz.defineStatics (c$,
179 "patternChars", "GyMdkHmsSEDFwWahKzZ",
180 "millisPerHour", 3600000);
181 c$.cachedLocaleData = c$.prototype.cachedLocaleData = new java.util.Hashtable (3);