JAL-1807 - Bob's last(?) before leaving Dundee -- adds fast file loading
[jalviewjs.git] / site / j2s / java / util / TreeMap.js
1 Clazz.load(["java.util.AbstractCollection","$.AbstractMap","$.AbstractSet","$.Iterator","$.MapEntry","$.Set","$.SortedMap"],"java.util.TreeMap",["java.lang.IllegalArgumentException","$.IllegalStateException","java.util.ConcurrentModificationException","$.NoSuchElementException"],function(){
2 c$=Clazz.decorateAsClass(function(){
3 this.$size=0;
4 this.root=null;
5 this.$comparator=null;
6 this.modCount=0;
7 this.$entrySet=null;
8 Clazz.instantialize(this,arguments);
9 },java.util,"TreeMap",java.util.AbstractMap,[java.util.SortedMap,Cloneable,java.io.Serializable]);
10 c$.toComparable=Clazz.defineMethod(c$,"toComparable",
11 ($fz=function(obj){
12 return obj;
13 },$fz.isPrivate=true,$fz),"~O");
14 Clazz.makeConstructor(c$,
15 function(comparator){
16 Clazz.superConstructor(this,java.util.TreeMap,[]);
17 this.$comparator=comparator;
18 },"java.util.Comparator");
19 Clazz.makeConstructor(c$,
20 function(map){
21 this.construct();
22 this.putAll(map);
23 },"java.util.Map");
24 Clazz.makeConstructor(c$,
25 function(map){
26 this.construct(map.comparator());
27 var it=map.entrySet().iterator();
28 if(it.hasNext()){
29 var entry=it.next();
30 var last=new java.util.TreeMap.Entry(entry.getKey(),entry.getValue());
31 this.root=last;
32 this.$size=1;
33 while(it.hasNext()){
34 entry=it.next();
35 var x=new java.util.TreeMap.Entry(entry.getKey(),entry.getValue());
36 x.parent=last;
37 last.right=x;
38 this.$size++;
39 this.balance(x);
40 last=x;
41 }
42 }},"java.util.SortedMap");
43 Clazz.defineMethod(c$,"balance",
44 function(x){
45 var y;
46 x.color=true;
47 while(x!==this.root&&x.parent.color){
48 if(x.parent===x.parent.parent.left){
49 y=x.parent.parent.right;
50 if(y!=null&&y.color){
51 x.parent.color=false;
52 y.color=false;
53 x.parent.parent.color=true;
54 x=x.parent.parent;
55 }else{
56 if(x===x.parent.right){
57 x=x.parent;
58 this.leftRotate(x);
59 }x.parent.color=false;
60 x.parent.parent.color=true;
61 this.rightRotate(x.parent.parent);
62 }}else{
63 y=x.parent.parent.left;
64 if(y!=null&&y.color){
65 x.parent.color=false;
66 y.color=false;
67 x.parent.parent.color=true;
68 x=x.parent.parent;
69 }else{
70 if(x===x.parent.left){
71 x=x.parent;
72 this.rightRotate(x);
73 }x.parent.color=false;
74 x.parent.parent.color=true;
75 this.leftRotate(x.parent.parent);
76 }}}
77 this.root.color=false;
78 },"java.util.TreeMap.Entry");
79 Clazz.overrideMethod(c$,"clear",
80 function(){
81 this.root=null;
82 this.$size=0;
83 this.modCount++;
84 });
85 Clazz.defineMethod(c$,"clone",
86 function(){
87 try{
88 var clone=Clazz.superCall(this,java.util.TreeMap,"clone",[]);
89 clone.$entrySet=null;
90 if(this.root!=null){
91 clone.root=this.root.clone(null);
92 }return clone;
93 }catch(e){
94 if(Clazz.instanceOf(e,CloneNotSupportedException)){
95 return null;
96 }else{
97 throw e;
98 }
99 }
100 });
101 Clazz.overrideMethod(c$,"comparator",
102 function(){
103 return this.$comparator;
104 });
105 Clazz.overrideMethod(c$,"containsKey",
106 function(key){
107 return this.find(key)!=null;
108 },"~O");
109 Clazz.defineMethod(c$,"containsValue",
110 function(value){
111 if(this.root!=null){
112 return this.containsValue(this.root,value);
113 }return false;
114 },"~O");
115 Clazz.defineMethod(c$,"containsValue",
116 ($fz=function(node,value){
117 if(value==null?node.value==null:value.equals(node.value)){
118 return true;
119 }if(node.left!=null){
120 if(this.containsValue(node.left,value)){
121 return true;
122 }}if(node.right!=null){
123 if(this.containsValue(node.right,value)){
124 return true;
125 }}return false;
126 },$fz.isPrivate=true,$fz),"java.util.TreeMap.Entry,~O");
127 Clazz.overrideMethod(c$,"entrySet",
128 function(){
129 if(this.$entrySet==null){
130 this.$entrySet=((Clazz.isClassDefined("java.util.TreeMap$1")?0:java.util.TreeMap.$TreeMap$1$()),Clazz.innerTypeInstance(java.util.TreeMap$1,this,null));
131 }return this.$entrySet;
132 });
133 Clazz.defineMethod(c$,"find",
134 ($fz=function(keyObj){
135 var result;
136 var key=keyObj;
137 var object=null;
138 if(this.$comparator==null){
139 object=java.util.TreeMap.toComparable(key);
140 }var x=this.root;
141 while(x!=null){
142 result=object!=null?object.compareTo(x.key):this.$comparator.compare(key,x.key);
143 if(result==0){
144 return x;
145 }x=result<0?x.left:x.right;
146 }
147 return null;
148 },$fz.isPrivate=true,$fz),"~O");
149 Clazz.defineMethod(c$,"findAfter",
150 function(keyObj){
151 var key=keyObj;
152 var result;
153 var object=null;
154 if(this.$comparator==null){
155 object=java.util.TreeMap.toComparable(key);
156 }var x=this.root;
157 var last=null;
158 while(x!=null){
159 result=object!=null?object.compareTo(x.key):this.$comparator.compare(key,x.key);
160 if(result==0){
161 return x;
162 }if(result<0){
163 last=x;
164 x=x.left;
165 }else{
166 x=x.right;
167 }}
168 return last;
169 },"~O");
170 Clazz.defineMethod(c$,"findBefore",
171 function(key){
172 var result;
173 var object=null;
174 if(this.$comparator==null){
175 object=java.util.TreeMap.toComparable(key);
176 }var x=this.root;
177 var last=null;
178 while(x!=null){
179 result=object!=null?object.compareTo(x.key):this.$comparator.compare(key,x.key);
180 if(result<=0){
181 x=x.left;
182 }else{
183 last=x;
184 x=x.right;
185 }}
186 return last;
187 },"~O");
188 Clazz.overrideMethod(c$,"firstKey",
189 function(){
190 if(this.root!=null){
191 return java.util.TreeMap.minimum(this.root).key;
192 }throw new java.util.NoSuchElementException();
193 });
194 Clazz.defineMethod(c$,"fixup",
195 ($fz=function(x){
196 var w;
197 while(x!==this.root&&!x.color){
198 if(x===x.parent.left){
199 w=x.parent.right;
200 if(w==null){
201 x=x.parent;
202 continue;}if(w.color){
203 w.color=false;
204 x.parent.color=true;
205 this.leftRotate(x.parent);
206 w=x.parent.right;
207 if(w==null){
208 x=x.parent;
209 continue;}}if((w.left==null||!w.left.color)&&(w.right==null||!w.right.color)){
210 w.color=true;
211 x=x.parent;
212 }else{
213 if(w.right==null||!w.right.color){
214 w.left.color=false;
215 w.color=true;
216 this.rightRotate(w);
217 w=x.parent.right;
218 }w.color=x.parent.color;
219 x.parent.color=false;
220 w.right.color=false;
221 this.leftRotate(x.parent);
222 x=this.root;
223 }}else{
224 w=x.parent.left;
225 if(w==null){
226 x=x.parent;
227 continue;}if(w.color){
228 w.color=false;
229 x.parent.color=true;
230 this.rightRotate(x.parent);
231 w=x.parent.left;
232 if(w==null){
233 x=x.parent;
234 continue;}}if((w.left==null||!w.left.color)&&(w.right==null||!w.right.color)){
235 w.color=true;
236 x=x.parent;
237 }else{
238 if(w.left==null||!w.left.color){
239 w.right.color=false;
240 w.color=true;
241 this.leftRotate(w);
242 w=x.parent.left;
243 }w.color=x.parent.color;
244 x.parent.color=false;
245 w.left.color=false;
246 this.rightRotate(x.parent);
247 x=this.root;
248 }}}
249 x.color=false;
250 },$fz.isPrivate=true,$fz),"java.util.TreeMap.Entry");
251 Clazz.overrideMethod(c$,"get",
252 function(key){
253 var node=this.find(key);
254 if(node!=null){
255 return node.value;
256 }return null;
257 },"~O");
258 Clazz.overrideMethod(c$,"headMap",
259 function(endKey){
260 if(this.$comparator==null){
261 java.util.TreeMap.toComparable(endKey).compareTo(endKey);
262 }else{
263 this.$comparator.compare(endKey,endKey);
264 }return new java.util.TreeMap.SubMap(this,endKey);
265 },"~O");
266 Clazz.overrideMethod(c$,"keySet",
267 function(){
268 if(this.$keySet==null){
269 this.$keySet=((Clazz.isClassDefined("java.util.TreeMap$2")?0:java.util.TreeMap.$TreeMap$2$()),Clazz.innerTypeInstance(java.util.TreeMap$2,this,null));
270 }return this.$keySet;
271 });
272 Clazz.overrideMethod(c$,"lastKey",
273 function(){
274 if(this.root!=null){
275 return java.util.TreeMap.maximum(this.root).key;
276 }throw new java.util.NoSuchElementException();
277 });
278 Clazz.defineMethod(c$,"leftRotate",
279 ($fz=function(x){
280 var y=x.right;
281 x.right=y.left;
282 if(y.left!=null){
283 y.left.parent=x;
284 }y.parent=x.parent;
285 if(x.parent==null){
286 this.root=y;
287 }else{
288 if(x===x.parent.left){
289 x.parent.left=y;
290 }else{
291 x.parent.right=y;
292 }}y.left=x;
293 x.parent=y;
294 },$fz.isPrivate=true,$fz),"java.util.TreeMap.Entry");
295 c$.maximum=Clazz.defineMethod(c$,"maximum",
296 function(x){
297 while(x.right!=null){
298 x=x.right;
299 }
300 return x;
301 },"java.util.TreeMap.Entry");
302 c$.minimum=Clazz.defineMethod(c$,"minimum",
303 function(x){
304 while(x.left!=null){
305 x=x.left;
306 }
307 return x;
308 },"java.util.TreeMap.Entry");
309 c$.predecessor=Clazz.defineMethod(c$,"predecessor",
310 function(x){
311 if(x.left!=null){
312 return java.util.TreeMap.maximum(x.left);
313 }var y=x.parent;
314 while(y!=null&&x===y.left){
315 x=y;
316 y=y.parent;
317 }
318 return y;
319 },"java.util.TreeMap.Entry");
320 Clazz.overrideMethod(c$,"put",
321 function(key,value){
322 var entry=this.rbInsert(key);
323 var result=entry.value;
324 entry.value=value;
325 return result;
326 },"~O,~O");
327 Clazz.defineMethod(c$,"rbDelete",
328 function(z){
329 var y=z.left==null||z.right==null?z:java.util.TreeMap.successor(z);
330 var x=y.left!=null?y.left:y.right;
331 if(x!=null){
332 x.parent=y.parent;
333 }if(y.parent==null){
334 this.root=x;
335 }else if(y===y.parent.left){
336 y.parent.left=x;
337 }else{
338 y.parent.right=x;
339 }this.modCount++;
340 if(y!==z){
341 z.key=y.key;
342 z.value=y.value;
343 }if(!y.color&&this.root!=null){
344 if(x==null){
345 this.fixup(y.parent);
346 }else{
347 this.fixup(x);
348 }}this.$size--;
349 },"java.util.TreeMap.Entry");
350 Clazz.defineMethod(c$,"rbInsert",
351 ($fz=function(object){
352 var result=0;
353 var y=null;
354 if(this.$size!=0){
355 var key=null;
356 if(this.$comparator==null){
357 key=java.util.TreeMap.toComparable(object);
358 }var x=this.root;
359 while(x!=null){
360 y=x;
361 result=key!=null?key.compareTo(x.key):this.$comparator.compare(object,x.key);
362 if(result==0){
363 return x;
364 }x=result<0?x.left:x.right;
365 }
366 }this.$size++;
367 this.modCount++;
368 var z=new java.util.TreeMap.Entry(object);
369 if(y==null){
370 return this.root=z;
371 }z.parent=y;
372 if(result<0){
373 y.left=z;
374 }else{
375 y.right=z;
376 }this.balance(z);
377 return z;
378 },$fz.isPrivate=true,$fz),"~O");
379 Clazz.overrideMethod(c$,"remove",
380 function(key){
381 var node=this.find(key);
382 if(node==null){
383 return null;
384 }var result=node.value;
385 this.rbDelete(node);
386 return result;
387 },"~O");
388 Clazz.defineMethod(c$,"rightRotate",
389 ($fz=function(x){
390 var y=x.left;
391 x.left=y.right;
392 if(y.right!=null){
393 y.right.parent=x;
394 }y.parent=x.parent;
395 if(x.parent==null){
396 this.root=y;
397 }else{
398 if(x===x.parent.right){
399 x.parent.right=y;
400 }else{
401 x.parent.left=y;
402 }}y.right=x;
403 x.parent=y;
404 },$fz.isPrivate=true,$fz),"java.util.TreeMap.Entry");
405 Clazz.overrideMethod(c$,"size",
406 function(){
407 return this.$size;
408 });
409 Clazz.overrideMethod(c$,"subMap",
410 function(startKey,endKey){
411 if(this.$comparator==null){
412 if(java.util.TreeMap.toComparable(startKey).compareTo(endKey)<=0){
413 return new java.util.TreeMap.SubMap(startKey,this,endKey);
414 }}else{
415 if(this.$comparator.compare(startKey,endKey)<=0){
416 return new java.util.TreeMap.SubMap(startKey,this,endKey);
417 }}throw new IllegalArgumentException();
418 },"~O,~O");
419 c$.successor=Clazz.defineMethod(c$,"successor",
420 function(x){
421 if(x.right!=null){
422 return java.util.TreeMap.minimum(x.right);
423 }var y=x.parent;
424 while(y!=null&&x===y.right){
425 x=y;
426 y=y.parent;
427 }
428 return y;
429 },"java.util.TreeMap.Entry");
430 Clazz.overrideMethod(c$,"tailMap",
431 function(startKey){
432 if(this.$comparator==null){
433 java.util.TreeMap.toComparable(startKey).compareTo(startKey);
434 }else{
435 this.$comparator.compare(startKey,startKey);
436 }return new java.util.TreeMap.SubMap(startKey,this);
437 },"~O");
438 Clazz.overrideMethod(c$,"values",
439 function(){
440 if(this.valuesCollection==null){
441 this.valuesCollection=((Clazz.isClassDefined("java.util.TreeMap$3")?0:java.util.TreeMap.$TreeMap$3$()),Clazz.innerTypeInstance(java.util.TreeMap$3,this,null));
442 }return this.valuesCollection;
443 });
444 c$.$TreeMap$1$=function(){
445 Clazz.pu$h(self.c$);
446 c$=Clazz.declareAnonymous(java.util,"TreeMap$1",java.util.AbstractSet);
447 Clazz.overrideMethod(c$,"size",
448 function(){
449 return this.b$["java.util.TreeMap"].$size;
450 });
451 Clazz.overrideMethod(c$,"clear",
452 function(){
453 this.b$["java.util.TreeMap"].clear();
454 });
455 Clazz.overrideMethod(c$,"contains",
456 function(object){
457 if(Clazz.instanceOf(object,java.util.Map.Entry)){
458 var entry=object;
459 var v1=this.b$["java.util.TreeMap"].get(entry.getKey());
460 var v2=entry.getValue();
461 return v1==null?v2==null:v1.equals(v2);
462 }return false;
463 },"~O");
464 Clazz.defineMethod(c$,"iterator",
465 function(){
466 return new java.util.TreeMap.UnboundedEntryIterator(this.b$["java.util.TreeMap"]);
467 });
468 c$=Clazz.p0p();
469 };
470 c$.$TreeMap$2$=function(){
471 Clazz.pu$h(self.c$);
472 c$=Clazz.declareAnonymous(java.util,"TreeMap$2",java.util.AbstractSet);
473 Clazz.overrideMethod(c$,"contains",
474 function(object){
475 return this.b$["java.util.TreeMap"].containsKey(object);
476 },"~O");
477 Clazz.overrideMethod(c$,"size",
478 function(){
479 return this.b$["java.util.TreeMap"].$size;
480 });
481 Clazz.overrideMethod(c$,"clear",
482 function(){
483 this.b$["java.util.TreeMap"].clear();
484 });
485 Clazz.overrideMethod(c$,"iterator",
486 function(){
487 return new java.util.TreeMap.UnboundedKeyIterator(this.b$["java.util.TreeMap"]);
488 });
489 c$=Clazz.p0p();
490 };
491 c$.$TreeMap$3$=function(){
492 Clazz.pu$h(self.c$);
493 c$=Clazz.declareAnonymous(java.util,"TreeMap$3",java.util.AbstractCollection);
494 Clazz.overrideMethod(c$,"contains",
495 function(object){
496 return this.b$["java.util.TreeMap"].containsValue(object);
497 },"~O");
498 Clazz.overrideMethod(c$,"size",
499 function(){
500 return this.b$["java.util.TreeMap"].$size;
501 });
502 Clazz.overrideMethod(c$,"clear",
503 function(){
504 this.b$["java.util.TreeMap"].clear();
505 });
506 Clazz.overrideMethod(c$,"iterator",
507 function(){
508 return new java.util.TreeMap.UnboundedValueIterator(this.b$["java.util.TreeMap"]);
509 });
510 c$=Clazz.p0p();
511 };
512 Clazz.pu$h(self.c$);
513 c$=Clazz.decorateAsClass(function(){
514 this.parent=null;
515 this.left=null;
516 this.right=null;
517 this.color=false;
518 Clazz.instantialize(this,arguments);
519 },java.util.TreeMap,"Entry",java.util.MapEntry);
520 Clazz.defineMethod(c$,"clone",
521 function(a){
522 var b=Clazz.superCall(this,java.util.TreeMap.Entry,"clone",[]);
523 b.parent=a;
524 if(this.left!=null){
525 b.left=this.left.clone(b);
526 }if(this.right!=null){
527 b.right=this.right.clone(b);
528 }return b;
529 },"java.util.TreeMap.Entry");
530 c$=Clazz.p0p();
531 Clazz.pu$h(self.c$);
532 c$=Clazz.decorateAsClass(function(){
533 this.backingMap=null;
534 this.expectedModCount=0;
535 this.node=null;
536 this.lastNode=null;
537 Clazz.instantialize(this,arguments);
538 },java.util.TreeMap,"AbstractMapIterator");
539 Clazz.makeConstructor(c$,
540 function(a,b){
541 this.backingMap=a;
542 this.expectedModCount=a.modCount;
543 this.node=b;
544 },"java.util.TreeMap,java.util.TreeMap.Entry");
545 Clazz.defineMethod(c$,"hasNext",
546 function(){
547 return this.node!=null;
548 });
549 Clazz.defineMethod(c$,"remove",
550 function(){
551 if(this.expectedModCount==this.backingMap.modCount){
552 if(this.lastNode!=null){
553 this.backingMap.rbDelete(this.lastNode);
554 this.lastNode=null;
555 this.expectedModCount++;
556 }else{
557 throw new IllegalStateException();
558 }}else{
559 throw new java.util.ConcurrentModificationException();
560 }});
561 Clazz.defineMethod(c$,"makeNext",
562 function(){
563 if(this.expectedModCount!=this.backingMap.modCount){
564 throw new java.util.ConcurrentModificationException();
565 }else if(this.node==null){
566 throw new java.util.NoSuchElementException();
567 }this.lastNode=this.node;
568 this.node=java.util.TreeMap.successor(this.node);
569 });
570 c$=Clazz.p0p();
571 Clazz.pu$h(self.c$);
572 c$=Clazz.declareType(java.util.TreeMap,"UnboundedEntryIterator",java.util.TreeMap.AbstractMapIterator,java.util.Iterator);
573 Clazz.makeConstructor(c$,
574 function(a){
575 Clazz.superConstructor(this,java.util.TreeMap.UnboundedEntryIterator,[a,a.root==null?null:java.util.TreeMap.minimum(a.root)]);
576 },"java.util.TreeMap");
577 Clazz.overrideMethod(c$,"next",
578 function(){
579 this.makeNext();
580 return this.lastNode;
581 });
582 c$=Clazz.p0p();
583 Clazz.pu$h(self.c$);
584 c$=Clazz.declareType(java.util.TreeMap,"UnboundedKeyIterator",java.util.TreeMap.AbstractMapIterator,java.util.Iterator);
585 Clazz.makeConstructor(c$,
586 function(a){
587 Clazz.superConstructor(this,java.util.TreeMap.UnboundedKeyIterator,[a,a.root==null?null:java.util.TreeMap.minimum(a.root)]);
588 },"java.util.TreeMap");
589 Clazz.overrideMethod(c$,"next",
590 function(){
591 this.makeNext();
592 return this.lastNode.key;
593 });
594 c$=Clazz.p0p();
595 Clazz.pu$h(self.c$);
596 c$=Clazz.declareType(java.util.TreeMap,"UnboundedValueIterator",java.util.TreeMap.AbstractMapIterator,java.util.Iterator);
597 Clazz.makeConstructor(c$,
598 function(a){
599 Clazz.superConstructor(this,java.util.TreeMap.UnboundedValueIterator,[a,a.root==null?null:java.util.TreeMap.minimum(a.root)]);
600 },"java.util.TreeMap");
601 Clazz.overrideMethod(c$,"next",
602 function(){
603 this.makeNext();
604 return this.lastNode.value;
605 });
606 c$=Clazz.p0p();
607 Clazz.pu$h(self.c$);
608 c$=Clazz.decorateAsClass(function(){
609 this.endKey=null;
610 this.cmp=null;
611 Clazz.instantialize(this,arguments);
612 },java.util.TreeMap,"ComparatorBoundedIterator",java.util.TreeMap.AbstractMapIterator);
613 Clazz.makeConstructor(c$,
614 function(a,b,c){
615 Clazz.superConstructor(this,java.util.TreeMap.ComparatorBoundedIterator,[a,b]);
616 this.endKey=c;
617 this.cmp=a.comparator();
618 },"java.util.TreeMap,java.util.TreeMap.Entry,~O");
619 Clazz.defineMethod(c$,"cleanNext",
620 function(){
621 if(this.node!=null&&this.cmp.compare(this.endKey,this.node.key)<=0){
622 this.node=null;
623 }});
624 Clazz.overrideMethod(c$,"hasNext",
625 function(){
626 return(this.node!=null&&this.endKey!=null)&&(this.cmp.compare(this.node.key,this.endKey)<0);
627 });
628 c$=Clazz.p0p();
629 Clazz.pu$h(self.c$);
630 c$=Clazz.declareType(java.util.TreeMap,"ComparatorBoundedEntryIterator",java.util.TreeMap.ComparatorBoundedIterator,java.util.Iterator);
631 Clazz.overrideMethod(c$,"next",
632 function(){
633 this.makeNext();
634 this.cleanNext();
635 return this.lastNode;
636 });
637 c$=Clazz.p0p();
638 Clazz.pu$h(self.c$);
639 c$=Clazz.declareType(java.util.TreeMap,"ComparatorBoundedKeyIterator",java.util.TreeMap.ComparatorBoundedIterator,java.util.Iterator);
640 Clazz.overrideMethod(c$,"next",
641 function(){
642 this.makeNext();
643 this.cleanNext();
644 return this.lastNode.key;
645 });
646 c$=Clazz.p0p();
647 Clazz.pu$h(self.c$);
648 c$=Clazz.declareType(java.util.TreeMap,"ComparatorBoundedValueIterator",java.util.TreeMap.ComparatorBoundedIterator,java.util.Iterator);
649 Clazz.overrideMethod(c$,"next",
650 function(){
651 this.makeNext();
652 this.cleanNext();
653 return this.lastNode.value;
654 });
655 c$=Clazz.p0p();
656 Clazz.pu$h(self.c$);
657 c$=Clazz.decorateAsClass(function(){
658 this.endKey=null;
659 Clazz.instantialize(this,arguments);
660 },java.util.TreeMap,"ComparableBoundedIterator",java.util.TreeMap.AbstractMapIterator);
661 Clazz.makeConstructor(c$,
662 function(a,b,c){
663 Clazz.superConstructor(this,java.util.TreeMap.ComparableBoundedIterator,[a,b]);
664 this.endKey=c;
665 },"java.util.TreeMap,java.util.TreeMap.Entry,Comparable");
666 Clazz.defineMethod(c$,"cleanNext",
667 function(){
668 if((this.node!=null)&&(this.endKey.compareTo(this.node.key)<=0)){
669 this.node=null;
670 }});
671 Clazz.overrideMethod(c$,"hasNext",
672 function(){
673 return(this.node!=null)&&(this.endKey.compareTo(this.node.key)>0);
674 });
675 c$=Clazz.p0p();
676 Clazz.pu$h(self.c$);
677 c$=Clazz.declareType(java.util.TreeMap,"ComparableBoundedEntryIterator",java.util.TreeMap.ComparableBoundedIterator,java.util.Iterator);
678 Clazz.overrideMethod(c$,"next",
679 function(){
680 this.makeNext();
681 this.cleanNext();
682 return this.lastNode;
683 });
684 c$=Clazz.p0p();
685 Clazz.pu$h(self.c$);
686 c$=Clazz.declareType(java.util.TreeMap,"ComparableBoundedKeyIterator",java.util.TreeMap.ComparableBoundedIterator,java.util.Iterator);
687 Clazz.overrideMethod(c$,"next",
688 function(){
689 this.makeNext();
690 this.cleanNext();
691 return this.lastNode.key;
692 });
693 c$=Clazz.p0p();
694 Clazz.pu$h(self.c$);
695 c$=Clazz.declareType(java.util.TreeMap,"ComparableBoundedValueIterator",java.util.TreeMap.ComparableBoundedIterator,java.util.Iterator);
696 Clazz.overrideMethod(c$,"next",
697 function(){
698 this.makeNext();
699 this.cleanNext();
700 return this.lastNode.value;
701 });
702 c$=Clazz.p0p();
703 Clazz.pu$h(self.c$);
704 c$=Clazz.decorateAsClass(function(){
705 this.backingMap=null;
706 this.hasStart=false;
707 this.hasEnd=false;
708 this.startKey=null;
709 this.endKey=null;
710 this.$entrySet=null;
711 Clazz.instantialize(this,arguments);
712 },java.util.TreeMap,"SubMap",java.util.AbstractMap,[java.util.SortedMap,java.io.Serializable]);
713 Clazz.makeConstructor(c$,
714 function(a,b){
715 Clazz.superConstructor(this,java.util.TreeMap.SubMap,[]);
716 this.backingMap=b;
717 this.hasStart=true;
718 this.startKey=a;
719 },"~O,java.util.TreeMap");
720 Clazz.makeConstructor(c$,
721 function(a,b,c){
722 Clazz.superConstructor(this,java.util.TreeMap.SubMap,[]);
723 this.backingMap=b;
724 this.hasStart=this.hasEnd=true;
725 this.startKey=a;
726 this.endKey=c;
727 },"~O,java.util.TreeMap,~O");
728 Clazz.makeConstructor(c$,
729 function(a,b){
730 Clazz.superConstructor(this,java.util.TreeMap.SubMap,[]);
731 this.backingMap=a;
732 this.hasEnd=true;
733 this.endKey=b;
734 },"java.util.TreeMap,~O");
735 Clazz.overrideMethod(c$,"comparator",
736 function(){
737 return this.backingMap.comparator();
738 });
739 Clazz.overrideMethod(c$,"containsKey",
740 function(a){
741 if(this.isInRange(a)){
742 return this.backingMap.containsKey(a);
743 }return false;
744 },"~O");
745 Clazz.overrideMethod(c$,"entrySet",
746 function(){
747 if(this.$entrySet==null){
748 this.$entrySet=new java.util.TreeMap.SubMapEntrySet(this);
749 }return this.$entrySet;
750 });
751 Clazz.overrideMethod(c$,"firstKey",
752 function(){
753 var a=this.firstEntry();
754 if(a!=null){
755 return a.key;
756 }throw new java.util.NoSuchElementException();
757 });
758 Clazz.defineMethod(c$,"firstEntry",
759 function(){
760 if(!this.hasStart){
761 var a=this.backingMap.root;
762 return(a==null)?null:java.util.TreeMap.minimum(this.backingMap.root);
763 }var a=this.backingMap.findAfter(this.startKey);
764 if(a!=null&&this.checkUpperBound(a.key)){
765 return a;
766 }return null;
767 });
768 Clazz.overrideMethod(c$,"get",
769 function(a){
770 if(this.isInRange(a)){
771 return this.backingMap.get(a);
772 }return null;
773 },"~O");
774 Clazz.overrideMethod(c$,"headMap",
775 function(a){
776 this.checkRange(a);
777 if(this.hasStart){
778 return new java.util.TreeMap.SubMap(this.startKey,this.backingMap,a);
779 }return new java.util.TreeMap.SubMap(this.backingMap,a);
780 },"~O");
781 Clazz.overrideMethod(c$,"isEmpty",
782 function(){
783 if(this.hasStart){
784 var a=this.backingMap.findAfter(this.startKey);
785 return a==null||!this.checkUpperBound(a.key);
786 }return this.backingMap.findBefore(this.endKey)==null;
787 });
788 Clazz.overrideMethod(c$,"keySet",
789 function(){
790 if(this.$keySet==null){
791 this.$keySet=new java.util.TreeMap.SubMapKeySet(this);
792 }return this.$keySet;
793 });
794 Clazz.overrideMethod(c$,"lastKey",
795 function(){
796 if(!this.hasEnd){
797 return this.backingMap.lastKey();
798 }var a=this.backingMap.findBefore(this.endKey);
799 if(a!=null&&this.checkLowerBound(a.key)){
800 return a.key;
801 }throw new java.util.NoSuchElementException();
802 });
803 Clazz.overrideMethod(c$,"put",
804 function(a,b){
805 if(this.isInRange(a)){
806 return this.backingMap.put(a,b);
807 }throw new IllegalArgumentException();
808 },"~O,~O");
809 Clazz.overrideMethod(c$,"remove",
810 function(a){
811 if(this.isInRange(a)){
812 return this.backingMap.remove(a);
813 }return null;
814 },"~O");
815 Clazz.overrideMethod(c$,"subMap",
816 function(a,b){
817 this.checkRange(a);
818 this.checkRange(b);
819 var c=this.backingMap.comparator();
820 if(c==null){
821 if(java.util.TreeMap.toComparable(a).compareTo(b)<=0){
822 return new java.util.TreeMap.SubMap(a,this.backingMap,b);
823 }}else{
824 if(c.compare(a,b)<=0){
825 return new java.util.TreeMap.SubMap(a,this.backingMap,b);
826 }}throw new IllegalArgumentException();
827 },"~O,~O");
828 Clazz.overrideMethod(c$,"tailMap",
829 function(a){
830 this.checkRange(a);
831 if(this.hasEnd){
832 return new java.util.TreeMap.SubMap(a,this.backingMap,this.endKey);
833 }return new java.util.TreeMap.SubMap(a,this.backingMap);
834 },"~O");
835 Clazz.overrideMethod(c$,"values",
836 function(){
837 if(this.valuesCollection==null){
838 this.valuesCollection=new java.util.TreeMap.SubMapValuesCollection(this);
839 }return this.valuesCollection;
840 });
841 c$=Clazz.p0p();
842 Clazz.pu$h(self.c$);
843 c$=Clazz.decorateAsClass(function(){
844 this.subMap=null;
845 Clazz.instantialize(this,arguments);
846 },java.util.TreeMap,"SubMapEntrySet",java.util.AbstractSet,java.util.Set);
847 Clazz.makeConstructor(c$,
848 function(a){
849 Clazz.superConstructor(this,java.util.TreeMap.SubMapEntrySet,[]);
850 this.subMap=a;
851 },"java.util.TreeMap.SubMap");
852 Clazz.overrideMethod(c$,"isEmpty",
853 function(){
854 return this.subMap.isEmpty();
855 });
856 Clazz.overrideMethod(c$,"iterator",
857 function(){
858 var a=this.subMap.firstEntry();
859 if(this.subMap.hasEnd){
860 var b=this.subMap.comparator();
861 if(b==null){
862 return new java.util.TreeMap.ComparableBoundedEntryIterator(this.subMap.backingMap,a,java.util.TreeMap.toComparable(this.subMap.endKey));
863 }return new java.util.TreeMap.ComparatorBoundedEntryIterator(this.subMap.backingMap,a,this.subMap.endKey);
864 }return new java.util.TreeMap.UnboundedEntryIterator(this.subMap.backingMap,a);
865 });
866 Clazz.overrideMethod(c$,"size",
867 function(){
868 var a=0;
869 var b=this.iterator();
870 while(b.hasNext()){
871 a++;
872 b.next();
873 }
874 return a;
875 });
876 Clazz.overrideMethod(c$,"contains",
877 function(a){
878 if(Clazz.instanceOf(a,java.util.Map.Entry)){
879 var b=a;
880 var c=b.getKey();
881 if(this.subMap.isInRange(c)){
882 var d=this.subMap.get(c);
883 var e=b.getValue();
884 return d==null?e==null:d.equals(e);
885 }}return false;
886 },"~O");
887 c$=Clazz.p0p();
888 Clazz.pu$h(self.c$);
889 c$=Clazz.decorateAsClass(function(){
890 this.subMap=null;
891 Clazz.instantialize(this,arguments);
892 },java.util.TreeMap,"SubMapKeySet",java.util.AbstractSet,java.util.Set);
893 Clazz.makeConstructor(c$,
894 function(a){
895 Clazz.superConstructor(this,java.util.TreeMap.SubMapKeySet,[]);
896 this.subMap=a;
897 },"java.util.TreeMap.SubMap");
898 Clazz.overrideMethod(c$,"contains",
899 function(a){
900 return this.subMap.containsKey(a);
901 },"~O");
902 Clazz.overrideMethod(c$,"isEmpty",
903 function(){
904 return this.subMap.isEmpty();
905 });
906 Clazz.overrideMethod(c$,"size",
907 function(){
908 var a=0;
909 var b=this.iterator();
910 while(b.hasNext()){
911 a++;
912 b.next();
913 }
914 return a;
915 });
916 Clazz.overrideMethod(c$,"iterator",
917 function(){
918 var a=this.subMap.firstEntry();
919 if(this.subMap.hasEnd){
920 var b=this.subMap.comparator();
921 if(b==null){
922 return new java.util.TreeMap.ComparableBoundedKeyIterator(this.subMap.backingMap,a,java.util.TreeMap.toComparable(this.subMap.endKey));
923 }return new java.util.TreeMap.ComparatorBoundedKeyIterator(this.subMap.backingMap,a,this.subMap.endKey);
924 }return new java.util.TreeMap.UnboundedKeyIterator(this.subMap.backingMap,a);
925 });
926 c$=Clazz.p0p();
927 Clazz.pu$h(self.c$);
928 c$=Clazz.decorateAsClass(function(){
929 this.subMap=null;
930 Clazz.instantialize(this,arguments);
931 },java.util.TreeMap,"SubMapValuesCollection",java.util.AbstractCollection);
932 Clazz.makeConstructor(c$,
933 function(a){
934 Clazz.superConstructor(this,java.util.TreeMap.SubMapValuesCollection,[]);
935 this.subMap=a;
936 },"java.util.TreeMap.SubMap");
937 Clazz.overrideMethod(c$,"isEmpty",
938 function(){
939 return this.subMap.isEmpty();
940 });
941 Clazz.overrideMethod(c$,"iterator",
942 function(){
943 var a=this.subMap.firstEntry();
944 if(this.subMap.hasEnd){
945 var b=this.subMap.comparator();
946 if(b==null){
947 return new java.util.TreeMap.ComparableBoundedValueIterator(this.subMap.backingMap,a,java.util.TreeMap.toComparable(this.subMap.endKey));
948 }return new java.util.TreeMap.ComparatorBoundedValueIterator(this.subMap.backingMap,a,this.subMap.endKey);
949 }return new java.util.TreeMap.UnboundedValueIterator(this.subMap.backingMap,a);
950 });
951 Clazz.overrideMethod(c$,"size",
952 function(){
953 var a=0;
954 for(var b=this.iterator();b.hasNext();){
955 b.next();
956 a++;
957 }
958 return a;
959 });
960 c$=Clazz.p0p();
961 });