a9f0c6907cf1e0677a3e07e4a506e49eec888dfd
[jalviewjs.git] / site / j2s / java / text / DecimalFormatSymbols.js
1 Clazz.declarePackage ("java.text");\r
2 Clazz.load (["java.util.Hashtable"], "java.text.DecimalFormatSymbols", ["java.lang.InternalError", "$.NullPointerException", "java.util.Locale", "jssun.util.resources.LocaleData"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.zeroDigit = '\0';\r
5 this.groupingSeparator = '\0';\r
6 this.decimalSeparator = '\0';\r
7 this.perMill = '\0';\r
8 this.percent = '\0';\r
9 this.digit = '\0';\r
10 this.patternSeparator = '\0';\r
11 this.infinity = null;\r
12 this.NaN = null;\r
13 this.minusSign = '\0';\r
14 this.currencySymbol = null;\r
15 this.intlCurrencySymbol = null;\r
16 this.monetarySeparator = '\0';\r
17 this.exponential = '\0';\r
18 this.exponentialSeparator = null;\r
19 this.locale = null;\r
20 this.serialVersionOnStream = 3;\r
21 Clazz.instantialize (this, arguments);\r
22 }, java.text, "DecimalFormatSymbols", null, Cloneable);\r
23 Clazz.makeConstructor (c$, \r
24 function () {\r
25 this.initialize (java.util.Locale.getDefault ());\r
26 });\r
27 Clazz.makeConstructor (c$, \r
28 function (locale) {\r
29 this.initialize (locale);\r
30 }, "java.util.Locale");\r
31 c$.getInstance = Clazz.defineMethod (c$, "getInstance", \r
32 function () {\r
33 return java.text.DecimalFormatSymbols.getInstance (java.util.Locale.getDefault ());\r
34 });\r
35 c$.getInstance = Clazz.defineMethod (c$, "getInstance", \r
36 function (locale) {\r
37 return  new java.text.DecimalFormatSymbols (locale);\r
38 }, "java.util.Locale");\r
39 Clazz.defineMethod (c$, "getZeroDigit", \r
40 function () {\r
41 return this.zeroDigit;\r
42 });\r
43 Clazz.defineMethod (c$, "setZeroDigit", \r
44 function (zeroDigit) {\r
45 this.zeroDigit = zeroDigit;\r
46 }, "~S");\r
47 Clazz.defineMethod (c$, "getGroupingSeparator", \r
48 function () {\r
49 return this.groupingSeparator;\r
50 });\r
51 Clazz.defineMethod (c$, "setGroupingSeparator", \r
52 function (groupingSeparator) {\r
53 this.groupingSeparator = groupingSeparator;\r
54 }, "~S");\r
55 Clazz.defineMethod (c$, "getDecimalSeparator", \r
56 function () {\r
57 return this.decimalSeparator;\r
58 });\r
59 Clazz.defineMethod (c$, "setDecimalSeparator", \r
60 function (decimalSeparator) {\r
61 this.decimalSeparator = decimalSeparator;\r
62 }, "~S");\r
63 Clazz.defineMethod (c$, "getPerMill", \r
64 function () {\r
65 return this.perMill;\r
66 });\r
67 Clazz.defineMethod (c$, "setPerMill", \r
68 function (perMill) {\r
69 this.perMill = perMill;\r
70 }, "~S");\r
71 Clazz.defineMethod (c$, "getPercent", \r
72 function () {\r
73 return this.percent;\r
74 });\r
75 Clazz.defineMethod (c$, "setPercent", \r
76 function (percent) {\r
77 this.percent = percent;\r
78 }, "~S");\r
79 Clazz.defineMethod (c$, "getDigit", \r
80 function () {\r
81 return this.digit;\r
82 });\r
83 Clazz.defineMethod (c$, "setDigit", \r
84 function (digit) {\r
85 this.digit = digit;\r
86 }, "~S");\r
87 Clazz.defineMethod (c$, "getPatternSeparator", \r
88 function () {\r
89 return this.patternSeparator;\r
90 });\r
91 Clazz.defineMethod (c$, "setPatternSeparator", \r
92 function (patternSeparator) {\r
93 this.patternSeparator = patternSeparator;\r
94 }, "~S");\r
95 Clazz.defineMethod (c$, "getInfinity", \r
96 function () {\r
97 return this.infinity;\r
98 });\r
99 Clazz.defineMethod (c$, "setInfinity", \r
100 function (infinity) {\r
101 this.infinity = infinity;\r
102 }, "~S");\r
103 Clazz.defineMethod (c$, "getNaN", \r
104 function () {\r
105 return this.NaN;\r
106 });\r
107 Clazz.defineMethod (c$, "setNaN", \r
108 function (NaN) {\r
109 this.NaN = NaN;\r
110 }, "~S");\r
111 Clazz.defineMethod (c$, "getMinusSign", \r
112 function () {\r
113 return this.minusSign;\r
114 });\r
115 Clazz.defineMethod (c$, "setMinusSign", \r
116 function (minusSign) {\r
117 this.minusSign = minusSign;\r
118 }, "~S");\r
119 Clazz.defineMethod (c$, "getCurrencySymbol", \r
120 function () {\r
121 return this.currencySymbol;\r
122 });\r
123 Clazz.defineMethod (c$, "setCurrencySymbol", \r
124 function (currency) {\r
125 this.currencySymbol = currency;\r
126 }, "~S");\r
127 Clazz.defineMethod (c$, "getInternationalCurrencySymbol", \r
128 function () {\r
129 return this.intlCurrencySymbol;\r
130 });\r
131 Clazz.defineMethod (c$, "setInternationalCurrencySymbol", \r
132 function (currencyCode) {\r
133 this.intlCurrencySymbol = currencyCode;\r
134 }, "~S");\r
135 Clazz.defineMethod (c$, "getMonetaryDecimalSeparator", \r
136 function () {\r
137 return this.monetarySeparator;\r
138 });\r
139 Clazz.defineMethod (c$, "setMonetaryDecimalSeparator", \r
140 function (sep) {\r
141 this.monetarySeparator = sep;\r
142 }, "~S");\r
143 Clazz.defineMethod (c$, "getExponentialSymbol", \r
144 function () {\r
145 return this.exponential;\r
146 });\r
147 Clazz.defineMethod (c$, "getExponentSeparator", \r
148 function () {\r
149 return this.exponentialSeparator;\r
150 });\r
151 Clazz.defineMethod (c$, "setExponentialSymbol", \r
152 function (exp) {\r
153 this.exponential = exp;\r
154 }, "~S");\r
155 Clazz.defineMethod (c$, "setExponentSeparator", \r
156 function (exp) {\r
157 if (exp == null) {\r
158 throw  new NullPointerException ();\r
159 }this.exponentialSeparator = exp;\r
160 }, "~S");\r
161 Clazz.defineMethod (c$, "clone", \r
162 function () {\r
163 try {\r
164 return Clazz.superCall (this, java.text.DecimalFormatSymbols, "clone", []);\r
165 } catch (e) {\r
166 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {\r
167 throw  new InternalError ();\r
168 } else {\r
169 throw e;\r
170 }\r
171 }\r
172 });\r
173 Clazz.overrideMethod (c$, "equals", \r
174 function (obj) {\r
175 if (obj == null) return false;\r
176 if (this === obj) return true;\r
177 if (this.getClass () !== obj.getClass ()) return false;\r
178 var other = obj;\r
179 return (this.zeroDigit == other.zeroDigit && this.groupingSeparator == other.groupingSeparator && this.decimalSeparator == other.decimalSeparator && this.percent == other.percent && this.perMill == other.perMill && this.digit == other.digit && this.minusSign == other.minusSign && this.patternSeparator == other.patternSeparator && this.infinity.equals (other.infinity) && this.NaN.equals (other.NaN) && this.currencySymbol.equals (other.currencySymbol) && this.intlCurrencySymbol.equals (other.intlCurrencySymbol) && this.monetarySeparator == other.monetarySeparator && this.exponentialSeparator.equals (other.exponentialSeparator) && this.locale.equals (other.locale));\r
180 }, "~O");\r
181 Clazz.overrideMethod (c$, "hashCode", \r
182 function () {\r
183 var result = (this.zeroDigit).charCodeAt (0);\r
184 result = result * 37 + this.groupingSeparator.charCodeAt (0);\r
185 result = result * 37 + this.decimalSeparator.charCodeAt (0);\r
186 return result;\r
187 });\r
188 Clazz.defineMethod (c$, "initialize", \r
189  function (locale) {\r
190 this.locale = locale;\r
191 var needCacheUpdate = false;\r
192 var data = java.text.DecimalFormatSymbols.cachedLocaleData.get (locale);\r
193 if (data == null) {\r
194 data =  new Array (3);\r
195 var rb = jssun.util.resources.LocaleData.getNumberFormatData (locale);\r
196 data[0] = rb.getStringArray ("NumberElements");\r
197 needCacheUpdate = true;\r
198 }var numberElements = data[0];\r
199 this.decimalSeparator = numberElements[0].charAt (0);\r
200 this.groupingSeparator = numberElements[1].charAt (0);\r
201 this.patternSeparator = numberElements[2].charAt (0);\r
202 this.percent = numberElements[3].charAt (0);\r
203 this.zeroDigit = numberElements[4].charAt (0);\r
204 this.digit = numberElements[5].charAt (0);\r
205 this.minusSign = numberElements[6].charAt (0);\r
206 this.exponential = numberElements[7].charAt (0);\r
207 this.exponentialSeparator = numberElements[7];\r
208 this.perMill = numberElements[8].charAt (0);\r
209 this.infinity = numberElements[9];\r
210 this.NaN = numberElements[10];\r
211 this.intlCurrencySymbol = "XXX";\r
212 this.currencySymbol = "\u00A4";\r
213 this.monetarySeparator = this.decimalSeparator;\r
214 if (needCacheUpdate) {\r
215 java.text.DecimalFormatSymbols.cachedLocaleData.put (locale, data);\r
216 }}, "java.util.Locale");\r
217 Clazz.defineStatics (c$,\r
218 "currentSerialVersion", 3);\r
219 c$.cachedLocaleData = c$.prototype.cachedLocaleData =  new java.util.Hashtable (3);\r
220 });\r