Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / text / DateFormatSymbols.js
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 () {
4 this.eras = null;
5 this.months = null;
6 this.shortMonths = null;
7 this.weekdays = null;
8 this.shortWeekdays = null;
9 this.ampms = null;
10 this.zoneStrings = null;
11 this.isZoneStringsSet = false;
12 this.localPatternChars = null;
13 this.locale = null;
14 Clazz.instantialize (this, arguments);
15 }, java.text, "DateFormatSymbols", null, Cloneable);
16 Clazz.makeConstructor (c$, 
17 function () {
18 this.initializeData (java.util.Locale.getDefault ());
19 });
20 Clazz.makeConstructor (c$, 
21 function (locale) {
22 this.initializeData (locale);
23 }, "java.util.Locale");
24 c$.getInstance = Clazz.defineMethod (c$, "getInstance", 
25 function () {
26 return java.text.DateFormatSymbols.getInstance (java.util.Locale.getDefault ());
27 });
28 c$.getInstance = Clazz.defineMethod (c$, "getInstance", 
29 function (locale) {
30 return  new java.text.DateFormatSymbols (locale);
31 }, "java.util.Locale");
32 Clazz.defineMethod (c$, "getEras", 
33 function () {
34 return this.duplicate (this.eras);
35 });
36 Clazz.defineMethod (c$, "setEras", 
37 function (newEras) {
38 this.eras = this.duplicate (newEras);
39 }, "~A");
40 Clazz.defineMethod (c$, "getMonths", 
41 function () {
42 return this.duplicate (this.months);
43 });
44 Clazz.defineMethod (c$, "setMonths", 
45 function (newMonths) {
46 this.months = this.duplicate (newMonths);
47 }, "~A");
48 Clazz.defineMethod (c$, "getShortMonths", 
49 function () {
50 return this.duplicate (this.shortMonths);
51 });
52 Clazz.defineMethod (c$, "setShortMonths", 
53 function (newShortMonths) {
54 this.shortMonths = this.duplicate (newShortMonths);
55 }, "~A");
56 Clazz.defineMethod (c$, "getWeekdays", 
57 function () {
58 return this.duplicate (this.weekdays);
59 });
60 Clazz.defineMethod (c$, "setWeekdays", 
61 function (newWeekdays) {
62 this.weekdays = this.duplicate (newWeekdays);
63 }, "~A");
64 Clazz.defineMethod (c$, "getShortWeekdays", 
65 function () {
66 return this.duplicate (this.shortWeekdays);
67 });
68 Clazz.defineMethod (c$, "setShortWeekdays", 
69 function (newShortWeekdays) {
70 this.shortWeekdays = this.duplicate (newShortWeekdays);
71 }, "~A");
72 Clazz.defineMethod (c$, "getAmPmStrings", 
73 function () {
74 return this.duplicate (this.ampms);
75 });
76 Clazz.defineMethod (c$, "setAmPmStrings", 
77 function (newAmpms) {
78 this.ampms = this.duplicate (newAmpms);
79 }, "~A");
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]);
87 }
88 this.zoneStrings = aCopy;
89 this.isZoneStringsSet = true;
90 }, "~A");
91 Clazz.defineMethod (c$, "getLocalPatternChars", 
92 function () {
93 return  String.instantialize (this.localPatternChars);
94 });
95 Clazz.defineMethod (c$, "setLocalPatternChars", 
96 function (newLocalPatternChars) {
97 this.localPatternChars =  String.instantialize (newLocalPatternChars);
98 }, "~S");
99 Clazz.defineMethod (c$, "clone", 
100 function () {
101 try {
102 var other = Clazz.superCall (this, java.text.DateFormatSymbols, "clone", []);
103 this.copyMembers (this, other);
104 return other;
105 } catch (e) {
106 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
107 throw  new InternalError ();
108 } else {
109 throw e;
110 }
111 }
112 });
113 Clazz.overrideMethod (c$, "hashCode", 
114 function () {
115 var hashcode = 0;
116 return hashcode;
117 });
118 Clazz.defineMethod (c$, "equals", 
119 function (obj) {
120 if (this === obj) return true;
121 if (obj == null || this.getClass () !== obj.getClass ()) return false;
122 var that = obj;
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)));
124 }, "~O");
125 c$.cacheLookup = Clazz.defineMethod (c$, "cacheLookup", 
126  function (desiredLocale) {
127 var rb = java.text.DateFormatSymbols.cachedLocaleData.get (desiredLocale);
128 if (rb == null) {
129 rb = jssun.util.resources.LocaleData.getDateFormatData (desiredLocale);
130 java.text.DateFormatSymbols.cachedLocaleData.put (desiredLocale, rb);
131 }return rb;
132 }, "java.util.Locale");
133 Clazz.defineMethod (c$, "initializeData", 
134  function (desiredLocale) {
135 var i;
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];
144
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];
149
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);
158 return dstArray;
159 }, "~A");
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]);
173 }
174 } else {
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);
182 });