Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / text / AttributedString.js
1 Clazz.declarePackage ("java.text");
2 Clazz.load (["java.util.AbstractMap", "$.Map", "java.text.AttributedCharacterIterator"], ["java.text.AttributedString", "$.AttributeEntry"], ["java.lang.IllegalArgumentException", "$.InternalError", "$.NullPointerException", "$.StringBuffer", "$.UnsupportedOperationException", "java.util.HashSet", "$.Hashtable", "$.Vector", "java.text.Annotation"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.text = null;
5 this.runArraySize = 0;
6 this.runCount = 0;
7 this.runStarts = null;
8 this.runAttributes = null;
9 this.runAttributeValues = null;
10 if (!Clazz.isClassDefined ("java.text.AttributedString.AttributedStringIterator")) {
11 java.text.AttributedString.$AttributedString$AttributedStringIterator$ ();
12 }
13 if (!Clazz.isClassDefined ("java.text.AttributedString.AttributeMap")) {
14 java.text.AttributedString.$AttributedString$AttributeMap$ ();
15 }
16 Clazz.instantialize (this, arguments);
17 }, java.text, "AttributedString");
18 Clazz.makeConstructor (c$, 
19 function (iterators) {
20 if (iterators == null) {
21 throw  new NullPointerException ("Iterators must not be null");
22 }if (iterators.length == 0) {
23 this.text = "";
24 } else {
25 var buffer =  new StringBuffer ();
26 for (var counter = 0; counter < iterators.length; counter++) {
27 this.appendContents (buffer, iterators[counter]);
28 }
29 this.text = buffer.toString ();
30 if (this.text.length > 0) {
31 var offset = 0;
32 var last = null;
33 for (var counter = 0; counter < iterators.length; counter++) {
34 var iterator = iterators[counter];
35 var start = iterator.getBeginIndex ();
36 var end = iterator.getEndIndex ();
37 var index = start;
38 while (index < end) {
39 iterator.setIndex (index);
40 var attrs = iterator.getAttributes ();
41 if (java.text.AttributedString.mapsDiffer (last, attrs)) {
42 this.setAttributes (attrs, index - start + offset);
43 }last = attrs;
44 index = iterator.getRunLimit ();
45 }
46 offset += (end - start);
47 }
48 }}}, "~A");
49 Clazz.makeConstructor (c$, 
50 function (text) {
51 if (text == null) {
52 throw  new NullPointerException ();
53 }this.text = text;
54 }, "~S");
55 Clazz.makeConstructor (c$, 
56 function (text, attributes) {
57 if (text == null || attributes == null) {
58 throw  new NullPointerException ();
59 }this.text = text;
60 if (text.length == 0) {
61 if (attributes.isEmpty ()) return;
62 throw  new IllegalArgumentException ("Can't add attribute to 0-length text");
63 }var attributeCount = attributes.size ();
64 if (attributeCount > 0) {
65 this.createRunAttributeDataVectors ();
66 var newRunAttributes =  new java.util.Vector (attributeCount);
67 var newRunAttributeValues =  new java.util.Vector (attributeCount);
68 this.runAttributes[0] = newRunAttributes;
69 this.runAttributeValues[0] = newRunAttributeValues;
70 var iterator = attributes.entrySet ().iterator ();
71 while (iterator.hasNext ()) {
72 var entry = iterator.next ();
73 newRunAttributes.addElement (entry.getKey ());
74 newRunAttributeValues.addElement (entry.getValue ());
75 }
76 }}, "~S,java.util.Map");
77 Clazz.makeConstructor (c$, 
78 function (text) {
79 this.construct (text, text.getBeginIndex (), text.getEndIndex (), null);
80 }, "java.text.AttributedCharacterIterator");
81 Clazz.makeConstructor (c$, 
82 function (text, beginIndex, endIndex) {
83 this.construct (text, beginIndex, endIndex, null);
84 }, "java.text.AttributedCharacterIterator,~N,~N");
85 Clazz.makeConstructor (c$, 
86 function (text, beginIndex, endIndex, attributes) {
87 if (text == null) {
88 throw  new NullPointerException ();
89 }var textBeginIndex = text.getBeginIndex ();
90 var textEndIndex = text.getEndIndex ();
91 if (beginIndex < textBeginIndex || endIndex > textEndIndex || beginIndex > endIndex) throw  new IllegalArgumentException ("Invalid substring range");
92 var textBuffer =  new StringBuffer ();
93 text.setIndex (beginIndex);
94 for (var c = text.current (); text.getIndex () < endIndex; c = text.next ()) textBuffer.append (c);
95
96 this.text = textBuffer.toString ();
97 if (beginIndex == endIndex) return;
98 var keys =  new java.util.HashSet ();
99 if (attributes == null) {
100 keys.addAll (text.getAllAttributeKeys ());
101 } else {
102 for (var i = 0; i < attributes.length; i++) keys.add (attributes[i]);
103
104 keys.retainAll (text.getAllAttributeKeys ());
105 }if (keys.isEmpty ()) return;
106 var itr = keys.iterator ();
107 while (itr.hasNext ()) {
108 var attributeKey = itr.next ();
109 text.setIndex (textBeginIndex);
110 while (text.getIndex () < endIndex) {
111 var start = text.getRunStart (attributeKey);
112 var limit = text.getRunLimit (attributeKey);
113 var value = text.getAttribute (attributeKey);
114 if (value != null) {
115 if (Clazz.instanceOf (value, java.text.Annotation)) {
116 if (start >= beginIndex && limit <= endIndex) {
117 this.addAttribute (attributeKey, value, start - beginIndex, limit - beginIndex);
118 } else {
119 if (limit > endIndex) break;
120 }} else {
121 if (start >= endIndex) break;
122 if (limit > beginIndex) {
123 if (start < beginIndex) start = beginIndex;
124 if (limit > endIndex) limit = endIndex;
125 if (start != limit) {
126 this.addAttribute (attributeKey, value, start - beginIndex, limit - beginIndex);
127 }}}}text.setIndex (limit);
128 }
129 }
130 }, "java.text.AttributedCharacterIterator,~N,~N,~A");
131 Clazz.defineMethod (c$, "addAttribute", 
132 function (attribute, value) {
133 if (attribute == null) {
134 throw  new NullPointerException ();
135 }var len = this.length ();
136 if (len == 0) {
137 throw  new IllegalArgumentException ("Can't add attribute to 0-length text");
138 }this.addAttributeImpl (attribute, value, 0, len);
139 }, "java.text.AttributedCharacterIterator.Attribute,~O");
140 Clazz.defineMethod (c$, "addAttribute", 
141 function (attribute, value, beginIndex, endIndex) {
142 if (attribute == null) {
143 throw  new NullPointerException ();
144 }if (beginIndex < 0 || endIndex > this.length () || beginIndex >= endIndex) {
145 throw  new IllegalArgumentException ("Invalid substring range");
146 }this.addAttributeImpl (attribute, value, beginIndex, endIndex);
147 }, "java.text.AttributedCharacterIterator.Attribute,~O,~N,~N");
148 Clazz.defineMethod (c$, "addAttributes", 
149 function (attributes, beginIndex, endIndex) {
150 if (attributes == null) {
151 throw  new NullPointerException ();
152 }if (beginIndex < 0 || endIndex > this.length () || beginIndex > endIndex) {
153 throw  new IllegalArgumentException ("Invalid substring range");
154 }if (beginIndex == endIndex) {
155 if (attributes.isEmpty ()) return;
156 throw  new IllegalArgumentException ("Can't add attribute to 0-length text");
157 }if (this.runCount == 0) {
158 this.createRunAttributeDataVectors ();
159 }var beginRunIndex = this.ensureRunBreak (beginIndex);
160 var endRunIndex = this.ensureRunBreak (endIndex);
161 var iterator = attributes.entrySet ().iterator ();
162 while (iterator.hasNext ()) {
163 var entry = iterator.next ();
164 this.addAttributeRunData (entry.getKey (), entry.getValue (), beginRunIndex, endRunIndex);
165 }
166 }, "java.util.Map,~N,~N");
167 Clazz.defineMethod (c$, "addAttributeImpl", 
168  function (attribute, value, beginIndex, endIndex) {
169 if (this.runCount == 0) {
170 this.createRunAttributeDataVectors ();
171 }var beginRunIndex = this.ensureRunBreak (beginIndex);
172 var endRunIndex = this.ensureRunBreak (endIndex);
173 this.addAttributeRunData (attribute, value, beginRunIndex, endRunIndex);
174 }, "java.text.AttributedCharacterIterator.Attribute,~O,~N,~N");
175 Clazz.defineMethod (c$, "createRunAttributeDataVectors", 
176  function () {
177 var newRunStarts =  Clazz.newIntArray (10, 0);
178 var newRunAttributes =  new Array (10);
179 var newRunAttributeValues =  new Array (10);
180 this.runStarts = newRunStarts;
181 this.runAttributes = newRunAttributes;
182 this.runAttributeValues = newRunAttributeValues;
183 this.runArraySize = 10;
184 this.runCount = 1;
185 });
186 Clazz.defineMethod (c$, "ensureRunBreak", 
187  function (offset) {
188 return this.ensureRunBreak (offset, true);
189 }, "~N");
190 Clazz.defineMethod (c$, "ensureRunBreak", 
191  function (offset, copyAttrs) {
192 if (offset == this.length ()) {
193 return this.runCount;
194 }var runIndex = 0;
195 while (runIndex < this.runCount && this.runStarts[runIndex] < offset) {
196 runIndex++;
197 }
198 if (runIndex < this.runCount && this.runStarts[runIndex] == offset) {
199 return runIndex;
200 }if (this.runCount == this.runArraySize) {
201 var newArraySize = this.runArraySize + 10;
202 var newRunStarts =  Clazz.newIntArray (newArraySize, 0);
203 var newRunAttributes =  new Array (newArraySize);
204 var newRunAttributeValues =  new Array (newArraySize);
205 for (var i = 0; i < this.runArraySize; i++) {
206 newRunStarts[i] = this.runStarts[i];
207 newRunAttributes[i] = this.runAttributes[i];
208 newRunAttributeValues[i] = this.runAttributeValues[i];
209 }
210 this.runStarts = newRunStarts;
211 this.runAttributes = newRunAttributes;
212 this.runAttributeValues = newRunAttributeValues;
213 this.runArraySize = newArraySize;
214 }var newRunAttributes = null;
215 var newRunAttributeValues = null;
216 if (copyAttrs) {
217 var oldRunAttributes = this.runAttributes[runIndex - 1];
218 var oldRunAttributeValues = this.runAttributeValues[runIndex - 1];
219 if (oldRunAttributes != null) {
220 newRunAttributes = oldRunAttributes.clone ();
221 }if (oldRunAttributeValues != null) {
222 newRunAttributeValues = oldRunAttributeValues.clone ();
223 }}this.runCount++;
224 for (var i = this.runCount - 1; i > runIndex; i--) {
225 this.runStarts[i] = this.runStarts[i - 1];
226 this.runAttributes[i] = this.runAttributes[i - 1];
227 this.runAttributeValues[i] = this.runAttributeValues[i - 1];
228 }
229 this.runStarts[runIndex] = offset;
230 this.runAttributes[runIndex] = newRunAttributes;
231 this.runAttributeValues[runIndex] = newRunAttributeValues;
232 return runIndex;
233 }, "~N,~B");
234 Clazz.defineMethod (c$, "addAttributeRunData", 
235  function (attribute, value, beginRunIndex, endRunIndex) {
236 for (var i = beginRunIndex; i < endRunIndex; i++) {
237 var keyValueIndex = -1;
238 if (this.runAttributes[i] == null) {
239 var newRunAttributes =  new java.util.Vector ();
240 var newRunAttributeValues =  new java.util.Vector ();
241 this.runAttributes[i] = newRunAttributes;
242 this.runAttributeValues[i] = newRunAttributeValues;
243 } else {
244 keyValueIndex = this.runAttributes[i].indexOf (attribute);
245 }if (keyValueIndex == -1) {
246 var oldSize = this.runAttributes[i].size ();
247 this.runAttributes[i].addElement (attribute);
248 try {
249 this.runAttributeValues[i].addElement (value);
250 } catch (e) {
251 if (Clazz.exceptionOf (e, Exception)) {
252 this.runAttributes[i].setSize (oldSize);
253 this.runAttributeValues[i].setSize (oldSize);
254 } else {
255 throw e;
256 }
257 }
258 } else {
259 this.runAttributeValues[i].set (keyValueIndex, value);
260 }}
261 }, "java.text.AttributedCharacterIterator.Attribute,~O,~N,~N");
262 Clazz.defineMethod (c$, "getIterator", 
263 function () {
264 return this.getIterator (null, 0, this.length ());
265 });
266 Clazz.defineMethod (c$, "getIterator", 
267 function (attributes) {
268 return this.getIterator (attributes, 0, this.length ());
269 }, "~A");
270 Clazz.defineMethod (c$, "getIterator", 
271 function (attributes, beginIndex, endIndex) {
272 return Clazz.innerTypeInstance (java.text.AttributedString.AttributedStringIterator, this, null, attributes, beginIndex, endIndex);
273 }, "~A,~N,~N");
274 Clazz.defineMethod (c$, "length", 
275 function () {
276 return this.text.length;
277 });
278 Clazz.defineMethod (c$, "charAt", 
279  function (index) {
280 return this.text.charAt (index);
281 }, "~N");
282 Clazz.defineMethod (c$, "getAttribute", 
283  function (attribute, runIndex) {
284 var currentRunAttributes = this.runAttributes[runIndex];
285 var currentRunAttributeValues = this.runAttributeValues[runIndex];
286 if (currentRunAttributes == null) {
287 return null;
288 }var attributeIndex = currentRunAttributes.indexOf (attribute);
289 if (attributeIndex != -1) {
290 return currentRunAttributeValues.elementAt (attributeIndex);
291 } else {
292 return null;
293 }}, "java.text.AttributedCharacterIterator.Attribute,~N");
294 Clazz.defineMethod (c$, "getAttributeCheckRange", 
295  function (attribute, runIndex, beginIndex, endIndex) {
296 var value = this.getAttribute (attribute, runIndex);
297 if (Clazz.instanceOf (value, java.text.Annotation)) {
298 if (beginIndex > 0) {
299 var currIndex = runIndex;
300 var runStart = this.runStarts[currIndex];
301 while (runStart >= beginIndex && java.text.AttributedString.valuesMatch (value, this.getAttribute (attribute, currIndex - 1))) {
302 currIndex--;
303 runStart = this.runStarts[currIndex];
304 }
305 if (runStart < beginIndex) {
306 return null;
307 }}var textLength = this.length ();
308 if (endIndex < textLength) {
309 var currIndex = runIndex;
310 var runLimit = (currIndex < this.runCount - 1) ? this.runStarts[currIndex + 1] : textLength;
311 while (runLimit <= endIndex && java.text.AttributedString.valuesMatch (value, this.getAttribute (attribute, currIndex + 1))) {
312 currIndex++;
313 runLimit = (currIndex < this.runCount - 1) ? this.runStarts[currIndex + 1] : textLength;
314 }
315 if (runLimit > endIndex) {
316 return null;
317 }}}return value;
318 }, "java.text.AttributedCharacterIterator.Attribute,~N,~N,~N");
319 Clazz.defineMethod (c$, "attributeValuesMatch", 
320  function (attributes, runIndex1, runIndex2) {
321 var iterator = attributes.iterator ();
322 while (iterator.hasNext ()) {
323 var key = iterator.next ();
324 if (!java.text.AttributedString.valuesMatch (this.getAttribute (key, runIndex1), this.getAttribute (key, runIndex2))) {
325 return false;
326 }}
327 return true;
328 }, "java.util.Set,~N,~N");
329 c$.valuesMatch = Clazz.defineMethod (c$, "valuesMatch", 
330  function (value1, value2) {
331 if (value1 == null) {
332 return value2 == null;
333 } else {
334 return value1.equals (value2);
335 }}, "~O,~O");
336 Clazz.defineMethod (c$, "appendContents", 
337  function (buf, iterator) {
338 var index = iterator.getBeginIndex ();
339 var end = iterator.getEndIndex ();
340 while (index < end) {
341 iterator.setIndex (index++);
342 buf.append (iterator.current ());
343 }
344 }, "StringBuffer,java.text.CharacterIterator");
345 Clazz.defineMethod (c$, "setAttributes", 
346  function (attrs, offset) {
347 if (this.runCount == 0) {
348 this.createRunAttributeDataVectors ();
349 }var index = this.ensureRunBreak (offset, false);
350 var size;
351 if (attrs != null && (size = attrs.size ()) > 0) {
352 var runAttrs =  new java.util.Vector (size);
353 var runValues =  new java.util.Vector (size);
354 var iterator = attrs.entrySet ().iterator ();
355 while (iterator.hasNext ()) {
356 var entry = iterator.next ();
357 runAttrs.add (entry.getKey ());
358 runValues.add (entry.getValue ());
359 }
360 this.runAttributes[index] = runAttrs;
361 this.runAttributeValues[index] = runValues;
362 }}, "java.util.Map,~N");
363 c$.mapsDiffer = Clazz.defineMethod (c$, "mapsDiffer", 
364  function (last, attrs) {
365 if (last == null) {
366 return (attrs != null && attrs.size () > 0);
367 }return (!last.equals (attrs));
368 }, "java.util.Map,java.util.Map");
369 c$.$AttributedString$AttributedStringIterator$ = function () {
370 Clazz.pu$h(self.c$);
371 c$ = Clazz.decorateAsClass (function () {
372 Clazz.prepareCallback (this, arguments);
373 this.beginIndex = 0;
374 this.endIndex = 0;
375 this.currentIndex = 0;
376 this.currentRunIndex = 0;
377 this.currentRunStart = 0;
378 this.currentRunLimit = 0;
379 Clazz.instantialize (this, arguments);
380 }, java.text.AttributedString, "AttributedStringIterator", null, java.text.AttributedCharacterIterator);
381 Clazz.makeConstructor (c$, 
382 function (a, b, c) {
383 if (b < 0 || b > c || c > this.b$["java.text.AttributedString"].length ()) {
384 throw  new IllegalArgumentException ("Invalid substring range");
385 }this.beginIndex = b;
386 this.endIndex = c;
387 this.currentIndex = b;
388 this.updateRunInfo ();
389 }, "~A,~N,~N");
390 Clazz.overrideMethod (c$, "equals", 
391 function (a) {
392 if (this === a) {
393 return true;
394 }if (!(Clazz.instanceOf (a, java.text.AttributedString.AttributedStringIterator))) {
395 return false;
396 }var b = a;
397 if (this.b$["java.text.AttributedString"] !== b.getString ()) return false;
398 if (this.currentIndex != b.currentIndex || this.beginIndex != b.beginIndex || this.endIndex != b.endIndex) return false;
399 return true;
400 }, "~O");
401 Clazz.overrideMethod (c$, "hashCode", 
402 function () {
403 return this.b$["java.text.AttributedString"].text.hashCode () ^ this.currentIndex ^ this.beginIndex ^ this.endIndex;
404 });
405 Clazz.overrideMethod (c$, "clone", 
406 function () {
407 try {
408 var a = Clazz.superCall (this, java.text.AttributedString.AttributedStringIterator, "clone", []);
409 return a;
410 } catch (e) {
411 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
412 throw  new InternalError ();
413 } else {
414 throw e;
415 }
416 }
417 });
418 Clazz.overrideMethod (c$, "first", 
419 function () {
420 return this.internalSetIndex (this.beginIndex);
421 });
422 Clazz.overrideMethod (c$, "last", 
423 function () {
424 if (this.endIndex == this.beginIndex) {
425 return this.internalSetIndex (this.endIndex);
426 } else {
427 return this.internalSetIndex (this.endIndex - 1);
428 }});
429 Clazz.overrideMethod (c$, "current", 
430 function () {
431 if (this.currentIndex == this.endIndex) {
432 return '\uffff';
433 } else {
434 return this.b$["java.text.AttributedString"].charAt (this.currentIndex);
435 }});
436 Clazz.overrideMethod (c$, "next", 
437 function () {
438 if (this.currentIndex < this.endIndex) {
439 return this.internalSetIndex (this.currentIndex + 1);
440 } else {
441 return '\uffff';
442 }});
443 Clazz.overrideMethod (c$, "previous", 
444 function () {
445 if (this.currentIndex > this.beginIndex) {
446 return this.internalSetIndex (this.currentIndex - 1);
447 } else {
448 return '\uffff';
449 }});
450 Clazz.overrideMethod (c$, "setIndex", 
451 function (a) {
452 if (a < this.beginIndex || a > this.endIndex) throw  new IllegalArgumentException ("Invalid index");
453 return this.internalSetIndex (a);
454 }, "~N");
455 Clazz.overrideMethod (c$, "getBeginIndex", 
456 function () {
457 return this.beginIndex;
458 });
459 Clazz.overrideMethod (c$, "getEndIndex", 
460 function () {
461 return this.endIndex;
462 });
463 Clazz.overrideMethod (c$, "getIndex", 
464 function () {
465 return this.currentIndex;
466 });
467 Clazz.defineMethod (c$, "getRunStart", 
468 function () {
469 return this.currentRunStart;
470 });
471 Clazz.defineMethod (c$, "getRunStart", 
472 function (a) {
473 if (this.currentRunStart == this.beginIndex || this.currentRunIndex == -1) {
474 return this.currentRunStart;
475 } else {
476 var b = this.getAttribute (a);
477 var c = this.currentRunStart;
478 var d = this.currentRunIndex;
479 while (c > this.beginIndex && java.text.AttributedString.valuesMatch (b, this.b$["java.text.AttributedString"].getAttribute (a, d - 1))) {
480 d--;
481 c = this.b$["java.text.AttributedString"].runStarts[d];
482 }
483 if (c < this.beginIndex) {
484 c = this.beginIndex;
485 }return c;
486 }}, "java.text.AttributedCharacterIterator.Attribute");
487 Clazz.defineMethod (c$, "getRunStart", 
488 function (a) {
489 if (this.currentRunStart == this.beginIndex || this.currentRunIndex == -1) {
490 return this.currentRunStart;
491 } else {
492 var b = this.currentRunStart;
493 var c = this.currentRunIndex;
494 while (b > this.beginIndex && this.b$["java.text.AttributedString"].attributeValuesMatch (a, this.currentRunIndex, c - 1)) {
495 c--;
496 b = this.b$["java.text.AttributedString"].runStarts[c];
497 }
498 if (b < this.beginIndex) {
499 b = this.beginIndex;
500 }return b;
501 }}, "java.util.Set");
502 Clazz.defineMethod (c$, "getRunLimit", 
503 function () {
504 return this.currentRunLimit;
505 });
506 Clazz.defineMethod (c$, "getRunLimit", 
507 function (a) {
508 if (this.currentRunLimit == this.endIndex || this.currentRunIndex == -1) {
509 return this.currentRunLimit;
510 } else {
511 var b = this.getAttribute (a);
512 var c = this.currentRunLimit;
513 var d = this.currentRunIndex;
514 while (c < this.endIndex && java.text.AttributedString.valuesMatch (b, this.b$["java.text.AttributedString"].getAttribute (a, d + 1))) {
515 d++;
516 c = d < this.b$["java.text.AttributedString"].runCount - 1 ? this.b$["java.text.AttributedString"].runStarts[d + 1] : this.endIndex;
517 }
518 if (c > this.endIndex) {
519 c = this.endIndex;
520 }return c;
521 }}, "java.text.AttributedCharacterIterator.Attribute");
522 Clazz.defineMethod (c$, "getRunLimit", 
523 function (a) {
524 if (this.currentRunLimit == this.endIndex || this.currentRunIndex == -1) {
525 return this.currentRunLimit;
526 } else {
527 var b = this.currentRunLimit;
528 var c = this.currentRunIndex;
529 while (b < this.endIndex && this.b$["java.text.AttributedString"].attributeValuesMatch (a, this.currentRunIndex, c + 1)) {
530 c++;
531 b = c < this.b$["java.text.AttributedString"].runCount - 1 ? this.b$["java.text.AttributedString"].runStarts[c + 1] : this.endIndex;
532 }
533 if (b > this.endIndex) {
534 b = this.endIndex;
535 }return b;
536 }}, "java.util.Set");
537 Clazz.overrideMethod (c$, "getAttributes", 
538 function () {
539 if (this.b$["java.text.AttributedString"].runAttributes == null || this.currentRunIndex == -1 || this.b$["java.text.AttributedString"].runAttributes[this.currentRunIndex] == null) {
540 return  new java.util.Hashtable ();
541 }return Clazz.innerTypeInstance (java.text.AttributedString.AttributeMap, this, null, this.currentRunIndex, this.beginIndex, this.endIndex);
542 });
543 Clazz.overrideMethod (c$, "getAllAttributeKeys", 
544 function () {
545 if (this.b$["java.text.AttributedString"].runAttributes == null) {
546 return  new java.util.HashSet ();
547 }{
548 var a =  new java.util.HashSet ();
549 var b = 0;
550 while (b < this.b$["java.text.AttributedString"].runCount) {
551 if (this.b$["java.text.AttributedString"].runStarts[b] < this.endIndex && (b == this.b$["java.text.AttributedString"].runCount - 1 || this.b$["java.text.AttributedString"].runStarts[b + 1] > this.beginIndex)) {
552 var c = this.b$["java.text.AttributedString"].runAttributes[b];
553 if (c != null) {
554 var d = c.size ();
555 while (d-- > 0) {
556 a.add (c.get (d));
557 }
558 }}b++;
559 }
560 return a;
561 }});
562 Clazz.overrideMethod (c$, "getAttribute", 
563 function (a) {
564 var b = this.currentRunIndex;
565 if (b < 0) {
566 return null;
567 }return this.b$["java.text.AttributedString"].getAttributeCheckRange (a, b, this.beginIndex, this.endIndex);
568 }, "java.text.AttributedCharacterIterator.Attribute");
569 Clazz.defineMethod (c$, "getString", 
570  function () {
571 return this.b$["java.text.AttributedString"];
572 });
573 Clazz.defineMethod (c$, "internalSetIndex", 
574  function (a) {
575 this.currentIndex = a;
576 if (a < this.currentRunStart || a >= this.currentRunLimit) {
577 this.updateRunInfo ();
578 }if (this.currentIndex == this.endIndex) {
579 return '\uffff';
580 } else {
581 return this.b$["java.text.AttributedString"].charAt (a);
582 }}, "~N");
583 Clazz.defineMethod (c$, "updateRunInfo", 
584  function () {
585 if (this.currentIndex == this.endIndex) {
586 this.currentRunStart = this.currentRunLimit = this.endIndex;
587 this.currentRunIndex = -1;
588 } else {
589 {
590 var a = -1;
591 while (a < this.b$["java.text.AttributedString"].runCount - 1 && this.b$["java.text.AttributedString"].runStarts[a + 1] <= this.currentIndex) a++;
592
593 this.currentRunIndex = a;
594 if (a >= 0) {
595 this.currentRunStart = this.b$["java.text.AttributedString"].runStarts[a];
596 if (this.currentRunStart < this.beginIndex) this.currentRunStart = this.beginIndex;
597 } else {
598 this.currentRunStart = this.beginIndex;
599 }if (a < this.b$["java.text.AttributedString"].runCount - 1) {
600 this.currentRunLimit = this.b$["java.text.AttributedString"].runStarts[a + 1];
601 if (this.currentRunLimit > this.endIndex) this.currentRunLimit = this.endIndex;
602 } else {
603 this.currentRunLimit = this.endIndex;
604 }}}});
605 c$ = Clazz.p0p ();
606 };
607 c$.$AttributedString$AttributeMap$ = function () {
608 Clazz.pu$h(self.c$);
609 c$ = Clazz.decorateAsClass (function () {
610 Clazz.prepareCallback (this, arguments);
611 this.runIndex = 0;
612 this.beginIndex = 0;
613 this.endIndex = 0;
614 Clazz.instantialize (this, arguments);
615 }, java.text.AttributedString, "AttributeMap", java.util.AbstractMap);
616 Clazz.makeConstructor (c$, 
617 function (a, b, c) {
618 Clazz.superConstructor (this, java.text.AttributedString.AttributeMap, []);
619 this.runIndex = a;
620 this.beginIndex = b;
621 this.endIndex = c;
622 }, "~N,~N,~N");
623 Clazz.overrideMethod (c$, "entrySet", 
624 function () {
625 var a =  new java.util.HashSet ();
626 {
627 var b = this.b$["java.text.AttributedString"].runAttributes[this.runIndex].size ();
628 for (var c = 0; c < b; c++) {
629 var d = this.b$["java.text.AttributedString"].runAttributes[this.runIndex].get (c);
630 var e = this.b$["java.text.AttributedString"].runAttributeValues[this.runIndex].get (c);
631 if (Clazz.instanceOf (e, java.text.Annotation)) {
632 e = this.b$["java.text.AttributedString"].getAttributeCheckRange (d, this.runIndex, this.beginIndex, this.endIndex);
633 if (e == null) {
634 continue;
635 }}var f =  new java.text.AttributeEntry (d, e);
636 a.add (f);
637 }
638 }return a;
639 });
640 Clazz.overrideMethod (c$, "get", 
641 function (a) {
642 return this.b$["java.text.AttributedString"].getAttributeCheckRange (a, this.runIndex, this.beginIndex, this.endIndex);
643 }, "~O");
644 c$ = Clazz.p0p ();
645 };
646 Clazz.defineStatics (c$,
647 "ARRAY_SIZE_INCREMENT", 10);
648 c$ = Clazz.decorateAsClass (function () {
649 this.key = null;
650 this.value = null;
651 Clazz.instantialize (this, arguments);
652 }, java.text, "AttributeEntry", null, java.util.Map.Entry);
653 Clazz.makeConstructor (c$, 
654 function (key, value) {
655 this.key = key;
656 this.value = value;
657 }, "java.text.AttributedCharacterIterator.Attribute,~O");
658 Clazz.overrideMethod (c$, "equals", 
659 function (o) {
660 if (!(Clazz.instanceOf (o, java.text.AttributeEntry))) {
661 return false;
662 }var other = o;
663 return other.key.equals (this.key) && (this.value == null ? other.value == null : other.value.equals (this.value));
664 }, "~O");
665 Clazz.overrideMethod (c$, "getKey", 
666 function () {
667 return this.key;
668 });
669 Clazz.overrideMethod (c$, "getValue", 
670 function () {
671 return this.value;
672 });
673 Clazz.overrideMethod (c$, "setValue", 
674 function (newValue) {
675 throw  new UnsupportedOperationException ();
676 }, "~O");
677 Clazz.overrideMethod (c$, "hashCode", 
678 function () {
679 return this.key.hashCode () ^ (this.value == null ? 0 : this.value.hashCode ());
680 });
681 Clazz.defineMethod (c$, "toString", 
682 function () {
683 return this.key.toString () + "=" + this.value.toString ();
684 });
685 });