Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: lib/runtime/dart/collection.js

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 dart_library.library('dart/collection', null, /* Imports */[
2 'dart/_runtime',
3 'dart/core'
4 ], /* Lazy imports */[
5 'dart/_internal',
6 'dart/_js_helper',
7 'dart/math'
8 ], function(exports, dart, core, _internal, _js_helper, math) {
9 'use strict';
10 let dartx = dart.dartx;
11 const _source = Symbol('_source');
12 const UnmodifiableListView$ = dart.generic(function(E) {
13 class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) {
14 UnmodifiableListView(source) {
15 this[_source] = source;
16 }
17 get length() {
18 return this[_source][dartx.length];
19 }
20 get(index) {
21 return this[_source][dartx.elementAt](index);
22 }
23 }
24 dart.setSignature(UnmodifiableListView, {
25 constructors: () => ({UnmodifiableListView: [exports.UnmodifiableListView$ (E), [core.Iterable$(E)]]}),
26 methods: () => ({get: [E, [core.int]]})
27 });
28 dart.defineExtensionMembers(UnmodifiableListView, ['get', 'length']);
29 return UnmodifiableListView;
30 });
31 dart.defineLazyClassGeneric(exports, 'UnmodifiableListView', {get: Unmodifiabl eListView$});
32 function _defaultEquals(a, b) {
33 return dart.equals(a, b);
34 }
35 dart.fn(_defaultEquals, core.bool, [core.Object, core.Object]);
36 function _defaultHashCode(a) {
37 return dart.hashCode(a);
38 }
39 dart.fn(_defaultHashCode, core.int, [core.Object]);
40 const _Equality$ = dart.generic(function(K) {
41 const _Equality = dart.typedef('_Equality', () => dart.functionType(core.boo l, [K, K]));
42 return _Equality;
43 });
44 let _Equality = _Equality$();
45 const _Hasher$ = dart.generic(function(K) {
46 const _Hasher = dart.typedef('_Hasher', () => dart.functionType(core.int, [K ]));
47 return _Hasher;
48 });
49 let _Hasher = _Hasher$();
50 const HashMap$ = dart.generic(function(K, V) {
51 class HashMap extends core.Object {
52 static new(opts) {
53 let equals = opts && 'equals' in opts ? opts.equals : null;
54 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
55 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
56 if (isValidKey == null) {
57 if (hashCode == null) {
58 if (equals == null) {
59 return new (_HashMap$(K, V))();
60 }
61 hashCode = _defaultHashCode;
62 } else {
63 if (core.identical(core.identityHashCode, hashCode) && core.identica l(core.identical, equals)) {
64 return new (_IdentityHashMap$(K, V))();
65 }
66 if (equals == null) {
67 equals = _defaultEquals;
68 }
69 }
70 } else {
71 if (hashCode == null) {
72 hashCode = _defaultHashCode;
73 }
74 if (equals == null) {
75 equals = _defaultEquals;
76 }
77 }
78 return new (_CustomHashMap$(K, V))(equals, hashCode, isValidKey);
79 }
80 static identity() {
81 return new (_IdentityHashMap$(K, V))();
82 }
83 static from(other) {
84 let result = HashMap$(K, V).new();
85 other[dartx.forEach](dart.fn((k, v) => {
86 result.set(dart.as(k, K), dart.as(v, V));
87 }, dart.void, [dart.dynamic, dart.dynamic]));
88 return result;
89 }
90 static fromIterable(iterable, opts) {
91 let key = opts && 'key' in opts ? opts.key : null;
92 let value = opts && 'value' in opts ? opts.value : null;
93 let map = HashMap$(K, V).new();
94 Maps._fillMapWithMappedIterable(map, iterable, key, value);
95 return map;
96 }
97 static fromIterables(keys, values) {
98 let map = HashMap$(K, V).new();
99 Maps._fillMapWithIterables(map, keys, values);
100 return map;
101 }
102 }
103 HashMap[dart.implements] = () => [core.Map$(K, V)];
104 dart.setSignature(HashMap, {
105 constructors: () => ({
106 new: [HashMap$(K, V), [], {equals: dart.functionType(core.bool, [K, K]), hashCode: dart.functionType(core.int, [K]), isValidKey: dart.functionType(core. bool, [core.Object])}],
107 identity: [HashMap$(K, V), []],
108 from: [HashMap$(K, V), [core.Map]],
109 fromIterable: [HashMap$(K, V), [core.Iterable], {key: dart.functionType( K, [dart.dynamic]), value: dart.functionType(V, [dart.dynamic])}],
110 fromIterables: [HashMap$(K, V), [core.Iterable$(K), core.Iterable$(V)]]
111 })
112 });
113 return HashMap;
114 });
115 let HashMap = HashMap$();
116 const _newSet = Symbol('_newSet');
117 const SetMixin$ = dart.generic(function(E) {
118 class SetMixin extends core.Object {
119 [Symbol.iterator]() {
120 return new dart.JsIterator(this.iterator);
121 }
122 get isEmpty() {
123 return this.length == 0;
124 }
125 get isNotEmpty() {
126 return this.length != 0;
127 }
128 clear() {
129 this.removeAll(this.toList());
130 }
131 addAll(elements) {
132 dart.as(elements, core.Iterable$(E));
133 for (let element of elements)
134 this.add(element);
135 }
136 removeAll(elements) {
137 for (let element of elements)
138 this.remove(element);
139 }
140 retainAll(elements) {
141 let toRemove = this.toSet();
142 for (let o of elements) {
143 toRemove.remove(o);
144 }
145 this.removeAll(toRemove);
146 }
147 removeWhere(test) {
148 dart.as(test, dart.functionType(core.bool, [E]));
149 let toRemove = [];
150 for (let element of this) {
151 if (dart.notNull(test(element))) toRemove[dartx.add](element);
152 }
153 this.removeAll(toRemove);
154 }
155 retainWhere(test) {
156 dart.as(test, dart.functionType(core.bool, [E]));
157 let toRemove = [];
158 for (let element of this) {
159 if (!dart.notNull(test(element))) toRemove[dartx.add](element);
160 }
161 this.removeAll(toRemove);
162 }
163 containsAll(other) {
164 for (let o of other) {
165 if (!dart.notNull(this.contains(o))) return false;
166 }
167 return true;
168 }
169 union(other) {
170 dart.as(other, core.Set$(E));
171 let _ = this.toSet();
172 _.addAll(other);
173 return _;
174 }
175 intersection(other) {
176 let result = this.toSet();
177 for (let element of this) {
178 if (!dart.notNull(other.contains(element))) result.remove(element);
179 }
180 return result;
181 }
182 difference(other) {
183 let result = this.toSet();
184 for (let element of this) {
185 if (dart.notNull(other.contains(element))) result.remove(element);
186 }
187 return result;
188 }
189 toList(opts) {
190 let growable = opts && 'growable' in opts ? opts.growable : true;
191 let result = dart.notNull(growable) ? (() => {
192 let _ = core.List$(E).new();
193 _[dartx.length] = this.length;
194 return _;
195 })() : core.List$(E).new(this.length);
196 let i = 0;
197 for (let element of this)
198 result[dartx.set](i++, element);
199 return result;
200 }
201 map(f) {
202 dart.as(f, dart.functionType(dart.dynamic, [E]));
203 return new (_internal.EfficientLengthMappedIterable$(E, dart.dynamic))(t his, f);
204 }
205 get single() {
206 if (dart.notNull(this.length) > 1) dart.throw(_internal.IterableElementE rror.tooMany());
207 let it = this.iterator;
208 if (!dart.notNull(it.moveNext())) dart.throw(_internal.IterableElementEr ror.noElement());
209 let result = it.current;
210 return result;
211 }
212 toString() {
213 return IterableBase.iterableToFullString(this, '{', '}');
214 }
215 where(f) {
216 dart.as(f, dart.functionType(core.bool, [E]));
217 return new (_internal.WhereIterable$(E))(this, f);
218 }
219 expand(f) {
220 dart.as(f, dart.functionType(core.Iterable, [E]));
221 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
222 }
223 forEach(f) {
224 dart.as(f, dart.functionType(dart.void, [E]));
225 for (let element of this)
226 f(element);
227 }
228 reduce(combine) {
229 dart.as(combine, dart.functionType(E, [E, E]));
230 let iterator = this.iterator;
231 if (!dart.notNull(iterator.moveNext())) {
232 dart.throw(_internal.IterableElementError.noElement());
233 }
234 let value = iterator.current;
235 while (dart.notNull(iterator.moveNext())) {
236 value = combine(value, iterator.current);
237 }
238 return value;
239 }
240 fold(initialValue, combine) {
241 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E]));
242 let value = initialValue;
243 for (let element of this)
244 value = combine(value, element);
245 return value;
246 }
247 every(f) {
248 dart.as(f, dart.functionType(core.bool, [E]));
249 for (let element of this) {
250 if (!dart.notNull(f(element))) return false;
251 }
252 return true;
253 }
254 join(separator) {
255 if (separator === void 0) separator = "";
256 let iterator = this.iterator;
257 if (!dart.notNull(iterator.moveNext())) return "";
258 let buffer = new core.StringBuffer();
259 if (separator == null || separator == "") {
260 do {
261 buffer.write(`${iterator.current}`);
262 } while (dart.notNull(iterator.moveNext()));
263 } else {
264 buffer.write(`${iterator.current}`);
265 while (dart.notNull(iterator.moveNext())) {
266 buffer.write(separator);
267 buffer.write(`${iterator.current}`);
268 }
269 }
270 return buffer.toString();
271 }
272 any(test) {
273 dart.as(test, dart.functionType(core.bool, [E]));
274 for (let element of this) {
275 if (dart.notNull(test(element))) return true;
276 }
277 return false;
278 }
279 take(n) {
280 return _internal.TakeIterable$(E).new(this, n);
281 }
282 takeWhile(test) {
283 dart.as(test, dart.functionType(core.bool, [E]));
284 return new (_internal.TakeWhileIterable$(E))(this, test);
285 }
286 skip(n) {
287 return _internal.SkipIterable$(E).new(this, n);
288 }
289 skipWhile(test) {
290 dart.as(test, dart.functionType(core.bool, [E]));
291 return new (_internal.SkipWhileIterable$(E))(this, test);
292 }
293 get first() {
294 let it = this.iterator;
295 if (!dart.notNull(it.moveNext())) {
296 dart.throw(_internal.IterableElementError.noElement());
297 }
298 return it.current;
299 }
300 get last() {
301 let it = this.iterator;
302 if (!dart.notNull(it.moveNext())) {
303 dart.throw(_internal.IterableElementError.noElement());
304 }
305 let result = null;
306 do {
307 result = it.current;
308 } while (dart.notNull(it.moveNext()));
309 return result;
310 }
311 firstWhere(test, opts) {
312 dart.as(test, dart.functionType(core.bool, [E]));
313 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
314 dart.as(orElse, dart.functionType(E, []));
315 for (let element of this) {
316 if (dart.notNull(test(element))) return element;
317 }
318 if (orElse != null) return orElse();
319 dart.throw(_internal.IterableElementError.noElement());
320 }
321 lastWhere(test, opts) {
322 dart.as(test, dart.functionType(core.bool, [E]));
323 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
324 dart.as(orElse, dart.functionType(E, []));
325 let result = null;
326 let foundMatching = false;
327 for (let element of this) {
328 if (dart.notNull(test(element))) {
329 result = element;
330 foundMatching = true;
331 }
332 }
333 if (foundMatching) return result;
334 if (orElse != null) return orElse();
335 dart.throw(_internal.IterableElementError.noElement());
336 }
337 singleWhere(test) {
338 dart.as(test, dart.functionType(core.bool, [E]));
339 let result = null;
340 let foundMatching = false;
341 for (let element of this) {
342 if (dart.notNull(test(element))) {
343 if (foundMatching) {
344 dart.throw(_internal.IterableElementError.tooMany());
345 }
346 result = element;
347 foundMatching = true;
348 }
349 }
350 if (foundMatching) return result;
351 dart.throw(_internal.IterableElementError.noElement());
352 }
353 elementAt(index) {
354 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError.notNu ll("index"));
355 core.RangeError.checkNotNegative(index, "index");
356 let elementIndex = 0;
357 for (let element of this) {
358 if (index == elementIndex) return element;
359 elementIndex++;
360 }
361 dart.throw(core.RangeError.index(index, this, "index", null, elementInde x));
362 }
363 }
364 SetMixin[dart.implements] = () => [core.Set$(E)];
365 dart.setSignature(SetMixin, {
366 methods: () => ({
367 clear: [dart.void, []],
368 addAll: [dart.void, [core.Iterable$(E)]],
369 removeAll: [dart.void, [core.Iterable$(core.Object)]],
370 retainAll: [dart.void, [core.Iterable$(core.Object)]],
371 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]],
372 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]],
373 containsAll: [core.bool, [core.Iterable$(core.Object)]],
374 union: [core.Set$(E), [core.Set$(E)]],
375 intersection: [core.Set$(E), [core.Set$(core.Object)]],
376 difference: [core.Set$(E), [core.Set$(core.Object)]],
377 toList: [core.List$(E), [], {growable: core.bool}],
378 map: [core.Iterable, [dart.functionType(dart.dynamic, [E])]],
379 where: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
380 expand: [core.Iterable, [dart.functionType(core.Iterable, [E])]],
381 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
382 reduce: [E, [dart.functionType(E, [E, E])]],
383 fold: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic, [dar t.dynamic, E])]],
384 every: [core.bool, [dart.functionType(core.bool, [E])]],
385 join: [core.String, [], [core.String]],
386 any: [core.bool, [dart.functionType(core.bool, [E])]],
387 take: [core.Iterable$(E), [core.int]],
388 takeWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
389 skip: [core.Iterable$(E), [core.int]],
390 skipWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
391 firstWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.funct ionType(E, [])}],
392 lastWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.functi onType(E, [])}],
393 singleWhere: [E, [dart.functionType(core.bool, [E])]],
394 elementAt: [E, [core.int]]
395 })
396 });
397 dart.defineExtensionMembers(SetMixin, [
398 'toList',
399 'map',
400 'where',
401 'expand',
402 'forEach',
403 'reduce',
404 'fold',
405 'every',
406 'join',
407 'any',
408 'take',
409 'takeWhile',
410 'skip',
411 'skipWhile',
412 'firstWhere',
413 'lastWhere',
414 'singleWhere',
415 'elementAt',
416 'isEmpty',
417 'isNotEmpty',
418 'single',
419 'first',
420 'last'
421 ]);
422 return SetMixin;
423 });
424 let SetMixin = SetMixin$();
425 const SetBase$ = dart.generic(function(E) {
426 class SetBase extends SetMixin$(E) {
427 static setToString(set) {
428 return IterableBase.iterableToFullString(set, '{', '}');
429 }
430 }
431 dart.setSignature(SetBase, {
432 statics: () => ({setToString: [core.String, [core.Set]]}),
433 names: ['setToString']
434 });
435 return SetBase;
436 });
437 let SetBase = SetBase$();
438 const _HashSetBase$ = dart.generic(function(E) {
439 class _HashSetBase extends SetBase$(E) {
440 difference(other) {
441 let result = this[_newSet]();
442 for (let element of this) {
443 if (!dart.notNull(other.contains(element))) result.add(element);
444 }
445 return result;
446 }
447 intersection(other) {
448 let result = this[_newSet]();
449 for (let element of this) {
450 if (dart.notNull(other.contains(element))) result.add(element);
451 }
452 return result;
453 }
454 toSet() {
455 return (() => {
456 let _ = this[_newSet]();
457 _.addAll(this);
458 return _;
459 })();
460 }
461 }
462 dart.setSignature(_HashSetBase, {
463 methods: () => ({
464 difference: [core.Set$(E), [core.Set$(core.Object)]],
465 intersection: [core.Set$(E), [core.Set$(core.Object)]],
466 toSet: [core.Set$(E), []]
467 })
468 });
469 dart.defineExtensionMembers(_HashSetBase, ['toSet']);
470 return _HashSetBase;
471 });
472 let _HashSetBase = _HashSetBase$();
473 const HashSet$ = dart.generic(function(E) {
474 class HashSet extends core.Object {
475 static new(opts) {
476 let equals = opts && 'equals' in opts ? opts.equals : null;
477 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
478 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
479 if (isValidKey == null) {
480 if (hashCode == null) {
481 if (equals == null) {
482 return new (_HashSet$(E))();
483 }
484 hashCode = _defaultHashCode;
485 } else {
486 if (core.identical(core.identityHashCode, hashCode) && core.identica l(core.identical, equals)) {
487 return new (_IdentityHashSet$(E))();
488 }
489 if (equals == null) {
490 equals = _defaultEquals;
491 }
492 }
493 } else {
494 if (hashCode == null) {
495 hashCode = _defaultHashCode;
496 }
497 if (equals == null) {
498 equals = _defaultEquals;
499 }
500 }
501 return new (_CustomHashSet$(E))(equals, hashCode, isValidKey);
502 }
503 static identity() {
504 return new (_IdentityHashSet$(E))();
505 }
506 static from(elements) {
507 let result = HashSet$(E).new();
508 for (let e of elements) {
509 dart.as(e, E);
510 result.add(e);
511 }
512 return result;
513 }
514 [Symbol.iterator]() {
515 return new dart.JsIterator(this.iterator);
516 }
517 }
518 HashSet[dart.implements] = () => [core.Set$(E)];
519 dart.setSignature(HashSet, {
520 constructors: () => ({
521 new: [HashSet$(E), [], {equals: dart.functionType(core.bool, [E, E]), ha shCode: dart.functionType(core.int, [E]), isValidKey: dart.functionType(core.boo l, [core.Object])}],
522 identity: [HashSet$(E), []],
523 from: [HashSet$(E), [core.Iterable]]
524 })
525 });
526 return HashSet;
527 });
528 let HashSet = HashSet$();
529 const IterableMixin$ = dart.generic(function(E) {
530 class IterableMixin extends core.Object {
531 map(f) {
532 dart.as(f, dart.functionType(dart.dynamic, [E]));
533 return _internal.MappedIterable$(E, dart.dynamic).new(this, f);
534 }
535 where(f) {
536 dart.as(f, dart.functionType(core.bool, [E]));
537 return new (_internal.WhereIterable$(E))(this, f);
538 }
539 expand(f) {
540 dart.as(f, dart.functionType(core.Iterable, [E]));
541 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
542 }
543 contains(element) {
544 for (let e of this) {
545 if (dart.equals(e, element)) return true;
546 }
547 return false;
548 }
549 forEach(f) {
550 dart.as(f, dart.functionType(dart.void, [E]));
551 for (let element of this)
552 f(element);
553 }
554 reduce(combine) {
555 dart.as(combine, dart.functionType(E, [E, E]));
556 let iterator = this.iterator;
557 if (!dart.notNull(iterator.moveNext())) {
558 dart.throw(_internal.IterableElementError.noElement());
559 }
560 let value = iterator.current;
561 while (dart.notNull(iterator.moveNext())) {
562 value = combine(value, iterator.current);
563 }
564 return value;
565 }
566 fold(initialValue, combine) {
567 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E]));
568 let value = initialValue;
569 for (let element of this)
570 value = combine(value, element);
571 return value;
572 }
573 every(f) {
574 dart.as(f, dart.functionType(core.bool, [E]));
575 for (let element of this) {
576 if (!dart.notNull(f(element))) return false;
577 }
578 return true;
579 }
580 join(separator) {
581 if (separator === void 0) separator = "";
582 let iterator = this.iterator;
583 if (!dart.notNull(iterator.moveNext())) return "";
584 let buffer = new core.StringBuffer();
585 if (separator == null || separator == "") {
586 do {
587 buffer.write(`${iterator.current}`);
588 } while (dart.notNull(iterator.moveNext()));
589 } else {
590 buffer.write(`${iterator.current}`);
591 while (dart.notNull(iterator.moveNext())) {
592 buffer.write(separator);
593 buffer.write(`${iterator.current}`);
594 }
595 }
596 return buffer.toString();
597 }
598 any(f) {
599 dart.as(f, dart.functionType(core.bool, [E]));
600 for (let element of this) {
601 if (dart.notNull(f(element))) return true;
602 }
603 return false;
604 }
605 toList(opts) {
606 let growable = opts && 'growable' in opts ? opts.growable : true;
607 return core.List$(E).from(this, {growable: growable});
608 }
609 toSet() {
610 return core.Set$(E).from(this);
611 }
612 get length() {
613 dart.assert(!dart.is(this, _internal.EfficientLength));
614 let count = 0;
615 let it = this[dartx.iterator];
616 while (dart.notNull(it.moveNext())) {
617 count++;
618 }
619 return count;
620 }
621 get isEmpty() {
622 return !dart.notNull(this[dartx.iterator].moveNext());
623 }
624 get isNotEmpty() {
625 return !dart.notNull(this.isEmpty);
626 }
627 take(n) {
628 return _internal.TakeIterable$(E).new(this, n);
629 }
630 takeWhile(test) {
631 dart.as(test, dart.functionType(core.bool, [E]));
632 return new (_internal.TakeWhileIterable$(E))(this, test);
633 }
634 skip(n) {
635 return _internal.SkipIterable$(E).new(this, n);
636 }
637 skipWhile(test) {
638 dart.as(test, dart.functionType(core.bool, [E]));
639 return new (_internal.SkipWhileIterable$(E))(this, test);
640 }
641 get first() {
642 let it = this[dartx.iterator];
643 if (!dart.notNull(it.moveNext())) {
644 dart.throw(_internal.IterableElementError.noElement());
645 }
646 return it.current;
647 }
648 get last() {
649 let it = this[dartx.iterator];
650 if (!dart.notNull(it.moveNext())) {
651 dart.throw(_internal.IterableElementError.noElement());
652 }
653 let result = null;
654 do {
655 result = it.current;
656 } while (dart.notNull(it.moveNext()));
657 return result;
658 }
659 get single() {
660 let it = this[dartx.iterator];
661 if (!dart.notNull(it.moveNext())) dart.throw(_internal.IterableElementEr ror.noElement());
662 let result = it.current;
663 if (dart.notNull(it.moveNext())) dart.throw(_internal.IterableElementErr or.tooMany());
664 return result;
665 }
666 firstWhere(test, opts) {
667 dart.as(test, dart.functionType(core.bool, [E]));
668 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
669 dart.as(orElse, dart.functionType(E, []));
670 for (let element of this) {
671 if (dart.notNull(test(element))) return element;
672 }
673 if (orElse != null) return orElse();
674 dart.throw(_internal.IterableElementError.noElement());
675 }
676 lastWhere(test, opts) {
677 dart.as(test, dart.functionType(core.bool, [E]));
678 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
679 dart.as(orElse, dart.functionType(E, []));
680 let result = null;
681 let foundMatching = false;
682 for (let element of this) {
683 if (dart.notNull(test(element))) {
684 result = element;
685 foundMatching = true;
686 }
687 }
688 if (foundMatching) return result;
689 if (orElse != null) return orElse();
690 dart.throw(_internal.IterableElementError.noElement());
691 }
692 singleWhere(test) {
693 dart.as(test, dart.functionType(core.bool, [E]));
694 let result = null;
695 let foundMatching = false;
696 for (let element of this) {
697 if (dart.notNull(test(element))) {
698 if (foundMatching) {
699 dart.throw(_internal.IterableElementError.tooMany());
700 }
701 result = element;
702 foundMatching = true;
703 }
704 }
705 if (foundMatching) return result;
706 dart.throw(_internal.IterableElementError.noElement());
707 }
708 elementAt(index) {
709 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError.notNu ll("index"));
710 core.RangeError.checkNotNegative(index, "index");
711 let elementIndex = 0;
712 for (let element of this) {
713 if (index == elementIndex) return element;
714 elementIndex++;
715 }
716 dart.throw(core.RangeError.index(index, this, "index", null, elementInde x));
717 }
718 toString() {
719 return IterableBase.iterableToShortString(this, '(', ')');
720 }
721 [Symbol.iterator]() {
722 return new dart.JsIterator(this.iterator);
723 }
724 }
725 IterableMixin[dart.implements] = () => [core.Iterable$(E)];
726 dart.setSignature(IterableMixin, {
727 methods: () => ({
728 map: [core.Iterable, [dart.functionType(dart.dynamic, [E])]],
729 where: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
730 expand: [core.Iterable, [dart.functionType(core.Iterable, [E])]],
731 contains: [core.bool, [core.Object]],
732 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
733 reduce: [E, [dart.functionType(E, [E, E])]],
734 fold: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic, [dar t.dynamic, E])]],
735 every: [core.bool, [dart.functionType(core.bool, [E])]],
736 join: [core.String, [], [core.String]],
737 any: [core.bool, [dart.functionType(core.bool, [E])]],
738 toList: [core.List$(E), [], {growable: core.bool}],
739 toSet: [core.Set$(E), []],
740 take: [core.Iterable$(E), [core.int]],
741 takeWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
742 skip: [core.Iterable$(E), [core.int]],
743 skipWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
744 firstWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.funct ionType(E, [])}],
745 lastWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.functi onType(E, [])}],
746 singleWhere: [E, [dart.functionType(core.bool, [E])]],
747 elementAt: [E, [core.int]]
748 })
749 });
750 dart.defineExtensionMembers(IterableMixin, [
751 'map',
752 'where',
753 'expand',
754 'contains',
755 'forEach',
756 'reduce',
757 'fold',
758 'every',
759 'join',
760 'any',
761 'toList',
762 'toSet',
763 'take',
764 'takeWhile',
765 'skip',
766 'skipWhile',
767 'firstWhere',
768 'lastWhere',
769 'singleWhere',
770 'elementAt',
771 'length',
772 'isEmpty',
773 'isNotEmpty',
774 'first',
775 'last',
776 'single'
777 ]);
778 return IterableMixin;
779 });
780 let IterableMixin = IterableMixin$();
781 const IterableBase$ = dart.generic(function(E) {
782 class IterableBase extends core.Object {
783 IterableBase() {
784 }
785 map(f) {
786 dart.as(f, dart.functionType(dart.dynamic, [E]));
787 return _internal.MappedIterable$(E, dart.dynamic).new(this, f);
788 }
789 where(f) {
790 dart.as(f, dart.functionType(core.bool, [E]));
791 return new (_internal.WhereIterable$(E))(this, f);
792 }
793 expand(f) {
794 dart.as(f, dart.functionType(core.Iterable, [E]));
795 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
796 }
797 contains(element) {
798 for (let e of this) {
799 if (dart.equals(e, element)) return true;
800 }
801 return false;
802 }
803 forEach(f) {
804 dart.as(f, dart.functionType(dart.void, [E]));
805 for (let element of this)
806 f(element);
807 }
808 reduce(combine) {
809 dart.as(combine, dart.functionType(E, [E, E]));
810 let iterator = this.iterator;
811 if (!dart.notNull(iterator.moveNext())) {
812 dart.throw(_internal.IterableElementError.noElement());
813 }
814 let value = iterator.current;
815 while (dart.notNull(iterator.moveNext())) {
816 value = combine(value, iterator.current);
817 }
818 return value;
819 }
820 fold(initialValue, combine) {
821 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E]));
822 let value = initialValue;
823 for (let element of this)
824 value = combine(value, element);
825 return value;
826 }
827 every(f) {
828 dart.as(f, dart.functionType(core.bool, [E]));
829 for (let element of this) {
830 if (!dart.notNull(f(element))) return false;
831 }
832 return true;
833 }
834 join(separator) {
835 if (separator === void 0) separator = "";
836 let iterator = this.iterator;
837 if (!dart.notNull(iterator.moveNext())) return "";
838 let buffer = new core.StringBuffer();
839 if (separator == null || separator == "") {
840 do {
841 buffer.write(`${iterator.current}`);
842 } while (dart.notNull(iterator.moveNext()));
843 } else {
844 buffer.write(`${iterator.current}`);
845 while (dart.notNull(iterator.moveNext())) {
846 buffer.write(separator);
847 buffer.write(`${iterator.current}`);
848 }
849 }
850 return buffer.toString();
851 }
852 any(f) {
853 dart.as(f, dart.functionType(core.bool, [E]));
854 for (let element of this) {
855 if (dart.notNull(f(element))) return true;
856 }
857 return false;
858 }
859 toList(opts) {
860 let growable = opts && 'growable' in opts ? opts.growable : true;
861 return core.List$(E).from(this, {growable: growable});
862 }
863 toSet() {
864 return core.Set$(E).from(this);
865 }
866 get length() {
867 dart.assert(!dart.is(this, _internal.EfficientLength));
868 let count = 0;
869 let it = this[dartx.iterator];
870 while (dart.notNull(it.moveNext())) {
871 count++;
872 }
873 return count;
874 }
875 get isEmpty() {
876 return !dart.notNull(this[dartx.iterator].moveNext());
877 }
878 get isNotEmpty() {
879 return !dart.notNull(this.isEmpty);
880 }
881 take(n) {
882 return _internal.TakeIterable$(E).new(this, n);
883 }
884 takeWhile(test) {
885 dart.as(test, dart.functionType(core.bool, [E]));
886 return new (_internal.TakeWhileIterable$(E))(this, test);
887 }
888 skip(n) {
889 return _internal.SkipIterable$(E).new(this, n);
890 }
891 skipWhile(test) {
892 dart.as(test, dart.functionType(core.bool, [E]));
893 return new (_internal.SkipWhileIterable$(E))(this, test);
894 }
895 get first() {
896 let it = this[dartx.iterator];
897 if (!dart.notNull(it.moveNext())) {
898 dart.throw(_internal.IterableElementError.noElement());
899 }
900 return it.current;
901 }
902 get last() {
903 let it = this[dartx.iterator];
904 if (!dart.notNull(it.moveNext())) {
905 dart.throw(_internal.IterableElementError.noElement());
906 }
907 let result = null;
908 do {
909 result = it.current;
910 } while (dart.notNull(it.moveNext()));
911 return result;
912 }
913 get single() {
914 let it = this[dartx.iterator];
915 if (!dart.notNull(it.moveNext())) dart.throw(_internal.IterableElementEr ror.noElement());
916 let result = it.current;
917 if (dart.notNull(it.moveNext())) dart.throw(_internal.IterableElementErr or.tooMany());
918 return result;
919 }
920 firstWhere(test, opts) {
921 dart.as(test, dart.functionType(core.bool, [E]));
922 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
923 dart.as(orElse, dart.functionType(E, []));
924 for (let element of this) {
925 if (dart.notNull(test(element))) return element;
926 }
927 if (orElse != null) return orElse();
928 dart.throw(_internal.IterableElementError.noElement());
929 }
930 lastWhere(test, opts) {
931 dart.as(test, dart.functionType(core.bool, [E]));
932 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
933 dart.as(orElse, dart.functionType(E, []));
934 let result = null;
935 let foundMatching = false;
936 for (let element of this) {
937 if (dart.notNull(test(element))) {
938 result = element;
939 foundMatching = true;
940 }
941 }
942 if (foundMatching) return result;
943 if (orElse != null) return orElse();
944 dart.throw(_internal.IterableElementError.noElement());
945 }
946 singleWhere(test) {
947 dart.as(test, dart.functionType(core.bool, [E]));
948 let result = null;
949 let foundMatching = false;
950 for (let element of this) {
951 if (dart.notNull(test(element))) {
952 if (foundMatching) {
953 dart.throw(_internal.IterableElementError.tooMany());
954 }
955 result = element;
956 foundMatching = true;
957 }
958 }
959 if (foundMatching) return result;
960 dart.throw(_internal.IterableElementError.noElement());
961 }
962 elementAt(index) {
963 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError.notNu ll("index"));
964 core.RangeError.checkNotNegative(index, "index");
965 let elementIndex = 0;
966 for (let element of this) {
967 if (index == elementIndex) return element;
968 elementIndex++;
969 }
970 dart.throw(core.RangeError.index(index, this, "index", null, elementInde x));
971 }
972 toString() {
973 return IterableBase$().iterableToShortString(this, '(', ')');
974 }
975 static iterableToShortString(iterable, leftDelimiter, rightDelimiter) {
976 if (leftDelimiter === void 0) leftDelimiter = '(';
977 if (rightDelimiter === void 0) rightDelimiter = ')';
978 if (dart.notNull(IterableBase$()._isToStringVisiting(iterable))) {
979 if (leftDelimiter == "(" && rightDelimiter == ")") {
980 return "(...)";
981 }
982 return `${leftDelimiter}...${rightDelimiter}`;
983 }
984 let parts = [];
985 IterableBase$()._toStringVisiting[dartx.add](iterable);
986 try {
987 IterableBase$()._iterablePartsToStrings(iterable, parts);
988 } finally {
989 dart.assert(core.identical(IterableBase$()._toStringVisiting[dartx.las t], iterable));
990 IterableBase$()._toStringVisiting[dartx.removeLast]();
991 }
992 return (() => {
993 let _ = new core.StringBuffer(leftDelimiter);
994 _.writeAll(parts, ", ");
995 _.write(rightDelimiter);
996 return _;
997 })().toString();
998 }
999 static iterableToFullString(iterable, leftDelimiter, rightDelimiter) {
1000 if (leftDelimiter === void 0) leftDelimiter = '(';
1001 if (rightDelimiter === void 0) rightDelimiter = ')';
1002 if (dart.notNull(IterableBase$()._isToStringVisiting(iterable))) {
1003 return `${leftDelimiter}...${rightDelimiter}`;
1004 }
1005 let buffer = new core.StringBuffer(leftDelimiter);
1006 IterableBase$()._toStringVisiting[dartx.add](iterable);
1007 try {
1008 buffer.writeAll(iterable, ", ");
1009 } finally {
1010 dart.assert(core.identical(IterableBase$()._toStringVisiting[dartx.las t], iterable));
1011 IterableBase$()._toStringVisiting[dartx.removeLast]();
1012 }
1013 buffer.write(rightDelimiter);
1014 return buffer.toString();
1015 }
1016 static _isToStringVisiting(o) {
1017 for (let i = 0; i < dart.notNull(IterableBase$()._toStringVisiting[dartx .length]); i++) {
1018 if (core.identical(o, IterableBase$()._toStringVisiting[dartx.get](i)) ) return true;
1019 }
1020 return false;
1021 }
1022 static _iterablePartsToStrings(iterable, parts) {
1023 let LENGTH_LIMIT = 80;
1024 let HEAD_COUNT = 3;
1025 let TAIL_COUNT = 2;
1026 let MAX_COUNT = 100;
1027 let OVERHEAD = 2;
1028 let ELLIPSIS_SIZE = 3;
1029 let length = 0;
1030 let count = 0;
1031 let it = iterable[dartx.iterator];
1032 while (dart.notNull(length) < LENGTH_LIMIT || count < HEAD_COUNT) {
1033 if (!dart.notNull(it.moveNext())) return;
1034 let next = `${it.current}`;
1035 parts[dartx.add](next);
1036 length = dart.notNull(length) + (dart.notNull(next[dartx.length]) + OV ERHEAD);
1037 count++;
1038 }
1039 let penultimateString = null;
1040 let ultimateString = null;
1041 let penultimate = null;
1042 let ultimate = null;
1043 if (!dart.notNull(it.moveNext())) {
1044 if (count <= HEAD_COUNT + TAIL_COUNT) return;
1045 ultimateString = dart.as(parts[dartx.removeLast](), core.String);
1046 penultimateString = dart.as(parts[dartx.removeLast](), core.String);
1047 } else {
1048 penultimate = it.current;
1049 count++;
1050 if (!dart.notNull(it.moveNext())) {
1051 if (count <= HEAD_COUNT + 1) {
1052 parts[dartx.add](`${penultimate}`);
1053 return;
1054 }
1055 ultimateString = `${penultimate}`;
1056 penultimateString = dart.as(parts[dartx.removeLast](), core.String);
1057 length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.l ength]) + OVERHEAD);
1058 } else {
1059 ultimate = it.current;
1060 count++;
1061 dart.assert(count < MAX_COUNT);
1062 while (dart.notNull(it.moveNext())) {
1063 penultimate = ultimate;
1064 ultimate = it.current;
1065 count++;
1066 if (count > MAX_COUNT) {
1067 while (dart.notNull(length) > LENGTH_LIMIT - ELLIPSIS_SIZE - OVE RHEAD && count > HEAD_COUNT) {
1068 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsen d(dart.dload(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int));
1069 count--;
1070 }
1071 parts[dartx.add]("...");
1072 return;
1073 }
1074 }
1075 penultimateString = `${penultimate}`;
1076 ultimateString = `${ultimate}`;
1077 length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.l ength]) + dart.notNull(penultimateString[dartx.length]) + 2 * OVERHEAD);
1078 }
1079 }
1080 let elision = null;
1081 if (count > dart.notNull(parts[dartx.length]) + TAIL_COUNT) {
1082 elision = "...";
1083 length = dart.notNull(length) + (ELLIPSIS_SIZE + OVERHEAD);
1084 }
1085 while (dart.notNull(length) > LENGTH_LIMIT && dart.notNull(parts[dartx.l ength]) > HEAD_COUNT) {
1086 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsend(dart.d load(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int));
1087 if (elision == null) {
1088 elision = "...";
1089 length = dart.notNull(length) + (ELLIPSIS_SIZE + OVERHEAD);
1090 }
1091 }
1092 if (elision != null) {
1093 parts[dartx.add](elision);
1094 }
1095 parts[dartx.add](penultimateString);
1096 parts[dartx.add](ultimateString);
1097 }
1098 [Symbol.iterator]() {
1099 return new dart.JsIterator(this.iterator);
1100 }
1101 }
1102 IterableBase[dart.implements] = () => [core.Iterable$(E)];
1103 dart.setSignature(IterableBase, {
1104 constructors: () => ({IterableBase: [IterableBase$(E), []]}),
1105 methods: () => ({
1106 map: [core.Iterable, [dart.functionType(dart.dynamic, [E])]],
1107 where: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
1108 expand: [core.Iterable, [dart.functionType(core.Iterable, [E])]],
1109 contains: [core.bool, [core.Object]],
1110 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
1111 reduce: [E, [dart.functionType(E, [E, E])]],
1112 fold: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic, [dar t.dynamic, E])]],
1113 every: [core.bool, [dart.functionType(core.bool, [E])]],
1114 join: [core.String, [], [core.String]],
1115 any: [core.bool, [dart.functionType(core.bool, [E])]],
1116 toList: [core.List$(E), [], {growable: core.bool}],
1117 toSet: [core.Set$(E), []],
1118 take: [core.Iterable$(E), [core.int]],
1119 takeWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
1120 skip: [core.Iterable$(E), [core.int]],
1121 skipWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
1122 firstWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.funct ionType(E, [])}],
1123 lastWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.functi onType(E, [])}],
1124 singleWhere: [E, [dart.functionType(core.bool, [E])]],
1125 elementAt: [E, [core.int]]
1126 }),
1127 statics: () => ({
1128 iterableToShortString: [core.String, [core.Iterable], [core.String, core .String]],
1129 iterableToFullString: [core.String, [core.Iterable], [core.String, core. String]],
1130 _isToStringVisiting: [core.bool, [core.Object]],
1131 _iterablePartsToStrings: [dart.void, [core.Iterable, core.List]]
1132 }),
1133 names: ['iterableToShortString', 'iterableToFullString', '_isToStringVisit ing', '_iterablePartsToStrings']
1134 });
1135 dart.defineExtensionMembers(IterableBase, [
1136 'map',
1137 'where',
1138 'expand',
1139 'contains',
1140 'forEach',
1141 'reduce',
1142 'fold',
1143 'every',
1144 'join',
1145 'any',
1146 'toList',
1147 'toSet',
1148 'take',
1149 'takeWhile',
1150 'skip',
1151 'skipWhile',
1152 'firstWhere',
1153 'lastWhere',
1154 'singleWhere',
1155 'elementAt',
1156 'length',
1157 'isEmpty',
1158 'isNotEmpty',
1159 'first',
1160 'last',
1161 'single'
1162 ]);
1163 dart.defineLazyProperties(IterableBase, {
1164 get _toStringVisiting() {
1165 return [];
1166 }
1167 });
1168 return IterableBase;
1169 });
1170 let IterableBase = IterableBase$();
1171 const _iterator = Symbol('_iterator');
1172 const _state = Symbol('_state');
1173 const _move = Symbol('_move');
1174 const HasNextIterator$ = dart.generic(function(E) {
1175 class HasNextIterator extends core.Object {
1176 HasNextIterator(iterator) {
1177 this[_iterator] = iterator;
1178 this[_state] = HasNextIterator$()._NOT_MOVED_YET;
1179 }
1180 get hasNext() {
1181 if (this[_state] == HasNextIterator$()._NOT_MOVED_YET) this[_move]();
1182 return this[_state] == HasNextIterator$()._HAS_NEXT_AND_NEXT_IN_CURRENT;
1183 }
1184 next() {
1185 if (!dart.notNull(this.hasNext)) dart.throw(new core.StateError("No more elements"));
1186 dart.assert(this[_state] == HasNextIterator$()._HAS_NEXT_AND_NEXT_IN_CUR RENT);
1187 let result = dart.as(this[_iterator].current, E);
1188 this[_move]();
1189 return result;
1190 }
1191 [_move]() {
1192 if (dart.notNull(this[_iterator].moveNext())) {
1193 this[_state] = HasNextIterator$()._HAS_NEXT_AND_NEXT_IN_CURRENT;
1194 } else {
1195 this[_state] = HasNextIterator$()._NO_NEXT;
1196 }
1197 }
1198 }
1199 dart.setSignature(HasNextIterator, {
1200 constructors: () => ({HasNextIterator: [HasNextIterator$(E), [core.Iterato r]]}),
1201 methods: () => ({
1202 next: [E, []],
1203 [_move]: [dart.void, []]
1204 })
1205 });
1206 HasNextIterator._HAS_NEXT_AND_NEXT_IN_CURRENT = 0;
1207 HasNextIterator._NO_NEXT = 1;
1208 HasNextIterator._NOT_MOVED_YET = 2;
1209 return HasNextIterator;
1210 });
1211 let HasNextIterator = HasNextIterator$();
1212 const LinkedHashMap$ = dart.generic(function(K, V) {
1213 class LinkedHashMap extends core.Object {
1214 static new(opts) {
1215 let equals = opts && 'equals' in opts ? opts.equals : null;
1216 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1217 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1218 if (isValidKey == null) {
1219 if (hashCode == null) {
1220 if (equals == null) {
1221 return new (_LinkedHashMap$(K, V))();
1222 }
1223 hashCode = _defaultHashCode;
1224 } else {
1225 if (core.identical(core.identityHashCode, hashCode) && core.identica l(core.identical, equals)) {
1226 return new (_LinkedIdentityHashMap$(K, V))();
1227 }
1228 if (equals == null) {
1229 equals = _defaultEquals;
1230 }
1231 }
1232 } else {
1233 if (hashCode == null) {
1234 hashCode = _defaultHashCode;
1235 }
1236 if (equals == null) {
1237 equals = _defaultEquals;
1238 }
1239 }
1240 return new (_LinkedCustomHashMap$(K, V))(equals, hashCode, isValidKey);
1241 }
1242 static identity() {
1243 return new (_LinkedIdentityHashMap$(K, V))();
1244 }
1245 static from(other) {
1246 let result = LinkedHashMap$(K, V).new();
1247 other[dartx.forEach](dart.fn((k, v) => {
1248 result.set(dart.as(k, K), dart.as(v, V));
1249 }, dart.void, [dart.dynamic, dart.dynamic]));
1250 return result;
1251 }
1252 static fromIterable(iterable, opts) {
1253 let key = opts && 'key' in opts ? opts.key : null;
1254 let value = opts && 'value' in opts ? opts.value : null;
1255 let map = LinkedHashMap$(K, V).new();
1256 Maps._fillMapWithMappedIterable(map, iterable, key, value);
1257 return map;
1258 }
1259 static fromIterables(keys, values) {
1260 let map = LinkedHashMap$(K, V).new();
1261 Maps._fillMapWithIterables(map, keys, values);
1262 return map;
1263 }
1264 static _literal(keyValuePairs) {
1265 return dart.as(_js_helper.fillLiteralMap(keyValuePairs, new (_LinkedHash Map$(K, V))()), LinkedHashMap$(K, V));
1266 }
1267 static _empty() {
1268 return new (_LinkedHashMap$(K, V))();
1269 }
1270 }
1271 LinkedHashMap[dart.implements] = () => [HashMap$(K, V)];
1272 dart.setSignature(LinkedHashMap, {
1273 constructors: () => ({
1274 new: [LinkedHashMap$(K, V), [], {equals: dart.functionType(core.bool, [K , K]), hashCode: dart.functionType(core.int, [K]), isValidKey: dart.functionType (core.bool, [core.Object])}],
1275 identity: [LinkedHashMap$(K, V), []],
1276 from: [LinkedHashMap$(K, V), [core.Map]],
1277 fromIterable: [LinkedHashMap$(K, V), [core.Iterable], {key: dart.functio nType(K, [dart.dynamic]), value: dart.functionType(V, [dart.dynamic])}],
1278 fromIterables: [LinkedHashMap$(K, V), [core.Iterable$(K), core.Iterable$ (V)]],
1279 _literal: [LinkedHashMap$(K, V), [core.List]],
1280 _empty: [LinkedHashMap$(K, V), []]
1281 })
1282 });
1283 return LinkedHashMap;
1284 });
1285 let LinkedHashMap = LinkedHashMap$();
1286 const LinkedHashSet$ = dart.generic(function(E) {
1287 class LinkedHashSet extends core.Object {
1288 static new(opts) {
1289 let equals = opts && 'equals' in opts ? opts.equals : null;
1290 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1291 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1292 if (isValidKey == null) {
1293 if (hashCode == null) {
1294 if (equals == null) {
1295 return new (_LinkedHashSet$(E))();
1296 }
1297 hashCode = _defaultHashCode;
1298 } else {
1299 if (core.identical(core.identityHashCode, hashCode) && core.identica l(core.identical, equals)) {
1300 return new (_LinkedIdentityHashSet$(E))();
1301 }
1302 if (equals == null) {
1303 equals = _defaultEquals;
1304 }
1305 }
1306 } else {
1307 if (hashCode == null) {
1308 hashCode = _defaultHashCode;
1309 }
1310 if (equals == null) {
1311 equals = _defaultEquals;
1312 }
1313 }
1314 return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey);
1315 }
1316 static identity() {
1317 return new (_LinkedIdentityHashSet$(E))();
1318 }
1319 static from(elements) {
1320 let result = LinkedHashSet$(E).new();
1321 for (let element of elements) {
1322 result.add(element);
1323 }
1324 return result;
1325 }
1326 [Symbol.iterator]() {
1327 return new dart.JsIterator(this.iterator);
1328 }
1329 }
1330 LinkedHashSet[dart.implements] = () => [HashSet$(E)];
1331 dart.setSignature(LinkedHashSet, {
1332 constructors: () => ({
1333 new: [LinkedHashSet$(E), [], {equals: dart.functionType(core.bool, [E, E ]), hashCode: dart.functionType(core.int, [E]), isValidKey: dart.functionType(co re.bool, [core.Object])}],
1334 identity: [LinkedHashSet$(E), []],
1335 from: [LinkedHashSet$(E), [core.Iterable$(E)]]
1336 })
1337 });
1338 return LinkedHashSet;
1339 });
1340 let LinkedHashSet = LinkedHashSet$();
1341 const _modificationCount = Symbol('_modificationCount');
1342 const _length = Symbol('_length');
1343 const _next = Symbol('_next');
1344 const _previous = Symbol('_previous');
1345 const _insertAfter = Symbol('_insertAfter');
1346 const _list = Symbol('_list');
1347 const _unlink = Symbol('_unlink');
1348 const LinkedList$ = dart.generic(function(E) {
1349 class LinkedList extends IterableBase$(E) {
1350 LinkedList() {
1351 this[_modificationCount] = 0;
1352 this[_length] = 0;
1353 this[_next] = null;
1354 this[_previous] = null;
1355 super.IterableBase();
1356 this[_next] = this[_previous] = this;
1357 }
1358 addFirst(entry) {
1359 dart.as(entry, E);
1360 this[_insertAfter](this, entry);
1361 }
1362 add(entry) {
1363 dart.as(entry, E);
1364 this[_insertAfter](this[_previous], entry);
1365 }
1366 addAll(entries) {
1367 dart.as(entries, core.Iterable$(E));
1368 entries[dartx.forEach](dart.fn(entry => {
1369 dart.as(entry, E);
1370 return this[_insertAfter](this[_previous], entry);
1371 }, dart.void, [E]));
1372 }
1373 remove(entry) {
1374 dart.as(entry, E);
1375 if (!dart.equals(entry[_list], this)) return false;
1376 this[_unlink](entry);
1377 return true;
1378 }
1379 get iterator() {
1380 return new (_LinkedListIterator$(E))(this);
1381 }
1382 get length() {
1383 return this[_length];
1384 }
1385 clear() {
1386 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
1387 let next = this[_next];
1388 while (!core.identical(next, this)) {
1389 let entry = dart.as(next, E);
1390 next = entry[_next];
1391 entry[_next] = entry[_previous] = entry[_list] = null;
1392 }
1393 this[_next] = this[_previous] = this;
1394 this[_length] = 0;
1395 }
1396 get first() {
1397 if (core.identical(this[_next], this)) {
1398 dart.throw(new core.StateError('No such element'));
1399 }
1400 return dart.as(this[_next], E);
1401 }
1402 get last() {
1403 if (core.identical(this[_previous], this)) {
1404 dart.throw(new core.StateError('No such element'));
1405 }
1406 return dart.as(this[_previous], E);
1407 }
1408 get single() {
1409 if (core.identical(this[_previous], this)) {
1410 dart.throw(new core.StateError('No such element'));
1411 }
1412 if (!core.identical(this[_previous], this[_next])) {
1413 dart.throw(new core.StateError('Too many elements'));
1414 }
1415 return dart.as(this[_next], E);
1416 }
1417 forEach(action) {
1418 dart.as(action, dart.functionType(dart.void, [E]));
1419 let modificationCount = this[_modificationCount];
1420 let current = this[_next];
1421 while (!core.identical(current, this)) {
1422 action(dart.as(current, E));
1423 if (modificationCount != this[_modificationCount]) {
1424 dart.throw(new core.ConcurrentModificationError(this));
1425 }
1426 current = current[_next];
1427 }
1428 }
1429 get isEmpty() {
1430 return this[_length] == 0;
1431 }
1432 [_insertAfter](entry, newEntry) {
1433 dart.as(newEntry, E);
1434 if (newEntry.list != null) {
1435 dart.throw(new core.StateError('LinkedListEntry is already in a Linked List'));
1436 }
1437 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
1438 newEntry[_list] = this;
1439 let predecessor = entry;
1440 let successor = entry[_next];
1441 successor[_previous] = newEntry;
1442 newEntry[_previous] = predecessor;
1443 newEntry[_next] = successor;
1444 predecessor[_next] = newEntry;
1445 this[_length] = dart.notNull(this[_length]) + 1;
1446 }
1447 [_unlink](entry) {
1448 dart.as(entry, LinkedListEntry$(E));
1449 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
1450 entry[_next][_previous] = entry[_previous];
1451 entry[_previous][_next] = entry[_next];
1452 this[_length] = dart.notNull(this[_length]) - 1;
1453 entry[_list] = entry[_next] = entry[_previous] = null;
1454 }
1455 }
1456 LinkedList[dart.implements] = () => [_LinkedListLink];
1457 dart.setSignature(LinkedList, {
1458 constructors: () => ({LinkedList: [LinkedList$(E), []]}),
1459 methods: () => ({
1460 addFirst: [dart.void, [E]],
1461 add: [dart.void, [E]],
1462 addAll: [dart.void, [core.Iterable$(E)]],
1463 remove: [core.bool, [E]],
1464 clear: [dart.void, []],
1465 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
1466 [_insertAfter]: [dart.void, [_LinkedListLink, E]],
1467 [_unlink]: [dart.void, [LinkedListEntry$(E)]]
1468 })
1469 });
1470 dart.defineExtensionMembers(LinkedList, [
1471 'forEach',
1472 'iterator',
1473 'length',
1474 'first',
1475 'last',
1476 'single',
1477 'isEmpty'
1478 ]);
1479 return LinkedList;
1480 });
1481 let LinkedList = LinkedList$();
1482 const _current = Symbol('_current');
1483 const _LinkedListIterator$ = dart.generic(function(E) {
1484 class _LinkedListIterator extends core.Object {
1485 _LinkedListIterator(list) {
1486 this[_list] = list;
1487 this[_modificationCount] = list[_modificationCount];
1488 this[_next] = list[_next];
1489 this[_current] = null;
1490 }
1491 get current() {
1492 return this[_current];
1493 }
1494 moveNext() {
1495 if (core.identical(this[_next], this[_list])) {
1496 this[_current] = null;
1497 return false;
1498 }
1499 if (this[_modificationCount] != this[_list][_modificationCount]) {
1500 dart.throw(new core.ConcurrentModificationError(this));
1501 }
1502 this[_current] = dart.as(this[_next], E);
1503 this[_next] = this[_next][_next];
1504 return true;
1505 }
1506 }
1507 _LinkedListIterator[dart.implements] = () => [core.Iterator$(E)];
1508 dart.setSignature(_LinkedListIterator, {
1509 constructors: () => ({_LinkedListIterator: [_LinkedListIterator$(E), [Link edList$(E)]]}),
1510 methods: () => ({moveNext: [core.bool, []]})
1511 });
1512 return _LinkedListIterator;
1513 });
1514 let _LinkedListIterator = _LinkedListIterator$();
1515 class _LinkedListLink extends core.Object {
1516 _LinkedListLink() {
1517 this[_next] = null;
1518 this[_previous] = null;
1519 }
1520 }
1521 const LinkedListEntry$ = dart.generic(function(E) {
1522 class LinkedListEntry extends core.Object {
1523 LinkedListEntry() {
1524 this[_list] = null;
1525 this[_next] = null;
1526 this[_previous] = null;
1527 }
1528 get list() {
1529 return this[_list];
1530 }
1531 unlink() {
1532 this[_list][_unlink](this);
1533 }
1534 get next() {
1535 if (core.identical(this[_next], this[_list])) return null;
1536 let result = dart.as(this[_next], E);
1537 return result;
1538 }
1539 get previous() {
1540 if (core.identical(this[_previous], this[_list])) return null;
1541 return dart.as(this[_previous], E);
1542 }
1543 insertAfter(entry) {
1544 dart.as(entry, E);
1545 this[_list][_insertAfter](this, entry);
1546 }
1547 insertBefore(entry) {
1548 dart.as(entry, E);
1549 this[_list][_insertAfter](this[_previous], entry);
1550 }
1551 }
1552 LinkedListEntry[dart.implements] = () => [_LinkedListLink];
1553 dart.setSignature(LinkedListEntry, {
1554 methods: () => ({
1555 unlink: [dart.void, []],
1556 insertAfter: [dart.void, [E]],
1557 insertBefore: [dart.void, [E]]
1558 })
1559 });
1560 return LinkedListEntry;
1561 });
1562 let LinkedListEntry = LinkedListEntry$();
1563 const ListMixin$ = dart.generic(function(E) {
1564 dart.defineExtensionNames([
1565 'iterator',
1566 'elementAt',
1567 'forEach',
1568 'isEmpty',
1569 'isNotEmpty',
1570 'first',
1571 'last',
1572 'single',
1573 'contains',
1574 'every',
1575 'any',
1576 'firstWhere',
1577 'lastWhere',
1578 'singleWhere',
1579 'join',
1580 'where',
1581 'map',
1582 'expand',
1583 'reduce',
1584 'fold',
1585 'skip',
1586 'skipWhile',
1587 'take',
1588 'takeWhile',
1589 'toList',
1590 'toSet',
1591 'add',
1592 'addAll',
1593 'remove',
1594 'removeWhere',
1595 'retainWhere',
1596 'clear',
1597 'removeLast',
1598 'sort',
1599 'shuffle',
1600 'asMap',
1601 'sublist',
1602 'getRange',
1603 'removeRange',
1604 'fillRange',
1605 'setRange',
1606 'replaceRange',
1607 'indexOf',
1608 'lastIndexOf',
1609 'insert',
1610 'removeAt',
1611 'insertAll',
1612 'setAll',
1613 'reversed',
1614 'toString'
1615 ]);
1616 class ListMixin extends core.Object {
1617 get [dartx.iterator]() {
1618 return new (_internal.ListIterator$(E))(this);
1619 }
1620 [Symbol.iterator]() {
1621 return new dart.JsIterator(this[dartx.iterator]);
1622 }
1623 [dartx.elementAt](index) {
1624 return this[dartx.get](index);
1625 }
1626 [dartx.forEach](action) {
1627 dart.as(action, dart.functionType(dart.void, [E]));
1628 let length = this[dartx.length];
1629 for (let i = 0; i < dart.notNull(length); i++) {
1630 action(this[dartx.get](i));
1631 if (length != this[dartx.length]) {
1632 dart.throw(new core.ConcurrentModificationError(this));
1633 }
1634 }
1635 }
1636 get [dartx.isEmpty]() {
1637 return this[dartx.length] == 0;
1638 }
1639 get [dartx.isNotEmpty]() {
1640 return !dart.notNull(this[dartx.isEmpty]);
1641 }
1642 get [dartx.first]() {
1643 if (this[dartx.length] == 0) dart.throw(_internal.IterableElementError.n oElement());
1644 return this[dartx.get](0);
1645 }
1646 get [dartx.last]() {
1647 if (this[dartx.length] == 0) dart.throw(_internal.IterableElementError.n oElement());
1648 return this[dartx.get](dart.notNull(this[dartx.length]) - 1);
1649 }
1650 get [dartx.single]() {
1651 if (this[dartx.length] == 0) dart.throw(_internal.IterableElementError.n oElement());
1652 if (dart.notNull(this[dartx.length]) > 1) dart.throw(_internal.IterableE lementError.tooMany());
1653 return this[dartx.get](0);
1654 }
1655 [dartx.contains](element) {
1656 let length = this[dartx.length];
1657 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) {
1658 if (dart.equals(this[dartx.get](i), element)) return true;
1659 if (length != this[dartx.length]) {
1660 dart.throw(new core.ConcurrentModificationError(this));
1661 }
1662 }
1663 return false;
1664 }
1665 [dartx.every](test) {
1666 dart.as(test, dart.functionType(core.bool, [E]));
1667 let length = this[dartx.length];
1668 for (let i = 0; i < dart.notNull(length); i++) {
1669 if (!dart.notNull(test(this[dartx.get](i)))) return false;
1670 if (length != this[dartx.length]) {
1671 dart.throw(new core.ConcurrentModificationError(this));
1672 }
1673 }
1674 return true;
1675 }
1676 [dartx.any](test) {
1677 dart.as(test, dart.functionType(core.bool, [E]));
1678 let length = this[dartx.length];
1679 for (let i = 0; i < dart.notNull(length); i++) {
1680 if (dart.notNull(test(this[dartx.get](i)))) return true;
1681 if (length != this[dartx.length]) {
1682 dart.throw(new core.ConcurrentModificationError(this));
1683 }
1684 }
1685 return false;
1686 }
1687 [dartx.firstWhere](test, opts) {
1688 dart.as(test, dart.functionType(core.bool, [E]));
1689 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
1690 dart.as(orElse, dart.functionType(E, []));
1691 let length = this[dartx.length];
1692 for (let i = 0; i < dart.notNull(length); i++) {
1693 let element = this[dartx.get](i);
1694 if (dart.notNull(test(element))) return element;
1695 if (length != this[dartx.length]) {
1696 dart.throw(new core.ConcurrentModificationError(this));
1697 }
1698 }
1699 if (orElse != null) return orElse();
1700 dart.throw(_internal.IterableElementError.noElement());
1701 }
1702 [dartx.lastWhere](test, opts) {
1703 dart.as(test, dart.functionType(core.bool, [E]));
1704 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
1705 dart.as(orElse, dart.functionType(E, []));
1706 let length = this[dartx.length];
1707 for (let i = dart.notNull(length) - 1; i >= 0; i--) {
1708 let element = this[dartx.get](i);
1709 if (dart.notNull(test(element))) return element;
1710 if (length != this[dartx.length]) {
1711 dart.throw(new core.ConcurrentModificationError(this));
1712 }
1713 }
1714 if (orElse != null) return orElse();
1715 dart.throw(_internal.IterableElementError.noElement());
1716 }
1717 [dartx.singleWhere](test) {
1718 dart.as(test, dart.functionType(core.bool, [E]));
1719 let length = this[dartx.length];
1720 let match = null;
1721 let matchFound = false;
1722 for (let i = 0; i < dart.notNull(length); i++) {
1723 let element = this[dartx.get](i);
1724 if (dart.notNull(test(element))) {
1725 if (matchFound) {
1726 dart.throw(_internal.IterableElementError.tooMany());
1727 }
1728 matchFound = true;
1729 match = element;
1730 }
1731 if (length != this[dartx.length]) {
1732 dart.throw(new core.ConcurrentModificationError(this));
1733 }
1734 }
1735 if (matchFound) return match;
1736 dart.throw(_internal.IterableElementError.noElement());
1737 }
1738 [dartx.join](separator) {
1739 if (separator === void 0) separator = "";
1740 if (this[dartx.length] == 0) return "";
1741 let buffer = new core.StringBuffer();
1742 buffer.writeAll(this, separator);
1743 return buffer.toString();
1744 }
1745 [dartx.where](test) {
1746 dart.as(test, dart.functionType(core.bool, [E]));
1747 return new (_internal.WhereIterable$(E))(this, test);
1748 }
1749 [dartx.map](f) {
1750 dart.as(f, dart.functionType(dart.dynamic, [E]));
1751 return new (_internal.MappedListIterable$(E, dart.dynamic))(this, f);
1752 }
1753 [dartx.expand](f) {
1754 dart.as(f, dart.functionType(core.Iterable, [E]));
1755 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
1756 }
1757 [dartx.reduce](combine) {
1758 dart.as(combine, dart.functionType(E, [E, E]));
1759 let length = this[dartx.length];
1760 if (length == 0) dart.throw(_internal.IterableElementError.noElement());
1761 let value = this[dartx.get](0);
1762 for (let i = 1; i < dart.notNull(length); i++) {
1763 value = combine(value, this[dartx.get](i));
1764 if (length != this[dartx.length]) {
1765 dart.throw(new core.ConcurrentModificationError(this));
1766 }
1767 }
1768 return value;
1769 }
1770 [dartx.fold](initialValue, combine) {
1771 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E]));
1772 let value = initialValue;
1773 let length = this[dartx.length];
1774 for (let i = 0; i < dart.notNull(length); i++) {
1775 value = combine(value, this[dartx.get](i));
1776 if (length != this[dartx.length]) {
1777 dart.throw(new core.ConcurrentModificationError(this));
1778 }
1779 }
1780 return value;
1781 }
1782 [dartx.skip](count) {
1783 return new (_internal.SubListIterable$(E))(this, count, null);
1784 }
1785 [dartx.skipWhile](test) {
1786 dart.as(test, dart.functionType(core.bool, [E]));
1787 return new (_internal.SkipWhileIterable$(E))(this, test);
1788 }
1789 [dartx.take](count) {
1790 return new (_internal.SubListIterable$(E))(this, 0, count);
1791 }
1792 [dartx.takeWhile](test) {
1793 dart.as(test, dart.functionType(core.bool, [E]));
1794 return new (_internal.TakeWhileIterable$(E))(this, test);
1795 }
1796 [dartx.toList](opts) {
1797 let growable = opts && 'growable' in opts ? opts.growable : true;
1798 let result = null;
1799 if (dart.notNull(growable)) {
1800 result = core.List$(E).new();
1801 result[dartx.length] = this[dartx.length];
1802 } else {
1803 result = core.List$(E).new(this[dartx.length]);
1804 }
1805 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) {
1806 result[dartx.set](i, this[dartx.get](i));
1807 }
1808 return result;
1809 }
1810 [dartx.toSet]() {
1811 let result = core.Set$(E).new();
1812 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) {
1813 result.add(this[dartx.get](i));
1814 }
1815 return result;
1816 }
1817 [dartx.add](element) {
1818 dart.as(element, E);
1819 this[dartx.set]((() => {
1820 let x = this[dartx.length];
1821 this[dartx.length] = dart.notNull(x) + 1;
1822 return x;
1823 })(), element);
1824 }
1825 [dartx.addAll](iterable) {
1826 dart.as(iterable, core.Iterable$(E));
1827 for (let element of iterable) {
1828 this[dartx.set]((() => {
1829 let x = this[dartx.length];
1830 this[dartx.length] = dart.notNull(x) + 1;
1831 return x;
1832 })(), element);
1833 }
1834 }
1835 [dartx.remove](element) {
1836 for (let i = 0; i < dart.notNull(this[dartx.length]); i++) {
1837 if (dart.equals(this[dartx.get](i), element)) {
1838 this[dartx.setRange](i, dart.notNull(this[dartx.length]) - 1, this, i + 1);
1839 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
1840 return true;
1841 }
1842 }
1843 return false;
1844 }
1845 [dartx.removeWhere](test) {
1846 dart.as(test, dart.functionType(core.bool, [E]));
1847 ListMixin$()._filter(this, test, false);
1848 }
1849 [dartx.retainWhere](test) {
1850 dart.as(test, dart.functionType(core.bool, [E]));
1851 ListMixin$()._filter(this, test, true);
1852 }
1853 static _filter(source, test, retainMatching) {
1854 let retained = [];
1855 let length = source[dartx.length];
1856 for (let i = 0; i < dart.notNull(length); i++) {
1857 let element = source[dartx.get](i);
1858 if (dart.dcall(test, element) == retainMatching) {
1859 retained[dartx.add](element);
1860 }
1861 if (length != source[dartx.length]) {
1862 dart.throw(new core.ConcurrentModificationError(source));
1863 }
1864 }
1865 if (retained[dartx.length] != source[dartx.length]) {
1866 source[dartx.setRange](0, retained[dartx.length], retained);
1867 source[dartx.length] = retained[dartx.length];
1868 }
1869 }
1870 [dartx.clear]() {
1871 this[dartx.length] = 0;
1872 }
1873 [dartx.removeLast]() {
1874 if (this[dartx.length] == 0) {
1875 dart.throw(_internal.IterableElementError.noElement());
1876 }
1877 let result = this[dartx.get](dart.notNull(this[dartx.length]) - 1);
1878 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
1879 return result;
1880 }
1881 [dartx.sort](compare) {
1882 if (compare === void 0) compare = null;
1883 dart.as(compare, dart.functionType(core.int, [E, E]));
1884 _internal.Sort.sort(this, compare == null ? core.Comparable.compare : co mpare);
1885 }
1886 [dartx.shuffle](random) {
1887 if (random === void 0) random = null;
1888 if (random == null) random = math.Random.new();
1889 let length = this[dartx.length];
1890 while (dart.notNull(length) > 1) {
1891 let pos = random.nextInt(length);
1892 length = dart.notNull(length) - 1;
1893 let tmp = this[dartx.get](length);
1894 this[dartx.set](length, this[dartx.get](pos));
1895 this[dartx.set](pos, tmp);
1896 }
1897 }
1898 [dartx.asMap]() {
1899 return new (_internal.ListMapView$(E))(this);
1900 }
1901 [dartx.sublist](start, end) {
1902 if (end === void 0) end = null;
1903 let listLength = this[dartx.length];
1904 if (end == null) end = listLength;
1905 core.RangeError.checkValidRange(start, end, listLength);
1906 let length = dart.notNull(end) - dart.notNull(start);
1907 let result = core.List$(E).new();
1908 result[dartx.length] = length;
1909 for (let i = 0; i < length; i++) {
1910 result[dartx.set](i, this[dartx.get](dart.notNull(start) + i));
1911 }
1912 return result;
1913 }
1914 [dartx.getRange](start, end) {
1915 core.RangeError.checkValidRange(start, end, this[dartx.length]);
1916 return new (_internal.SubListIterable$(E))(this, start, end);
1917 }
1918 [dartx.removeRange](start, end) {
1919 core.RangeError.checkValidRange(start, end, this[dartx.length]);
1920 let length = dart.notNull(end) - dart.notNull(start);
1921 this[dartx.setRange](start, dart.notNull(this[dartx.length]) - length, t his, end);
1922 this[dartx.length] = dart.notNull(this[dartx.length]) - length;
1923 }
1924 [dartx.fillRange](start, end, fill) {
1925 if (fill === void 0) fill = null;
1926 dart.as(fill, E);
1927 core.RangeError.checkValidRange(start, end, this[dartx.length]);
1928 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
1929 this[dartx.set](i, fill);
1930 }
1931 }
1932 [dartx.setRange](start, end, iterable, skipCount) {
1933 dart.as(iterable, core.Iterable$(E));
1934 if (skipCount === void 0) skipCount = 0;
1935 core.RangeError.checkValidRange(start, end, this[dartx.length]);
1936 let length = dart.notNull(end) - dart.notNull(start);
1937 if (length == 0) return;
1938 core.RangeError.checkNotNegative(skipCount, "skipCount");
1939 let otherList = null;
1940 let otherStart = null;
1941 if (dart.is(iterable, core.List)) {
1942 otherList = dart.as(iterable, core.List);
1943 otherStart = skipCount;
1944 } else {
1945 otherList = iterable[dartx.skip](skipCount)[dartx.toList]({growable: f alse});
1946 otherStart = 0;
1947 }
1948 if (dart.notNull(otherStart) + length > dart.notNull(otherList[dartx.len gth])) {
1949 dart.throw(_internal.IterableElementError.tooFew());
1950 }
1951 if (dart.notNull(otherStart) < dart.notNull(start)) {
1952 for (let i = length - 1; i >= 0; i--) {
1953 this[dartx.set](dart.notNull(start) + i, dart.as(otherList[dartx.get ](dart.notNull(otherStart) + i), E));
1954 }
1955 } else {
1956 for (let i = 0; i < length; i++) {
1957 this[dartx.set](dart.notNull(start) + i, dart.as(otherList[dartx.get ](dart.notNull(otherStart) + i), E));
1958 }
1959 }
1960 }
1961 [dartx.replaceRange](start, end, newContents) {
1962 dart.as(newContents, core.Iterable$(E));
1963 core.RangeError.checkValidRange(start, end, this[dartx.length]);
1964 if (!dart.is(newContents, _internal.EfficientLength)) {
1965 newContents = newContents[dartx.toList]();
1966 }
1967 let removeLength = dart.notNull(end) - dart.notNull(start);
1968 let insertLength = newContents[dartx.length];
1969 if (removeLength >= dart.notNull(insertLength)) {
1970 let delta = removeLength - dart.notNull(insertLength);
1971 let insertEnd = dart.notNull(start) + dart.notNull(insertLength);
1972 let newLength = dart.notNull(this[dartx.length]) - delta;
1973 this[dartx.setRange](start, insertEnd, newContents);
1974 if (delta != 0) {
1975 this[dartx.setRange](insertEnd, newLength, this, end);
1976 this[dartx.length] = newLength;
1977 }
1978 } else {
1979 let delta = dart.notNull(insertLength) - removeLength;
1980 let newLength = dart.notNull(this[dartx.length]) + delta;
1981 let insertEnd = dart.notNull(start) + dart.notNull(insertLength);
1982 this[dartx.length] = newLength;
1983 this[dartx.setRange](insertEnd, newLength, this, end);
1984 this[dartx.setRange](start, insertEnd, newContents);
1985 }
1986 }
1987 [dartx.indexOf](element, startIndex) {
1988 if (startIndex === void 0) startIndex = 0;
1989 if (dart.notNull(startIndex) >= dart.notNull(this[dartx.length])) {
1990 return -1;
1991 }
1992 if (dart.notNull(startIndex) < 0) {
1993 startIndex = 0;
1994 }
1995 for (let i = startIndex; dart.notNull(i) < dart.notNull(this[dartx.lengt h]); i = dart.notNull(i) + 1) {
1996 if (dart.equals(this[dartx.get](i), element)) {
1997 return i;
1998 }
1999 }
2000 return -1;
2001 }
2002 [dartx.lastIndexOf](element, startIndex) {
2003 if (startIndex === void 0) startIndex = null;
2004 if (startIndex == null) {
2005 startIndex = dart.notNull(this[dartx.length]) - 1;
2006 } else {
2007 if (dart.notNull(startIndex) < 0) {
2008 return -1;
2009 }
2010 if (dart.notNull(startIndex) >= dart.notNull(this[dartx.length])) {
2011 startIndex = dart.notNull(this[dartx.length]) - 1;
2012 }
2013 }
2014 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
2015 if (dart.equals(this[dartx.get](i), element)) {
2016 return i;
2017 }
2018 }
2019 return -1;
2020 }
2021 [dartx.insert](index, element) {
2022 dart.as(element, E);
2023 core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "inde x");
2024 if (index == this[dartx.length]) {
2025 this[dartx.add](element);
2026 return;
2027 }
2028 if (!(typeof index == 'number')) dart.throw(new core.ArgumentError(index ));
2029 this[dartx.length] = dart.notNull(this[dartx.length]) + 1;
2030 this[dartx.setRange](dart.notNull(index) + 1, this[dartx.length], this, index);
2031 this[dartx.set](index, element);
2032 }
2033 [dartx.removeAt](index) {
2034 let result = this[dartx.get](index);
2035 this[dartx.setRange](index, dart.notNull(this[dartx.length]) - 1, this, dart.notNull(index) + 1);
2036 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
2037 return result;
2038 }
2039 [dartx.insertAll](index, iterable) {
2040 dart.as(iterable, core.Iterable$(E));
2041 core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "inde x");
2042 if (dart.is(iterable, _internal.EfficientLength)) {
2043 iterable = iterable[dartx.toList]();
2044 }
2045 let insertionLength = iterable[dartx.length];
2046 this[dartx.length] = dart.notNull(this[dartx.length]) + dart.notNull(ins ertionLength);
2047 this[dartx.setRange](dart.notNull(index) + dart.notNull(insertionLength) , this[dartx.length], this, index);
2048 this[dartx.setAll](index, iterable);
2049 }
2050 [dartx.setAll](index, iterable) {
2051 dart.as(iterable, core.Iterable$(E));
2052 if (dart.is(iterable, core.List)) {
2053 this[dartx.setRange](index, dart.notNull(index) + dart.notNull(iterabl e[dartx.length]), iterable);
2054 } else {
2055 for (let element of iterable) {
2056 this[dartx.set]((() => {
2057 let x = index;
2058 index = dart.notNull(x) + 1;
2059 return x;
2060 })(), element);
2061 }
2062 }
2063 }
2064 get [dartx.reversed]() {
2065 return new (_internal.ReversedListIterable$(E))(this);
2066 }
2067 toString() {
2068 return IterableBase.iterableToFullString(this, '[', ']');
2069 }
2070 }
2071 ListMixin[dart.implements] = () => [core.List$(E)];
2072 dart.setSignature(ListMixin, {
2073 methods: () => ({
2074 [dartx.elementAt]: [E, [core.int]],
2075 [dartx.forEach]: [dart.void, [dart.functionType(dart.void, [E])]],
2076 [dartx.contains]: [core.bool, [core.Object]],
2077 [dartx.every]: [core.bool, [dart.functionType(core.bool, [E])]],
2078 [dartx.any]: [core.bool, [dart.functionType(core.bool, [E])]],
2079 [dartx.firstWhere]: [E, [dart.functionType(core.bool, [E])], {orElse: da rt.functionType(E, [])}],
2080 [dartx.lastWhere]: [E, [dart.functionType(core.bool, [E])], {orElse: dar t.functionType(E, [])}],
2081 [dartx.singleWhere]: [E, [dart.functionType(core.bool, [E])]],
2082 [dartx.join]: [core.String, [], [core.String]],
2083 [dartx.where]: [core.Iterable$(E), [dart.functionType(core.bool, [E])]],
2084 [dartx.map]: [core.Iterable, [dart.functionType(dart.dynamic, [E])]],
2085 [dartx.expand]: [core.Iterable, [dart.functionType(core.Iterable, [E])]] ,
2086 [dartx.reduce]: [E, [dart.functionType(E, [E, E])]],
2087 [dartx.fold]: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynam ic, [dart.dynamic, E])]],
2088 [dartx.skip]: [core.Iterable$(E), [core.int]],
2089 [dartx.skipWhile]: [core.Iterable$(E), [dart.functionType(core.bool, [E] )]],
2090 [dartx.take]: [core.Iterable$(E), [core.int]],
2091 [dartx.takeWhile]: [core.Iterable$(E), [dart.functionType(core.bool, [E] )]],
2092 [dartx.toList]: [core.List$(E), [], {growable: core.bool}],
2093 [dartx.toSet]: [core.Set$(E), []],
2094 [dartx.add]: [dart.void, [E]],
2095 [dartx.addAll]: [dart.void, [core.Iterable$(E)]],
2096 [dartx.remove]: [core.bool, [core.Object]],
2097 [dartx.removeWhere]: [dart.void, [dart.functionType(core.bool, [E])]],
2098 [dartx.retainWhere]: [dart.void, [dart.functionType(core.bool, [E])]],
2099 [dartx.clear]: [dart.void, []],
2100 [dartx.removeLast]: [E, []],
2101 [dartx.sort]: [dart.void, [], [dart.functionType(core.int, [E, E])]],
2102 [dartx.shuffle]: [dart.void, [], [math.Random]],
2103 [dartx.asMap]: [core.Map$(core.int, E), []],
2104 [dartx.sublist]: [core.List$(E), [core.int], [core.int]],
2105 [dartx.getRange]: [core.Iterable$(E), [core.int, core.int]],
2106 [dartx.removeRange]: [dart.void, [core.int, core.int]],
2107 [dartx.fillRange]: [dart.void, [core.int, core.int], [E]],
2108 [dartx.setRange]: [dart.void, [core.int, core.int, core.Iterable$(E)], [ core.int]],
2109 [dartx.replaceRange]: [dart.void, [core.int, core.int, core.Iterable$(E) ]],
2110 [dartx.indexOf]: [core.int, [core.Object], [core.int]],
2111 [dartx.lastIndexOf]: [core.int, [core.Object], [core.int]],
2112 [dartx.insert]: [dart.void, [core.int, E]],
2113 [dartx.removeAt]: [E, [core.int]],
2114 [dartx.insertAll]: [dart.void, [core.int, core.Iterable$(E)]],
2115 [dartx.setAll]: [dart.void, [core.int, core.Iterable$(E)]]
2116 }),
2117 statics: () => ({_filter: [dart.void, [core.List, dart.functionType(core.b ool, [dart.dynamic]), core.bool]]}),
2118 names: ['_filter']
2119 });
2120 return ListMixin;
2121 });
2122 let ListMixin = ListMixin$();
2123 const ListBase$ = dart.generic(function(E) {
2124 class ListBase extends dart.mixin(core.Object, ListMixin$(E)) {
2125 static listToString(list) {
2126 return IterableBase.iterableToFullString(list, '[', ']');
2127 }
2128 }
2129 dart.setSignature(ListBase, {
2130 statics: () => ({listToString: [core.String, [core.List]]}),
2131 names: ['listToString']
2132 });
2133 return ListBase;
2134 });
2135 let ListBase = ListBase$();
2136 const MapMixin$ = dart.generic(function(K, V) {
2137 class MapMixin extends core.Object {
2138 forEach(action) {
2139 dart.as(action, dart.functionType(dart.void, [K, V]));
2140 for (let key of this.keys) {
2141 action(key, this.get(key));
2142 }
2143 }
2144 addAll(other) {
2145 dart.as(other, core.Map$(K, V));
2146 for (let key of other[dartx.keys]) {
2147 this.set(key, other[dartx.get](key));
2148 }
2149 }
2150 containsValue(value) {
2151 for (let key of this.keys) {
2152 if (dart.equals(this.get(key), value)) return true;
2153 }
2154 return false;
2155 }
2156 putIfAbsent(key, ifAbsent) {
2157 dart.as(key, K);
2158 dart.as(ifAbsent, dart.functionType(V, []));
2159 if (dart.notNull(this.keys[dartx.contains](key))) {
2160 return this.get(key);
2161 }
2162 return this.set(key, ifAbsent());
2163 }
2164 containsKey(key) {
2165 return this.keys[dartx.contains](key);
2166 }
2167 get length() {
2168 return this.keys[dartx.length];
2169 }
2170 get isEmpty() {
2171 return this.keys[dartx.isEmpty];
2172 }
2173 get isNotEmpty() {
2174 return this.keys[dartx.isNotEmpty];
2175 }
2176 get values() {
2177 return new (_MapBaseValueIterable$(V))(this);
2178 }
2179 toString() {
2180 return Maps.mapToString(this);
2181 }
2182 }
2183 MapMixin[dart.implements] = () => [core.Map$(K, V)];
2184 dart.setSignature(MapMixin, {
2185 methods: () => ({
2186 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]],
2187 addAll: [dart.void, [core.Map$(K, V)]],
2188 containsValue: [core.bool, [core.Object]],
2189 putIfAbsent: [V, [K, dart.functionType(V, [])]],
2190 containsKey: [core.bool, [core.Object]]
2191 })
2192 });
2193 dart.defineExtensionMembers(MapMixin, [
2194 'forEach',
2195 'addAll',
2196 'containsValue',
2197 'putIfAbsent',
2198 'containsKey',
2199 'length',
2200 'isEmpty',
2201 'isNotEmpty',
2202 'values'
2203 ]);
2204 return MapMixin;
2205 });
2206 let MapMixin = MapMixin$();
2207 const MapBase$ = dart.generic(function(K, V) {
2208 class MapBase extends dart.mixin(core.Object, MapMixin$(K, V)) {}
2209 return MapBase;
2210 });
2211 let MapBase = MapBase$();
2212 const _UnmodifiableMapMixin$ = dart.generic(function(K, V) {
2213 class _UnmodifiableMapMixin extends core.Object {
2214 set(key, value) {
2215 dart.as(key, K);
2216 dart.as(value, V);
2217 dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
2218 return value;
2219 }
2220 addAll(other) {
2221 dart.as(other, core.Map$(K, V));
2222 dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
2223 }
2224 clear() {
2225 dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
2226 }
2227 remove(key) {
2228 dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
2229 }
2230 putIfAbsent(key, ifAbsent) {
2231 dart.as(key, K);
2232 dart.as(ifAbsent, dart.functionType(V, []));
2233 dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
2234 }
2235 }
2236 _UnmodifiableMapMixin[dart.implements] = () => [core.Map$(K, V)];
2237 dart.setSignature(_UnmodifiableMapMixin, {
2238 methods: () => ({
2239 set: [dart.void, [K, V]],
2240 addAll: [dart.void, [core.Map$(K, V)]],
2241 clear: [dart.void, []],
2242 remove: [V, [core.Object]],
2243 putIfAbsent: [V, [K, dart.functionType(V, [])]]
2244 })
2245 });
2246 dart.defineExtensionMembers(_UnmodifiableMapMixin, [
2247 'set',
2248 'addAll',
2249 'clear',
2250 'remove',
2251 'putIfAbsent'
2252 ]);
2253 return _UnmodifiableMapMixin;
2254 });
2255 let _UnmodifiableMapMixin = _UnmodifiableMapMixin$();
2256 const UnmodifiableMapBase$ = dart.generic(function(K, V) {
2257 class UnmodifiableMapBase extends dart.mixin(MapBase$(K, V), _UnmodifiableMa pMixin$(K, V)) {
2258 UnmodifiableMapBase() {
2259 super.MapBase(...arguments);
2260 }
2261 }
2262 return UnmodifiableMapBase;
2263 });
2264 let UnmodifiableMapBase = UnmodifiableMapBase$();
2265 const _map = Symbol('_map');
2266 const _MapBaseValueIterable$ = dart.generic(function(V) {
2267 class _MapBaseValueIterable extends IterableBase$(V) {
2268 _MapBaseValueIterable(map) {
2269 this[_map] = map;
2270 super.IterableBase();
2271 }
2272 get length() {
2273 return this[_map][dartx.length];
2274 }
2275 get isEmpty() {
2276 return this[_map][dartx.isEmpty];
2277 }
2278 get isNotEmpty() {
2279 return this[_map][dartx.isNotEmpty];
2280 }
2281 get first() {
2282 return dart.as(this[_map][dartx.get](this[_map][dartx.keys][dartx.first] ), V);
2283 }
2284 get single() {
2285 return dart.as(this[_map][dartx.get](this[_map][dartx.keys][dartx.single ]), V);
2286 }
2287 get last() {
2288 return dart.as(this[_map][dartx.get](this[_map][dartx.keys][dartx.last]) , V);
2289 }
2290 get iterator() {
2291 return new (_MapBaseValueIterator$(V))(this[_map]);
2292 }
2293 }
2294 _MapBaseValueIterable[dart.implements] = () => [_internal.EfficientLength];
2295 dart.setSignature(_MapBaseValueIterable, {
2296 constructors: () => ({_MapBaseValueIterable: [_MapBaseValueIterable$(V), [ core.Map]]})
2297 });
2298 dart.defineExtensionMembers(_MapBaseValueIterable, [
2299 'length',
2300 'isEmpty',
2301 'isNotEmpty',
2302 'first',
2303 'single',
2304 'last',
2305 'iterator'
2306 ]);
2307 return _MapBaseValueIterable;
2308 });
2309 let _MapBaseValueIterable = _MapBaseValueIterable$();
2310 const _keys = Symbol('_keys');
2311 const _MapBaseValueIterator$ = dart.generic(function(V) {
2312 class _MapBaseValueIterator extends core.Object {
2313 _MapBaseValueIterator(map) {
2314 this[_map] = map;
2315 this[_keys] = map[dartx.keys][dartx.iterator];
2316 this[_current] = null;
2317 }
2318 moveNext() {
2319 if (dart.notNull(this[_keys].moveNext())) {
2320 this[_current] = dart.as(this[_map][dartx.get](this[_keys].current), V );
2321 return true;
2322 }
2323 this[_current] = null;
2324 return false;
2325 }
2326 get current() {
2327 return this[_current];
2328 }
2329 }
2330 _MapBaseValueIterator[dart.implements] = () => [core.Iterator$(V)];
2331 dart.setSignature(_MapBaseValueIterator, {
2332 constructors: () => ({_MapBaseValueIterator: [_MapBaseValueIterator$(V), [ core.Map]]}),
2333 methods: () => ({moveNext: [core.bool, []]})
2334 });
2335 return _MapBaseValueIterator;
2336 });
2337 let _MapBaseValueIterator = _MapBaseValueIterator$();
2338 const MapView$ = dart.generic(function(K, V) {
2339 class MapView extends core.Object {
2340 MapView(map) {
2341 this[_map] = map;
2342 }
2343 get(key) {
2344 return this[_map][dartx.get](key);
2345 }
2346 set(key, value) {
2347 dart.as(key, K);
2348 dart.as(value, V);
2349 this[_map][dartx.set](key, value);
2350 return value;
2351 }
2352 addAll(other) {
2353 dart.as(other, core.Map$(K, V));
2354 this[_map][dartx.addAll](other);
2355 }
2356 clear() {
2357 this[_map][dartx.clear]();
2358 }
2359 putIfAbsent(key, ifAbsent) {
2360 dart.as(key, K);
2361 dart.as(ifAbsent, dart.functionType(V, []));
2362 return this[_map][dartx.putIfAbsent](key, ifAbsent);
2363 }
2364 containsKey(key) {
2365 return this[_map][dartx.containsKey](key);
2366 }
2367 containsValue(value) {
2368 return this[_map][dartx.containsValue](value);
2369 }
2370 forEach(action) {
2371 dart.as(action, dart.functionType(dart.void, [K, V]));
2372 this[_map][dartx.forEach](action);
2373 }
2374 get isEmpty() {
2375 return this[_map][dartx.isEmpty];
2376 }
2377 get isNotEmpty() {
2378 return this[_map][dartx.isNotEmpty];
2379 }
2380 get length() {
2381 return this[_map][dartx.length];
2382 }
2383 get keys() {
2384 return this[_map][dartx.keys];
2385 }
2386 remove(key) {
2387 return this[_map][dartx.remove](key);
2388 }
2389 toString() {
2390 return dart.toString(this[_map]);
2391 }
2392 get values() {
2393 return this[_map][dartx.values];
2394 }
2395 }
2396 MapView[dart.implements] = () => [core.Map$(K, V)];
2397 dart.setSignature(MapView, {
2398 constructors: () => ({MapView: [MapView$(K, V), [core.Map$(K, V)]]}),
2399 methods: () => ({
2400 get: [V, [core.Object]],
2401 set: [dart.void, [K, V]],
2402 addAll: [dart.void, [core.Map$(K, V)]],
2403 clear: [dart.void, []],
2404 putIfAbsent: [V, [K, dart.functionType(V, [])]],
2405 containsKey: [core.bool, [core.Object]],
2406 containsValue: [core.bool, [core.Object]],
2407 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]],
2408 remove: [V, [core.Object]]
2409 })
2410 });
2411 dart.defineExtensionMembers(MapView, [
2412 'get',
2413 'set',
2414 'addAll',
2415 'clear',
2416 'putIfAbsent',
2417 'containsKey',
2418 'containsValue',
2419 'forEach',
2420 'remove',
2421 'isEmpty',
2422 'isNotEmpty',
2423 'length',
2424 'keys',
2425 'values'
2426 ]);
2427 return MapView;
2428 });
2429 let MapView = MapView$();
2430 const UnmodifiableMapView$ = dart.generic(function(K, V) {
2431 class UnmodifiableMapView extends dart.mixin(MapView$(K, V), _UnmodifiableMa pMixin$(K, V)) {
2432 UnmodifiableMapView() {
2433 super.MapView(...arguments);
2434 }
2435 }
2436 return UnmodifiableMapView;
2437 });
2438 let UnmodifiableMapView = UnmodifiableMapView$();
2439 class Maps extends core.Object {
2440 static containsValue(map, value) {
2441 for (let v of map[dartx.values]) {
2442 if (dart.equals(value, v)) {
2443 return true;
2444 }
2445 }
2446 return false;
2447 }
2448 static containsKey(map, key) {
2449 for (let k of map[dartx.keys]) {
2450 if (dart.equals(key, k)) {
2451 return true;
2452 }
2453 }
2454 return false;
2455 }
2456 static putIfAbsent(map, key, ifAbsent) {
2457 if (dart.notNull(map[dartx.containsKey](key))) {
2458 return map[dartx.get](key);
2459 }
2460 let v = ifAbsent();
2461 map[dartx.set](key, v);
2462 return v;
2463 }
2464 static clear(map) {
2465 for (let k of map[dartx.keys][dartx.toList]()) {
2466 map[dartx.remove](k);
2467 }
2468 }
2469 static forEach(map, f) {
2470 for (let k of map[dartx.keys]) {
2471 dart.dcall(f, k, map[dartx.get](k));
2472 }
2473 }
2474 static getValues(map) {
2475 return map[dartx.keys][dartx.map](dart.fn(key => map[dartx.get](key)));
2476 }
2477 static length(map) {
2478 return map[dartx.keys][dartx.length];
2479 }
2480 static isEmpty(map) {
2481 return map[dartx.keys][dartx.isEmpty];
2482 }
2483 static isNotEmpty(map) {
2484 return map[dartx.keys][dartx.isNotEmpty];
2485 }
2486 static mapToString(m) {
2487 if (dart.notNull(IterableBase._isToStringVisiting(m))) {
2488 return '{...}';
2489 }
2490 let result = new core.StringBuffer();
2491 try {
2492 IterableBase._toStringVisiting[dartx.add](m);
2493 result.write('{');
2494 let first = true;
2495 m[dartx.forEach](dart.fn((k, v) => {
2496 if (!first) {
2497 result.write(', ');
2498 }
2499 first = false;
2500 result.write(k);
2501 result.write(': ');
2502 result.write(v);
2503 }, dart.void, [dart.dynamic, dart.dynamic]));
2504 result.write('}');
2505 } finally {
2506 dart.assert(core.identical(IterableBase._toStringVisiting[dartx.last], m ));
2507 IterableBase._toStringVisiting[dartx.removeLast]();
2508 }
2509 return result.toString();
2510 }
2511 static _id(x) {
2512 return x;
2513 }
2514 static _fillMapWithMappedIterable(map, iterable, key, value) {
2515 if (key == null) key = Maps._id;
2516 if (value == null) value = Maps._id;
2517 for (let element of iterable) {
2518 map[dartx.set](dart.dcall(key, element), dart.dcall(value, element));
2519 }
2520 }
2521 static _fillMapWithIterables(map, keys, values) {
2522 let keyIterator = keys[dartx.iterator];
2523 let valueIterator = values[dartx.iterator];
2524 let hasNextKey = keyIterator.moveNext();
2525 let hasNextValue = valueIterator.moveNext();
2526 while (dart.notNull(hasNextKey) && dart.notNull(hasNextValue)) {
2527 map[dartx.set](keyIterator.current, valueIterator.current);
2528 hasNextKey = keyIterator.moveNext();
2529 hasNextValue = valueIterator.moveNext();
2530 }
2531 if (dart.notNull(hasNextKey) || dart.notNull(hasNextValue)) {
2532 dart.throw(new core.ArgumentError("Iterables do not have same length.")) ;
2533 }
2534 }
2535 }
2536 dart.setSignature(Maps, {
2537 statics: () => ({
2538 containsValue: [core.bool, [core.Map, dart.dynamic]],
2539 containsKey: [core.bool, [core.Map, dart.dynamic]],
2540 putIfAbsent: [dart.dynamic, [core.Map, dart.dynamic, dart.functionType(dar t.dynamic, [])]],
2541 clear: [dart.dynamic, [core.Map]],
2542 forEach: [dart.dynamic, [core.Map, dart.functionType(dart.void, [dart.dyna mic, dart.dynamic])]],
2543 getValues: [core.Iterable, [core.Map]],
2544 length: [core.int, [core.Map]],
2545 isEmpty: [core.bool, [core.Map]],
2546 isNotEmpty: [core.bool, [core.Map]],
2547 mapToString: [core.String, [core.Map]],
2548 _id: [dart.dynamic, [dart.dynamic]],
2549 _fillMapWithMappedIterable: [dart.void, [core.Map, core.Iterable, dart.fun ctionType(dart.dynamic, [dart.dynamic]), dart.functionType(dart.dynamic, [dart.d ynamic])]],
2550 _fillMapWithIterables: [dart.void, [core.Map, core.Iterable, core.Iterable ]]
2551 }),
2552 names: ['containsValue', 'containsKey', 'putIfAbsent', 'clear', 'forEach', ' getValues', 'length', 'isEmpty', 'isNotEmpty', 'mapToString', '_id', '_fillMapWi thMappedIterable', '_fillMapWithIterables']
2553 });
2554 const Queue$ = dart.generic(function(E) {
2555 class Queue extends core.Object {
2556 static new() {
2557 return new (ListQueue$(E))();
2558 }
2559 static from(elements) {
2560 return ListQueue$(E).from(elements);
2561 }
2562 [Symbol.iterator]() {
2563 return new dart.JsIterator(this.iterator);
2564 }
2565 }
2566 Queue[dart.implements] = () => [core.Iterable$(E), _internal.EfficientLength ];
2567 dart.setSignature(Queue, {
2568 constructors: () => ({
2569 new: [Queue$(E), []],
2570 from: [Queue$(E), [core.Iterable]]
2571 })
2572 });
2573 return Queue;
2574 });
2575 let Queue = Queue$();
2576 const _element = Symbol('_element');
2577 const _link = Symbol('_link');
2578 const _asNonSentinelEntry = Symbol('_asNonSentinelEntry');
2579 const DoubleLinkedQueueEntry$ = dart.generic(function(E) {
2580 class DoubleLinkedQueueEntry extends core.Object {
2581 DoubleLinkedQueueEntry(e) {
2582 this[_element] = e;
2583 this[_previous] = null;
2584 this[_next] = null;
2585 }
2586 [_link](previous, next) {
2587 dart.as(previous, DoubleLinkedQueueEntry$(E));
2588 dart.as(next, DoubleLinkedQueueEntry$(E));
2589 this[_next] = next;
2590 this[_previous] = previous;
2591 previous[_next] = this;
2592 next[_previous] = this;
2593 }
2594 append(e) {
2595 dart.as(e, E);
2596 new (DoubleLinkedQueueEntry$(E))(e)[_link](this, this[_next]);
2597 }
2598 prepend(e) {
2599 dart.as(e, E);
2600 new (DoubleLinkedQueueEntry$(E))(e)[_link](this[_previous], this);
2601 }
2602 remove() {
2603 this[_previous][_next] = this[_next];
2604 this[_next][_previous] = this[_previous];
2605 this[_next] = null;
2606 this[_previous] = null;
2607 return this[_element];
2608 }
2609 [_asNonSentinelEntry]() {
2610 return this;
2611 }
2612 previousEntry() {
2613 return this[_previous][_asNonSentinelEntry]();
2614 }
2615 nextEntry() {
2616 return this[_next][_asNonSentinelEntry]();
2617 }
2618 get element() {
2619 return this[_element];
2620 }
2621 set element(e) {
2622 dart.as(e, E);
2623 this[_element] = e;
2624 }
2625 }
2626 dart.setSignature(DoubleLinkedQueueEntry, {
2627 constructors: () => ({DoubleLinkedQueueEntry: [DoubleLinkedQueueEntry$(E), [E]]}),
2628 methods: () => ({
2629 [_link]: [dart.void, [DoubleLinkedQueueEntry$(E), DoubleLinkedQueueEntry $(E)]],
2630 append: [dart.void, [E]],
2631 prepend: [dart.void, [E]],
2632 remove: [E, []],
2633 [_asNonSentinelEntry]: [DoubleLinkedQueueEntry$(E), []],
2634 previousEntry: [DoubleLinkedQueueEntry$(E), []],
2635 nextEntry: [DoubleLinkedQueueEntry$(E), []]
2636 })
2637 });
2638 return DoubleLinkedQueueEntry;
2639 });
2640 let DoubleLinkedQueueEntry = DoubleLinkedQueueEntry$();
2641 const _DoubleLinkedQueueEntrySentinel$ = dart.generic(function(E) {
2642 class _DoubleLinkedQueueEntrySentinel extends DoubleLinkedQueueEntry$(E) {
2643 _DoubleLinkedQueueEntrySentinel() {
2644 super.DoubleLinkedQueueEntry(null);
2645 this[_link](this, this);
2646 }
2647 remove() {
2648 dart.throw(_internal.IterableElementError.noElement());
2649 }
2650 [_asNonSentinelEntry]() {
2651 return null;
2652 }
2653 set element(e) {
2654 dart.as(e, E);
2655 dart.assert(false);
2656 }
2657 get element() {
2658 dart.throw(_internal.IterableElementError.noElement());
2659 }
2660 }
2661 dart.setSignature(_DoubleLinkedQueueEntrySentinel, {
2662 constructors: () => ({_DoubleLinkedQueueEntrySentinel: [_DoubleLinkedQueue EntrySentinel$(E), []]}),
2663 methods: () => ({
2664 remove: [E, []],
2665 [_asNonSentinelEntry]: [DoubleLinkedQueueEntry$(E), []]
2666 })
2667 });
2668 return _DoubleLinkedQueueEntrySentinel;
2669 });
2670 let _DoubleLinkedQueueEntrySentinel = _DoubleLinkedQueueEntrySentinel$();
2671 const _sentinel = Symbol('_sentinel');
2672 const _elementCount = Symbol('_elementCount');
2673 const _filter = Symbol('_filter');
2674 const DoubleLinkedQueue$ = dart.generic(function(E) {
2675 class DoubleLinkedQueue extends IterableBase$(E) {
2676 DoubleLinkedQueue() {
2677 this[_sentinel] = null;
2678 this[_elementCount] = 0;
2679 super.IterableBase();
2680 this[_sentinel] = new (_DoubleLinkedQueueEntrySentinel$(E))();
2681 }
2682 static from(elements) {
2683 let list = new (DoubleLinkedQueue$(E))();
2684 for (let e of elements) {
2685 dart.as(e, E);
2686 list.addLast(e);
2687 }
2688 return dart.as(list, DoubleLinkedQueue$(E));
2689 }
2690 get length() {
2691 return this[_elementCount];
2692 }
2693 addLast(value) {
2694 dart.as(value, E);
2695 this[_sentinel].prepend(value);
2696 this[_elementCount] = dart.notNull(this[_elementCount]) + 1;
2697 }
2698 addFirst(value) {
2699 dart.as(value, E);
2700 this[_sentinel].append(value);
2701 this[_elementCount] = dart.notNull(this[_elementCount]) + 1;
2702 }
2703 add(value) {
2704 dart.as(value, E);
2705 this[_sentinel].prepend(value);
2706 this[_elementCount] = dart.notNull(this[_elementCount]) + 1;
2707 }
2708 addAll(iterable) {
2709 dart.as(iterable, core.Iterable$(E));
2710 for (let value of iterable) {
2711 this[_sentinel].prepend(value);
2712 this[_elementCount] = dart.notNull(this[_elementCount]) + 1;
2713 }
2714 }
2715 removeLast() {
2716 let result = this[_sentinel][_previous].remove();
2717 this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
2718 return result;
2719 }
2720 removeFirst() {
2721 let result = this[_sentinel][_next].remove();
2722 this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
2723 return result;
2724 }
2725 remove(o) {
2726 let entry = this[_sentinel][_next];
2727 while (!core.identical(entry, this[_sentinel])) {
2728 if (dart.equals(entry.element, o)) {
2729 entry.remove();
2730 this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
2731 return true;
2732 }
2733 entry = entry[_next];
2734 }
2735 return false;
2736 }
2737 [_filter](test, removeMatching) {
2738 dart.as(test, dart.functionType(core.bool, [E]));
2739 let entry = this[_sentinel][_next];
2740 while (!core.identical(entry, this[_sentinel])) {
2741 let next = entry[_next];
2742 if (core.identical(removeMatching, test(entry.element))) {
2743 entry.remove();
2744 this[_elementCount] = dart.notNull(this[_elementCount]) - 1;
2745 }
2746 entry = next;
2747 }
2748 }
2749 removeWhere(test) {
2750 dart.as(test, dart.functionType(core.bool, [E]));
2751 this[_filter](test, true);
2752 }
2753 retainWhere(test) {
2754 dart.as(test, dart.functionType(core.bool, [E]));
2755 this[_filter](test, false);
2756 }
2757 get first() {
2758 return this[_sentinel][_next].element;
2759 }
2760 get last() {
2761 return this[_sentinel][_previous].element;
2762 }
2763 get single() {
2764 if (core.identical(this[_sentinel][_next], this[_sentinel][_previous])) {
2765 return this[_sentinel][_next].element;
2766 }
2767 dart.throw(_internal.IterableElementError.tooMany());
2768 }
2769 lastEntry() {
2770 return this[_sentinel].previousEntry();
2771 }
2772 firstEntry() {
2773 return this[_sentinel].nextEntry();
2774 }
2775 get isEmpty() {
2776 return core.identical(this[_sentinel][_next], this[_sentinel]);
2777 }
2778 clear() {
2779 this[_sentinel][_next] = this[_sentinel];
2780 this[_sentinel][_previous] = this[_sentinel];
2781 this[_elementCount] = 0;
2782 }
2783 forEachEntry(f) {
2784 dart.as(f, dart.functionType(dart.void, [DoubleLinkedQueueEntry$(E)]));
2785 let entry = this[_sentinel][_next];
2786 while (!core.identical(entry, this[_sentinel])) {
2787 let nextEntry = entry[_next];
2788 f(entry);
2789 entry = nextEntry;
2790 }
2791 }
2792 get iterator() {
2793 return new (_DoubleLinkedQueueIterator$(E))(this[_sentinel]);
2794 }
2795 toString() {
2796 return IterableBase.iterableToFullString(this, '{', '}');
2797 }
2798 }
2799 DoubleLinkedQueue[dart.implements] = () => [Queue$(E)];
2800 dart.setSignature(DoubleLinkedQueue, {
2801 constructors: () => ({
2802 DoubleLinkedQueue: [DoubleLinkedQueue$(E), []],
2803 from: [DoubleLinkedQueue$(E), [core.Iterable]]
2804 }),
2805 methods: () => ({
2806 addLast: [dart.void, [E]],
2807 addFirst: [dart.void, [E]],
2808 add: [dart.void, [E]],
2809 addAll: [dart.void, [core.Iterable$(E)]],
2810 removeLast: [E, []],
2811 removeFirst: [E, []],
2812 remove: [core.bool, [core.Object]],
2813 [_filter]: [dart.void, [dart.functionType(core.bool, [E]), core.bool]],
2814 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]],
2815 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]],
2816 lastEntry: [DoubleLinkedQueueEntry$(E), []],
2817 firstEntry: [DoubleLinkedQueueEntry$(E), []],
2818 clear: [dart.void, []],
2819 forEachEntry: [dart.void, [dart.functionType(dart.void, [DoubleLinkedQue ueEntry$(E)])]]
2820 })
2821 });
2822 dart.defineExtensionMembers(DoubleLinkedQueue, [
2823 'length',
2824 'first',
2825 'last',
2826 'single',
2827 'isEmpty',
2828 'iterator'
2829 ]);
2830 return DoubleLinkedQueue;
2831 });
2832 let DoubleLinkedQueue = DoubleLinkedQueue$();
2833 const _nextEntry = Symbol('_nextEntry');
2834 const _DoubleLinkedQueueIterator$ = dart.generic(function(E) {
2835 class _DoubleLinkedQueueIterator extends core.Object {
2836 _DoubleLinkedQueueIterator(sentinel) {
2837 this[_sentinel] = sentinel;
2838 this[_nextEntry] = sentinel[_next];
2839 this[_current] = null;
2840 }
2841 moveNext() {
2842 if (!core.identical(this[_nextEntry], this[_sentinel])) {
2843 this[_current] = this[_nextEntry][_element];
2844 this[_nextEntry] = this[_nextEntry][_next];
2845 return true;
2846 }
2847 this[_current] = null;
2848 this[_nextEntry] = this[_sentinel] = null;
2849 return false;
2850 }
2851 get current() {
2852 return this[_current];
2853 }
2854 }
2855 _DoubleLinkedQueueIterator[dart.implements] = () => [core.Iterator$(E)];
2856 dart.setSignature(_DoubleLinkedQueueIterator, {
2857 constructors: () => ({_DoubleLinkedQueueIterator: [_DoubleLinkedQueueItera tor$(E), [_DoubleLinkedQueueEntrySentinel$(E)]]}),
2858 methods: () => ({moveNext: [core.bool, []]})
2859 });
2860 return _DoubleLinkedQueueIterator;
2861 });
2862 let _DoubleLinkedQueueIterator = _DoubleLinkedQueueIterator$();
2863 const _head = Symbol('_head');
2864 const _tail = Symbol('_tail');
2865 const _table = Symbol('_table');
2866 const _checkModification = Symbol('_checkModification');
2867 const _writeToList = Symbol('_writeToList');
2868 const _add = Symbol('_add');
2869 const _preGrow = Symbol('_preGrow');
2870 const _remove = Symbol('_remove');
2871 const _filterWhere = Symbol('_filterWhere');
2872 const _grow = Symbol('_grow');
2873 const ListQueue$ = dart.generic(function(E) {
2874 class ListQueue extends IterableBase$(E) {
2875 ListQueue(initialCapacity) {
2876 if (initialCapacity === void 0) initialCapacity = null;
2877 this[_head] = 0;
2878 this[_tail] = 0;
2879 this[_table] = null;
2880 this[_modificationCount] = 0;
2881 super.IterableBase();
2882 if (initialCapacity == null || dart.notNull(initialCapacity) < dart.notN ull(ListQueue$()._INITIAL_CAPACITY)) {
2883 initialCapacity = ListQueue$()._INITIAL_CAPACITY;
2884 } else if (!dart.notNull(ListQueue$()._isPowerOf2(initialCapacity))) {
2885 initialCapacity = ListQueue$()._nextPowerOf2(initialCapacity);
2886 }
2887 dart.assert(ListQueue$()._isPowerOf2(initialCapacity));
2888 this[_table] = core.List$(E).new(initialCapacity);
2889 }
2890 static from(elements) {
2891 if (dart.is(elements, core.List)) {
2892 let length = elements[dartx.length];
2893 let queue = new (ListQueue$(E))(dart.notNull(length) + 1);
2894 dart.assert(dart.notNull(queue[_table][dartx.length]) > dart.notNull(l ength));
2895 let sourceList = elements;
2896 queue[_table][dartx.setRange](0, length, dart.as(sourceList, core.Iter able$(E)), 0);
2897 queue[_tail] = length;
2898 return queue;
2899 } else {
2900 let capacity = ListQueue$()._INITIAL_CAPACITY;
2901 if (dart.is(elements, _internal.EfficientLength)) {
2902 capacity = elements[dartx.length];
2903 }
2904 let result = new (ListQueue$(E))(capacity);
2905 for (let element of elements) {
2906 dart.as(element, E);
2907 result.addLast(element);
2908 }
2909 return result;
2910 }
2911 }
2912 get iterator() {
2913 return new (_ListQueueIterator$(E))(this);
2914 }
2915 forEach(action) {
2916 dart.as(action, dart.functionType(dart.void, [E]));
2917 let modificationCount = this[_modificationCount];
2918 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table][dartx.length]) - 1) {
2919 action(this[_table][dartx.get](i));
2920 this[_checkModification](modificationCount);
2921 }
2922 }
2923 get isEmpty() {
2924 return this[_head] == this[_tail];
2925 }
2926 get length() {
2927 return dart.notNull(this[_tail]) - dart.notNull(this[_head]) & dart.notN ull(this[_table][dartx.length]) - 1;
2928 }
2929 get first() {
2930 if (this[_head] == this[_tail]) dart.throw(_internal.IterableElementErro r.noElement());
2931 return this[_table][dartx.get](this[_head]);
2932 }
2933 get last() {
2934 if (this[_head] == this[_tail]) dart.throw(_internal.IterableElementErro r.noElement());
2935 return this[_table][dartx.get](dart.notNull(this[_tail]) - 1 & dart.notN ull(this[_table][dartx.length]) - 1);
2936 }
2937 get single() {
2938 if (this[_head] == this[_tail]) dart.throw(_internal.IterableElementErro r.noElement());
2939 if (dart.notNull(this.length) > 1) dart.throw(_internal.IterableElementE rror.tooMany());
2940 return this[_table][dartx.get](this[_head]);
2941 }
2942 elementAt(index) {
2943 core.RangeError.checkValidIndex(index, this);
2944 return this[_table][dartx.get](dart.notNull(this[_head]) + dart.notNull( index) & dart.notNull(this[_table][dartx.length]) - 1);
2945 }
2946 toList(opts) {
2947 let growable = opts && 'growable' in opts ? opts.growable : true;
2948 let list = null;
2949 if (dart.notNull(growable)) {
2950 list = core.List$(E).new();
2951 list[dartx.length] = this.length;
2952 } else {
2953 list = core.List$(E).new(this.length);
2954 }
2955 this[_writeToList](list);
2956 return list;
2957 }
2958 add(element) {
2959 dart.as(element, E);
2960 this[_add](element);
2961 }
2962 addAll(elements) {
2963 dart.as(elements, core.Iterable$(E));
2964 if (dart.is(elements, core.List)) {
2965 let list = dart.as(elements, core.List);
2966 let addCount = list[dartx.length];
2967 let length = this.length;
2968 if (dart.notNull(length) + dart.notNull(addCount) >= dart.notNull(this [_table][dartx.length])) {
2969 this[_preGrow](dart.notNull(length) + dart.notNull(addCount));
2970 this[_table][dartx.setRange](length, dart.notNull(length) + dart.not Null(addCount), dart.as(list, core.Iterable$(E)), 0);
2971 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount);
2972 } else {
2973 let endSpace = dart.notNull(this[_table][dartx.length]) - dart.notNu ll(this[_tail]);
2974 if (dart.notNull(addCount) < endSpace) {
2975 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + dart.notNull(addCount), dart.as(list, core.Iterable$(E)), 0);
2976 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount);
2977 } else {
2978 let preSpace = dart.notNull(addCount) - endSpace;
2979 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + endSpace, dart.as(list, core.Iterable$(E)), 0);
2980 this[_table][dartx.setRange](0, preSpace, dart.as(list, core.Itera ble$(E)), endSpace);
2981 this[_tail] = preSpace;
2982 }
2983 }
2984 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
2985 } else {
2986 for (let element of elements)
2987 this[_add](element);
2988 }
2989 }
2990 remove(object) {
2991 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table][dartx.length]) - 1) {
2992 let element = this[_table][dartx.get](i);
2993 if (dart.equals(element, object)) {
2994 this[_remove](i);
2995 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
2996 return true;
2997 }
2998 }
2999 return false;
3000 }
3001 [_filterWhere](test, removeMatching) {
3002 dart.as(test, dart.functionType(core.bool, [E]));
3003 let index = this[_head];
3004 let modificationCount = this[_modificationCount];
3005 let i = this[_head];
3006 while (i != this[_tail]) {
3007 let element = this[_table][dartx.get](i);
3008 let remove = core.identical(removeMatching, test(element));
3009 this[_checkModification](modificationCount);
3010 if (remove) {
3011 i = this[_remove](i);
3012 modificationCount = this[_modificationCount] = dart.notNull(this[_mo dificationCount]) + 1;
3013 } else {
3014 i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1;
3015 }
3016 }
3017 }
3018 removeWhere(test) {
3019 dart.as(test, dart.functionType(core.bool, [E]));
3020 this[_filterWhere](test, true);
3021 }
3022 retainWhere(test) {
3023 dart.as(test, dart.functionType(core.bool, [E]));
3024 this[_filterWhere](test, false);
3025 }
3026 clear() {
3027 if (this[_head] != this[_tail]) {
3028 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1) {
3029 this[_table][dartx.set](i, null);
3030 }
3031 this[_head] = this[_tail] = 0;
3032 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3033 }
3034 }
3035 toString() {
3036 return IterableBase.iterableToFullString(this, "{", "}");
3037 }
3038 addLast(element) {
3039 dart.as(element, E);
3040 this[_add](element);
3041 }
3042 addFirst(element) {
3043 dart.as(element, E);
3044 this[_head] = dart.notNull(this[_head]) - 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3045 this[_table][dartx.set](this[_head], element);
3046 if (this[_head] == this[_tail]) this[_grow]();
3047 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3048 }
3049 removeFirst() {
3050 if (this[_head] == this[_tail]) dart.throw(_internal.IterableElementErro r.noElement());
3051 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3052 let result = this[_table][dartx.get](this[_head]);
3053 this[_table][dartx.set](this[_head], null);
3054 this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3055 return result;
3056 }
3057 removeLast() {
3058 if (this[_head] == this[_tail]) dart.throw(_internal.IterableElementErro r.noElement());
3059 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3060 this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3061 let result = this[_table][dartx.get](this[_tail]);
3062 this[_table][dartx.set](this[_tail], null);
3063 return result;
3064 }
3065 static _isPowerOf2(number) {
3066 return (dart.notNull(number) & dart.notNull(number) - 1) == 0;
3067 }
3068 static _nextPowerOf2(number) {
3069 dart.assert(dart.notNull(number) > 0);
3070 number = (dart.notNull(number) << 1) - 1;
3071 for (;;) {
3072 let nextNumber = dart.notNull(number) & dart.notNull(number) - 1;
3073 if (nextNumber == 0) return number;
3074 number = nextNumber;
3075 }
3076 }
3077 [_checkModification](expectedModificationCount) {
3078 if (expectedModificationCount != this[_modificationCount]) {
3079 dart.throw(new core.ConcurrentModificationError(this));
3080 }
3081 }
3082 [_add](element) {
3083 dart.as(element, E);
3084 this[_table][dartx.set](this[_tail], element);
3085 this[_tail] = dart.notNull(this[_tail]) + 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3086 if (this[_head] == this[_tail]) this[_grow]();
3087 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3088 }
3089 [_remove](offset) {
3090 let mask = dart.notNull(this[_table][dartx.length]) - 1;
3091 let startDistance = dart.notNull(offset) - dart.notNull(this[_head]) & m ask;
3092 let endDistance = dart.notNull(this[_tail]) - dart.notNull(offset) & mas k;
3093 if (startDistance < endDistance) {
3094 let i = offset;
3095 while (i != this[_head]) {
3096 let prevOffset = dart.notNull(i) - 1 & mask;
3097 this[_table][dartx.set](i, this[_table][dartx.get](prevOffset));
3098 i = prevOffset;
3099 }
3100 this[_table][dartx.set](this[_head], null);
3101 this[_head] = dart.notNull(this[_head]) + 1 & mask;
3102 return dart.notNull(offset) + 1 & mask;
3103 } else {
3104 this[_tail] = dart.notNull(this[_tail]) - 1 & mask;
3105 let i = offset;
3106 while (i != this[_tail]) {
3107 let nextOffset = dart.notNull(i) + 1 & mask;
3108 this[_table][dartx.set](i, this[_table][dartx.get](nextOffset));
3109 i = nextOffset;
3110 }
3111 this[_table][dartx.set](this[_tail], null);
3112 return offset;
3113 }
3114 }
3115 [_grow]() {
3116 let newTable = core.List$(E).new(dart.notNull(this[_table][dartx.length] ) * 2);
3117 let split = dart.notNull(this[_table][dartx.length]) - dart.notNull(this [_head]);
3118 newTable[dartx.setRange](0, split, this[_table], this[_head]);
3119 newTable[dartx.setRange](split, split + dart.notNull(this[_head]), this[ _table], 0);
3120 this[_head] = 0;
3121 this[_tail] = this[_table][dartx.length];
3122 this[_table] = newTable;
3123 }
3124 [_writeToList](target) {
3125 dart.as(target, core.List$(E));
3126 dart.assert(dart.notNull(target[dartx.length]) >= dart.notNull(this.leng th));
3127 if (dart.notNull(this[_head]) <= dart.notNull(this[_tail])) {
3128 let length = dart.notNull(this[_tail]) - dart.notNull(this[_head]);
3129 target[dartx.setRange](0, length, this[_table], this[_head]);
3130 return length;
3131 } else {
3132 let firstPartSize = dart.notNull(this[_table][dartx.length]) - dart.no tNull(this[_head]);
3133 target[dartx.setRange](0, firstPartSize, this[_table], this[_head]);
3134 target[dartx.setRange](firstPartSize, firstPartSize + dart.notNull(thi s[_tail]), this[_table], 0);
3135 return dart.notNull(this[_tail]) + firstPartSize;
3136 }
3137 }
3138 [_preGrow](newElementCount) {
3139 dart.assert(dart.notNull(newElementCount) >= dart.notNull(this.length));
3140 newElementCount = dart.notNull(newElementCount) + (dart.notNull(newEleme ntCount) >> 1);
3141 let newCapacity = ListQueue$()._nextPowerOf2(newElementCount);
3142 let newTable = core.List$(E).new(newCapacity);
3143 this[_tail] = this[_writeToList](newTable);
3144 this[_table] = newTable;
3145 this[_head] = 0;
3146 }
3147 }
3148 ListQueue[dart.implements] = () => [Queue$(E)];
3149 dart.setSignature(ListQueue, {
3150 constructors: () => ({
3151 ListQueue: [ListQueue$(E), [], [core.int]],
3152 from: [ListQueue$(E), [core.Iterable]]
3153 }),
3154 methods: () => ({
3155 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
3156 elementAt: [E, [core.int]],
3157 toList: [core.List$(E), [], {growable: core.bool}],
3158 add: [dart.void, [E]],
3159 addAll: [dart.void, [core.Iterable$(E)]],
3160 remove: [core.bool, [core.Object]],
3161 [_filterWhere]: [dart.void, [dart.functionType(core.bool, [E]), core.boo l]],
3162 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]],
3163 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]],
3164 clear: [dart.void, []],
3165 addLast: [dart.void, [E]],
3166 addFirst: [dart.void, [E]],
3167 removeFirst: [E, []],
3168 removeLast: [E, []],
3169 [_checkModification]: [dart.void, [core.int]],
3170 [_add]: [dart.void, [E]],
3171 [_remove]: [core.int, [core.int]],
3172 [_grow]: [dart.void, []],
3173 [_writeToList]: [core.int, [core.List$(E)]],
3174 [_preGrow]: [dart.void, [core.int]]
3175 }),
3176 statics: () => ({
3177 _isPowerOf2: [core.bool, [core.int]],
3178 _nextPowerOf2: [core.int, [core.int]]
3179 }),
3180 names: ['_isPowerOf2', '_nextPowerOf2']
3181 });
3182 dart.defineExtensionMembers(ListQueue, [
3183 'forEach',
3184 'elementAt',
3185 'toList',
3186 'iterator',
3187 'isEmpty',
3188 'length',
3189 'first',
3190 'last',
3191 'single'
3192 ]);
3193 ListQueue._INITIAL_CAPACITY = 8;
3194 return ListQueue;
3195 });
3196 let ListQueue = ListQueue$();
3197 const _queue = Symbol('_queue');
3198 const _end = Symbol('_end');
3199 const _position = Symbol('_position');
3200 const _ListQueueIterator$ = dart.generic(function(E) {
3201 class _ListQueueIterator extends core.Object {
3202 _ListQueueIterator(queue) {
3203 this[_queue] = queue;
3204 this[_end] = queue[_tail];
3205 this[_modificationCount] = queue[_modificationCount];
3206 this[_position] = queue[_head];
3207 this[_current] = null;
3208 }
3209 get current() {
3210 return this[_current];
3211 }
3212 moveNext() {
3213 this[_queue][_checkModification](this[_modificationCount]);
3214 if (this[_position] == this[_end]) {
3215 this[_current] = null;
3216 return false;
3217 }
3218 this[_current] = dart.as(this[_queue][_table][dartx.get](this[_position] ), E);
3219 this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[ _queue][_table][dartx.length]) - 1;
3220 return true;
3221 }
3222 }
3223 _ListQueueIterator[dart.implements] = () => [core.Iterator$(E)];
3224 dart.setSignature(_ListQueueIterator, {
3225 constructors: () => ({_ListQueueIterator: [_ListQueueIterator$(E), [ListQu eue]]}),
3226 methods: () => ({moveNext: [core.bool, []]})
3227 });
3228 return _ListQueueIterator;
3229 });
3230 let _ListQueueIterator = _ListQueueIterator$();
3231 const _Predicate$ = dart.generic(function(T) {
3232 const _Predicate = dart.typedef('_Predicate', () => dart.functionType(core.b ool, [T]));
3233 return _Predicate;
3234 });
3235 let _Predicate = _Predicate$();
3236 const _SplayTreeNode$ = dart.generic(function(K) {
3237 class _SplayTreeNode extends core.Object {
3238 _SplayTreeNode(key) {
3239 this.key = key;
3240 this.left = null;
3241 this.right = null;
3242 }
3243 }
3244 dart.setSignature(_SplayTreeNode, {
3245 constructors: () => ({_SplayTreeNode: [_SplayTreeNode$(K), [K]]})
3246 });
3247 return _SplayTreeNode;
3248 });
3249 let _SplayTreeNode = _SplayTreeNode$();
3250 const _SplayTreeMapNode$ = dart.generic(function(K, V) {
3251 class _SplayTreeMapNode extends _SplayTreeNode$(K) {
3252 _SplayTreeMapNode(key, value) {
3253 this.value = value;
3254 super._SplayTreeNode(key);
3255 }
3256 }
3257 dart.setSignature(_SplayTreeMapNode, {
3258 constructors: () => ({_SplayTreeMapNode: [_SplayTreeMapNode$(K, V), [K, V] ]})
3259 });
3260 return _SplayTreeMapNode;
3261 });
3262 let _SplayTreeMapNode = _SplayTreeMapNode$();
3263 const _dummy = Symbol('_dummy');
3264 const _root = Symbol('_root');
3265 const _count = Symbol('_count');
3266 const _splayCount = Symbol('_splayCount');
3267 const _compare = Symbol('_compare');
3268 const _splay = Symbol('_splay');
3269 const _splayMin = Symbol('_splayMin');
3270 const _splayMax = Symbol('_splayMax');
3271 const _addNewRoot = Symbol('_addNewRoot');
3272 const _first = Symbol('_first');
3273 const _last = Symbol('_last');
3274 const _clear = Symbol('_clear');
3275 const _SplayTree$ = dart.generic(function(K) {
3276 class _SplayTree extends core.Object {
3277 _SplayTree() {
3278 this[_dummy] = new (_SplayTreeNode$(K))(null);
3279 this[_root] = null;
3280 this[_count] = 0;
3281 this[_modificationCount] = 0;
3282 this[_splayCount] = 0;
3283 }
3284 [_splay](key) {
3285 dart.as(key, K);
3286 if (this[_root] == null) return -1;
3287 let left = this[_dummy];
3288 let right = this[_dummy];
3289 let current = this[_root];
3290 let comp = null;
3291 while (true) {
3292 comp = this[_compare](current.key, key);
3293 if (dart.notNull(comp) > 0) {
3294 if (current.left == null) break;
3295 comp = this[_compare](current.left.key, key);
3296 if (dart.notNull(comp) > 0) {
3297 let tmp = current.left;
3298 current.left = tmp.right;
3299 tmp.right = current;
3300 current = tmp;
3301 if (current.left == null) break;
3302 }
3303 right.left = current;
3304 right = current;
3305 current = current.left;
3306 } else if (dart.notNull(comp) < 0) {
3307 if (current.right == null) break;
3308 comp = this[_compare](current.right.key, key);
3309 if (dart.notNull(comp) < 0) {
3310 let tmp = current.right;
3311 current.right = tmp.left;
3312 tmp.left = current;
3313 current = tmp;
3314 if (current.right == null) break;
3315 }
3316 left.right = current;
3317 left = current;
3318 current = current.right;
3319 } else {
3320 break;
3321 }
3322 }
3323 left.right = current.left;
3324 right.left = current.right;
3325 current.left = this[_dummy].right;
3326 current.right = this[_dummy].left;
3327 this[_root] = current;
3328 this[_dummy].right = null;
3329 this[_dummy].left = null;
3330 this[_splayCount] = dart.notNull(this[_splayCount]) + 1;
3331 return comp;
3332 }
3333 [_splayMin](node) {
3334 dart.as(node, _SplayTreeNode$(K));
3335 let current = node;
3336 while (current.left != null) {
3337 let left = current.left;
3338 current.left = left.right;
3339 left.right = current;
3340 current = left;
3341 }
3342 return dart.as(current, _SplayTreeNode$(K));
3343 }
3344 [_splayMax](node) {
3345 dart.as(node, _SplayTreeNode$(K));
3346 let current = node;
3347 while (current.right != null) {
3348 let right = current.right;
3349 current.right = right.left;
3350 right.left = current;
3351 current = right;
3352 }
3353 return dart.as(current, _SplayTreeNode$(K));
3354 }
3355 [_remove](key) {
3356 dart.as(key, K);
3357 if (this[_root] == null) return null;
3358 let comp = this[_splay](key);
3359 if (comp != 0) return null;
3360 let result = this[_root];
3361 this[_count] = dart.notNull(this[_count]) - 1;
3362 if (this[_root].left == null) {
3363 this[_root] = this[_root].right;
3364 } else {
3365 let right = this[_root].right;
3366 this[_root] = this[_splayMax](this[_root].left);
3367 this[_root].right = right;
3368 }
3369 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3370 return result;
3371 }
3372 [_addNewRoot](node, comp) {
3373 dart.as(node, _SplayTreeNode$(K));
3374 this[_count] = dart.notNull(this[_count]) + 1;
3375 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3376 if (this[_root] == null) {
3377 this[_root] = node;
3378 return;
3379 }
3380 if (dart.notNull(comp) < 0) {
3381 node.left = this[_root];
3382 node.right = this[_root].right;
3383 this[_root].right = null;
3384 } else {
3385 node.right = this[_root];
3386 node.left = this[_root].left;
3387 this[_root].left = null;
3388 }
3389 this[_root] = node;
3390 }
3391 get [_first]() {
3392 if (this[_root] == null) return null;
3393 this[_root] = this[_splayMin](this[_root]);
3394 return this[_root];
3395 }
3396 get [_last]() {
3397 if (this[_root] == null) return null;
3398 this[_root] = this[_splayMax](this[_root]);
3399 return this[_root];
3400 }
3401 [_clear]() {
3402 this[_root] = null;
3403 this[_count] = 0;
3404 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3405 }
3406 }
3407 dart.setSignature(_SplayTree, {
3408 methods: () => ({
3409 [_splay]: [core.int, [K]],
3410 [_splayMin]: [_SplayTreeNode$(K), [_SplayTreeNode$(K)]],
3411 [_splayMax]: [_SplayTreeNode$(K), [_SplayTreeNode$(K)]],
3412 [_remove]: [_SplayTreeNode, [K]],
3413 [_addNewRoot]: [dart.void, [_SplayTreeNode$(K), core.int]],
3414 [_clear]: [dart.void, []]
3415 })
3416 });
3417 return _SplayTree;
3418 });
3419 let _SplayTree = _SplayTree$();
3420 const _comparator = Symbol('_comparator');
3421 const _validKey = Symbol('_validKey');
3422 const SplayTreeMap$ = dart.generic(function(K, V) {
3423 class SplayTreeMap extends _SplayTree$(K) {
3424 SplayTreeMap(compare, isValidKey) {
3425 if (compare === void 0) compare = null;
3426 if (isValidKey === void 0) isValidKey = null;
3427 this[_comparator] = dart.as(compare == null ? core.Comparable.compare : compare, core.Comparator$(K));
3428 this[_validKey] = isValidKey != null ? isValidKey : dart.fn(v => dart.is (v, K), core.bool, [core.Object]);
3429 super._SplayTree();
3430 }
3431 static from(other, compare, isValidKey) {
3432 if (compare === void 0) compare = null;
3433 if (isValidKey === void 0) isValidKey = null;
3434 let result = new (SplayTreeMap$(K, V))();
3435 other[dartx.forEach](dart.fn((k, v) => {
3436 result.set(dart.as(k, K), dart.as(v, V));
3437 }, dart.void, [dart.dynamic, dart.dynamic]));
3438 return result;
3439 }
3440 static fromIterable(iterable, opts) {
3441 let key = opts && 'key' in opts ? opts.key : null;
3442 let value = opts && 'value' in opts ? opts.value : null;
3443 let compare = opts && 'compare' in opts ? opts.compare : null;
3444 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
3445 let map = new (SplayTreeMap$(K, V))(compare, isValidKey);
3446 Maps._fillMapWithMappedIterable(map, iterable, key, value);
3447 return map;
3448 }
3449 static fromIterables(keys, values, compare, isValidKey) {
3450 if (compare === void 0) compare = null;
3451 if (isValidKey === void 0) isValidKey = null;
3452 let map = new (SplayTreeMap$(K, V))(compare, isValidKey);
3453 Maps._fillMapWithIterables(map, keys, values);
3454 return map;
3455 }
3456 [_compare](key1, key2) {
3457 dart.as(key1, K);
3458 dart.as(key2, K);
3459 return this[_comparator](key1, key2);
3460 }
3461 _internal() {
3462 this[_comparator] = null;
3463 this[_validKey] = null;
3464 super._SplayTree();
3465 }
3466 get(key) {
3467 if (key == null) dart.throw(new core.ArgumentError(key));
3468 if (!dart.notNull(this[_validKey](key))) return null;
3469 if (this[_root] != null) {
3470 let comp = this[_splay](dart.as(key, K));
3471 if (comp == 0) {
3472 let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
3473 return dart.as(mapRoot.value, V);
3474 }
3475 }
3476 return null;
3477 }
3478 remove(key) {
3479 if (!dart.notNull(this[_validKey](key))) return null;
3480 let mapRoot = dart.as(this[_remove](dart.as(key, K)), _SplayTreeMapNode) ;
3481 if (mapRoot != null) return dart.as(mapRoot.value, V);
3482 return null;
3483 }
3484 set(key, value) {
3485 (() => {
3486 dart.as(key, K);
3487 dart.as(value, V);
3488 if (key == null) dart.throw(new core.ArgumentError(key));
3489 let comp = this[_splay](key);
3490 if (comp == 0) {
3491 let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
3492 mapRoot.value = value;
3493 return;
3494 }
3495 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value ), comp);
3496 })();
3497 return value;
3498 }
3499 putIfAbsent(key, ifAbsent) {
3500 dart.as(key, K);
3501 dart.as(ifAbsent, dart.functionType(V, []));
3502 if (key == null) dart.throw(new core.ArgumentError(key));
3503 let comp = this[_splay](key);
3504 if (comp == 0) {
3505 let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
3506 return dart.as(mapRoot.value, V);
3507 }
3508 let modificationCount = this[_modificationCount];
3509 let splayCount = this[_splayCount];
3510 let value = ifAbsent();
3511 if (modificationCount != this[_modificationCount]) {
3512 dart.throw(new core.ConcurrentModificationError(this));
3513 }
3514 if (splayCount != this[_splayCount]) {
3515 comp = this[_splay](key);
3516 dart.assert(comp != 0);
3517 }
3518 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value), comp);
3519 return value;
3520 }
3521 addAll(other) {
3522 dart.as(other, core.Map$(K, V));
3523 other[dartx.forEach](dart.fn((key, value) => {
3524 dart.as(key, K);
3525 dart.as(value, V);
3526 this.set(key, value);
3527 }, dart.void, [K, V]));
3528 }
3529 get isEmpty() {
3530 return this[_root] == null;
3531 }
3532 get isNotEmpty() {
3533 return !dart.notNull(this.isEmpty);
3534 }
3535 forEach(f) {
3536 dart.as(f, dart.functionType(dart.void, [K, V]));
3537 let nodes = new (_SplayTreeNodeIterator$(K))(this);
3538 while (dart.notNull(nodes.moveNext())) {
3539 let node = dart.as(nodes.current, _SplayTreeMapNode$(K, V));
3540 f(node.key, node.value);
3541 }
3542 }
3543 get length() {
3544 return this[_count];
3545 }
3546 clear() {
3547 this[_clear]();
3548 }
3549 containsKey(key) {
3550 return dart.notNull(this[_validKey](key)) && this[_splay](dart.as(key, K )) == 0;
3551 }
3552 containsValue(value) {
3553 let found = false;
3554 let initialSplayCount = this[_splayCount];
3555 const visit = (function(node) {
3556 while (node != null) {
3557 if (dart.equals(node.value, value)) return true;
3558 if (initialSplayCount != this[_splayCount]) {
3559 dart.throw(new core.ConcurrentModificationError(this));
3560 }
3561 if (node.right != null && dart.notNull(visit(dart.as(node.right, _Sp layTreeMapNode)))) return true;
3562 node = dart.as(node.left, _SplayTreeMapNode);
3563 }
3564 return false;
3565 }).bind(this);
3566 dart.fn(visit, core.bool, [_SplayTreeMapNode]);
3567 return visit(dart.as(this[_root], _SplayTreeMapNode));
3568 }
3569 get keys() {
3570 return new (_SplayTreeKeyIterable$(K))(this);
3571 }
3572 get values() {
3573 return new (_SplayTreeValueIterable$(K, V))(this);
3574 }
3575 toString() {
3576 return Maps.mapToString(this);
3577 }
3578 firstKey() {
3579 if (this[_root] == null) return null;
3580 return dart.as(this[_first].key, K);
3581 }
3582 lastKey() {
3583 if (this[_root] == null) return null;
3584 return dart.as(this[_last].key, K);
3585 }
3586 lastKeyBefore(key) {
3587 dart.as(key, K);
3588 if (key == null) dart.throw(new core.ArgumentError(key));
3589 if (this[_root] == null) return null;
3590 let comp = this[_splay](key);
3591 if (dart.notNull(comp) < 0) return this[_root].key;
3592 let node = this[_root].left;
3593 if (node == null) return null;
3594 while (node.right != null) {
3595 node = node.right;
3596 }
3597 return node.key;
3598 }
3599 firstKeyAfter(key) {
3600 dart.as(key, K);
3601 if (key == null) dart.throw(new core.ArgumentError(key));
3602 if (this[_root] == null) return null;
3603 let comp = this[_splay](key);
3604 if (dart.notNull(comp) > 0) return this[_root].key;
3605 let node = this[_root].right;
3606 if (node == null) return null;
3607 while (node.left != null) {
3608 node = node.left;
3609 }
3610 return node.key;
3611 }
3612 }
3613 SplayTreeMap[dart.implements] = () => [core.Map$(K, V)];
3614 dart.defineNamedConstructor(SplayTreeMap, '_internal');
3615 dart.setSignature(SplayTreeMap, {
3616 constructors: () => ({
3617 SplayTreeMap: [SplayTreeMap$(K, V), [], [dart.functionType(core.int, [K, K]), dart.functionType(core.bool, [core.Object])]],
3618 from: [SplayTreeMap$(K, V), [core.Map], [dart.functionType(core.int, [K, K]), dart.functionType(core.bool, [core.Object])]],
3619 fromIterable: [SplayTreeMap$(K, V), [core.Iterable], {key: dart.function Type(K, [dart.dynamic]), value: dart.functionType(V, [dart.dynamic]), compare: d art.functionType(core.int, [K, K]), isValidKey: dart.functionType(core.bool, [co re.Object])}],
3620 fromIterables: [SplayTreeMap$(K, V), [core.Iterable$(K), core.Iterable$( V)], [dart.functionType(core.int, [K, K]), dart.functionType(core.bool, [core.Ob ject])]],
3621 _internal: [SplayTreeMap$(K, V), []]
3622 }),
3623 methods: () => ({
3624 [_compare]: [core.int, [K, K]],
3625 get: [V, [core.Object]],
3626 remove: [V, [core.Object]],
3627 set: [dart.void, [K, V]],
3628 putIfAbsent: [V, [K, dart.functionType(V, [])]],
3629 addAll: [dart.void, [core.Map$(K, V)]],
3630 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]],
3631 clear: [dart.void, []],
3632 containsKey: [core.bool, [core.Object]],
3633 containsValue: [core.bool, [core.Object]],
3634 firstKey: [K, []],
3635 lastKey: [K, []],
3636 lastKeyBefore: [K, [K]],
3637 firstKeyAfter: [K, [K]]
3638 })
3639 });
3640 dart.defineExtensionMembers(SplayTreeMap, [
3641 'get',
3642 'remove',
3643 'set',
3644 'putIfAbsent',
3645 'addAll',
3646 'forEach',
3647 'clear',
3648 'containsKey',
3649 'containsValue',
3650 'isEmpty',
3651 'isNotEmpty',
3652 'length',
3653 'keys',
3654 'values'
3655 ]);
3656 return SplayTreeMap;
3657 });
3658 let SplayTreeMap = SplayTreeMap$();
3659 const _workList = Symbol('_workList');
3660 const _tree = Symbol('_tree');
3661 const _currentNode = Symbol('_currentNode');
3662 const _findLeftMostDescendent = Symbol('_findLeftMostDescendent');
3663 const _getValue = Symbol('_getValue');
3664 const _rebuildWorkList = Symbol('_rebuildWorkList');
3665 const _SplayTreeIterator$ = dart.generic(function(T) {
3666 class _SplayTreeIterator extends core.Object {
3667 _SplayTreeIterator(tree) {
3668 this[_workList] = dart.list([], _SplayTreeNode);
3669 this[_tree] = tree;
3670 this[_modificationCount] = tree[_modificationCount];
3671 this[_splayCount] = tree[_splayCount];
3672 this[_currentNode] = null;
3673 this[_findLeftMostDescendent](tree[_root]);
3674 }
3675 startAt(tree, startKey) {
3676 this[_workList] = dart.list([], _SplayTreeNode);
3677 this[_tree] = tree;
3678 this[_modificationCount] = tree[_modificationCount];
3679 this[_splayCount] = null;
3680 this[_currentNode] = null;
3681 if (tree[_root] == null) return;
3682 let compare = tree[_splay](startKey);
3683 this[_splayCount] = tree[_splayCount];
3684 if (dart.notNull(compare) < 0) {
3685 this[_findLeftMostDescendent](tree[_root].right);
3686 } else {
3687 this[_workList][dartx.add](tree[_root]);
3688 }
3689 }
3690 get current() {
3691 if (this[_currentNode] == null) return null;
3692 return this[_getValue](dart.as(this[_currentNode], _SplayTreeMapNode));
3693 }
3694 [_findLeftMostDescendent](node) {
3695 while (node != null) {
3696 this[_workList][dartx.add](node);
3697 node = node.left;
3698 }
3699 }
3700 [_rebuildWorkList](currentNode) {
3701 dart.assert(!dart.notNull(this[_workList][dartx.isEmpty]));
3702 this[_workList][dartx.clear]();
3703 if (currentNode == null) {
3704 this[_findLeftMostDescendent](this[_tree][_root]);
3705 } else {
3706 this[_tree][_splay](currentNode.key);
3707 this[_findLeftMostDescendent](this[_tree][_root].right);
3708 dart.assert(!dart.notNull(this[_workList][dartx.isEmpty]));
3709 }
3710 }
3711 moveNext() {
3712 if (this[_modificationCount] != this[_tree][_modificationCount]) {
3713 dart.throw(new core.ConcurrentModificationError(this[_tree]));
3714 }
3715 if (dart.notNull(this[_workList][dartx.isEmpty])) {
3716 this[_currentNode] = null;
3717 return false;
3718 }
3719 if (this[_tree][_splayCount] != this[_splayCount] && this[_currentNode] != null) {
3720 this[_rebuildWorkList](this[_currentNode]);
3721 }
3722 this[_currentNode] = this[_workList][dartx.removeLast]();
3723 this[_findLeftMostDescendent](this[_currentNode].right);
3724 return true;
3725 }
3726 }
3727 _SplayTreeIterator[dart.implements] = () => [core.Iterator$(T)];
3728 dart.defineNamedConstructor(_SplayTreeIterator, 'startAt');
3729 dart.setSignature(_SplayTreeIterator, {
3730 constructors: () => ({
3731 _SplayTreeIterator: [_SplayTreeIterator$(T), [_SplayTree]],
3732 startAt: [_SplayTreeIterator$(T), [_SplayTree, dart.dynamic]]
3733 }),
3734 methods: () => ({
3735 [_findLeftMostDescendent]: [dart.void, [_SplayTreeNode]],
3736 [_rebuildWorkList]: [dart.void, [_SplayTreeNode]],
3737 moveNext: [core.bool, []]
3738 })
3739 });
3740 return _SplayTreeIterator;
3741 });
3742 let _SplayTreeIterator = _SplayTreeIterator$();
3743 const _copyNode = Symbol('_copyNode');
3744 const _SplayTreeKeyIterable$ = dart.generic(function(K) {
3745 class _SplayTreeKeyIterable extends IterableBase$(K) {
3746 _SplayTreeKeyIterable(tree) {
3747 this[_tree] = tree;
3748 super.IterableBase();
3749 }
3750 get length() {
3751 return this[_tree][_count];
3752 }
3753 get isEmpty() {
3754 return this[_tree][_count] == 0;
3755 }
3756 get iterator() {
3757 return new (_SplayTreeKeyIterator$(K))(this[_tree]);
3758 }
3759 toSet() {
3760 let setOrMap = this[_tree];
3761 let set = new (SplayTreeSet$(K))(setOrMap[_comparator], setOrMap[_validK ey]);
3762 set[_count] = this[_tree][_count];
3763 set[_root] = set[_copyNode](this[_tree][_root]);
3764 return set;
3765 }
3766 }
3767 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
3768 dart.setSignature(_SplayTreeKeyIterable, {
3769 constructors: () => ({_SplayTreeKeyIterable: [_SplayTreeKeyIterable$(K), [ _SplayTree$(K)]]}),
3770 methods: () => ({toSet: [core.Set$(K), []]})
3771 });
3772 dart.defineExtensionMembers(_SplayTreeKeyIterable, ['toSet', 'length', 'isEm pty', 'iterator']);
3773 return _SplayTreeKeyIterable;
3774 });
3775 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$();
3776 const _SplayTreeValueIterable$ = dart.generic(function(K, V) {
3777 class _SplayTreeValueIterable extends IterableBase$(V) {
3778 _SplayTreeValueIterable(map) {
3779 this[_map] = map;
3780 super.IterableBase();
3781 }
3782 get length() {
3783 return this[_map][_count];
3784 }
3785 get isEmpty() {
3786 return this[_map][_count] == 0;
3787 }
3788 get iterator() {
3789 return new (_SplayTreeValueIterator$(K, V))(this[_map]);
3790 }
3791 }
3792 _SplayTreeValueIterable[dart.implements] = () => [_internal.EfficientLength] ;
3793 dart.setSignature(_SplayTreeValueIterable, {
3794 constructors: () => ({_SplayTreeValueIterable: [_SplayTreeValueIterable$(K , V), [SplayTreeMap$(K, V)]]})
3795 });
3796 dart.defineExtensionMembers(_SplayTreeValueIterable, ['length', 'isEmpty', ' iterator']);
3797 return _SplayTreeValueIterable;
3798 });
3799 let _SplayTreeValueIterable = _SplayTreeValueIterable$();
3800 const _SplayTreeKeyIterator$ = dart.generic(function(K) {
3801 class _SplayTreeKeyIterator extends _SplayTreeIterator$(K) {
3802 _SplayTreeKeyIterator(map) {
3803 super._SplayTreeIterator(map);
3804 }
3805 [_getValue](node) {
3806 return dart.as(node.key, K);
3807 }
3808 }
3809 dart.setSignature(_SplayTreeKeyIterator, {
3810 constructors: () => ({_SplayTreeKeyIterator: [_SplayTreeKeyIterator$(K), [ _SplayTree$(K)]]}),
3811 methods: () => ({[_getValue]: [K, [_SplayTreeNode]]})
3812 });
3813 return _SplayTreeKeyIterator;
3814 });
3815 let _SplayTreeKeyIterator = _SplayTreeKeyIterator$();
3816 const _SplayTreeValueIterator$ = dart.generic(function(K, V) {
3817 class _SplayTreeValueIterator extends _SplayTreeIterator$(V) {
3818 _SplayTreeValueIterator(map) {
3819 super._SplayTreeIterator(map);
3820 }
3821 [_getValue](node) {
3822 return dart.as(node.value, V);
3823 }
3824 }
3825 dart.setSignature(_SplayTreeValueIterator, {
3826 constructors: () => ({_SplayTreeValueIterator: [_SplayTreeValueIterator$(K , V), [SplayTreeMap$(K, V)]]}),
3827 methods: () => ({[_getValue]: [V, [_SplayTreeMapNode]]})
3828 });
3829 return _SplayTreeValueIterator;
3830 });
3831 let _SplayTreeValueIterator = _SplayTreeValueIterator$();
3832 const _SplayTreeNodeIterator$ = dart.generic(function(K) {
3833 class _SplayTreeNodeIterator extends _SplayTreeIterator$(_SplayTreeNode$(K)) {
3834 _SplayTreeNodeIterator(tree) {
3835 super._SplayTreeIterator(tree);
3836 }
3837 startAt(tree, startKey) {
3838 super.startAt(tree, startKey);
3839 }
3840 [_getValue](node) {
3841 return dart.as(node, _SplayTreeNode$(K));
3842 }
3843 }
3844 dart.defineNamedConstructor(_SplayTreeNodeIterator, 'startAt');
3845 dart.setSignature(_SplayTreeNodeIterator, {
3846 constructors: () => ({
3847 _SplayTreeNodeIterator: [_SplayTreeNodeIterator$(K), [_SplayTree$(K)]],
3848 startAt: [_SplayTreeNodeIterator$(K), [_SplayTree$(K), dart.dynamic]]
3849 }),
3850 methods: () => ({[_getValue]: [_SplayTreeNode$(K), [_SplayTreeNode]]})
3851 });
3852 return _SplayTreeNodeIterator;
3853 });
3854 let _SplayTreeNodeIterator = _SplayTreeNodeIterator$();
3855 const _clone = Symbol('_clone');
3856 const SplayTreeSet$ = dart.generic(function(E) {
3857 class SplayTreeSet extends dart.mixin(_SplayTree$(E), IterableMixin$(E), Set Mixin$(E)) {
3858 SplayTreeSet(compare, isValidKey) {
3859 if (compare === void 0) compare = null;
3860 if (isValidKey === void 0) isValidKey = null;
3861 this[_comparator] = dart.as(compare == null ? core.Comparable.compare : compare, core.Comparator$(E));
3862 this[_validKey] = isValidKey != null ? isValidKey : dart.fn(v => dart.is (v, E), core.bool, [core.Object]);
3863 super._SplayTree();
3864 }
3865 static from(elements, compare, isValidKey) {
3866 if (compare === void 0) compare = null;
3867 if (isValidKey === void 0) isValidKey = null;
3868 let result = new (SplayTreeSet$(E))(compare, isValidKey);
3869 for (let element of elements) {
3870 dart.as(element, E);
3871 result.add(element);
3872 }
3873 return result;
3874 }
3875 [_compare](e1, e2) {
3876 dart.as(e1, E);
3877 dart.as(e2, E);
3878 return this[_comparator](e1, e2);
3879 }
3880 get iterator() {
3881 return new (_SplayTreeKeyIterator$(E))(this);
3882 }
3883 get length() {
3884 return this[_count];
3885 }
3886 get isEmpty() {
3887 return this[_root] == null;
3888 }
3889 get isNotEmpty() {
3890 return this[_root] != null;
3891 }
3892 get first() {
3893 if (this[_count] == 0) dart.throw(_internal.IterableElementError.noEleme nt());
3894 return dart.as(this[_first].key, E);
3895 }
3896 get last() {
3897 if (this[_count] == 0) dart.throw(_internal.IterableElementError.noEleme nt());
3898 return dart.as(this[_last].key, E);
3899 }
3900 get single() {
3901 if (this[_count] == 0) dart.throw(_internal.IterableElementError.noEleme nt());
3902 if (dart.notNull(this[_count]) > 1) dart.throw(_internal.IterableElement Error.tooMany());
3903 return this[_root].key;
3904 }
3905 contains(object) {
3906 return dart.notNull(this[_validKey](object)) && this[_splay](dart.as(obj ect, E)) == 0;
3907 }
3908 add(element) {
3909 dart.as(element, E);
3910 let compare = this[_splay](element);
3911 if (compare == 0) return false;
3912 this[_addNewRoot](new (_SplayTreeNode$(E))(element), compare);
3913 return true;
3914 }
3915 remove(object) {
3916 if (!dart.notNull(this[_validKey](object))) return false;
3917 return this[_remove](dart.as(object, E)) != null;
3918 }
3919 addAll(elements) {
3920 dart.as(elements, core.Iterable$(E));
3921 for (let element of elements) {
3922 let compare = this[_splay](element);
3923 if (compare != 0) {
3924 this[_addNewRoot](new (_SplayTreeNode$(E))(element), compare);
3925 }
3926 }
3927 }
3928 removeAll(elements) {
3929 for (let element of elements) {
3930 if (dart.notNull(this[_validKey](element))) this[_remove](dart.as(elem ent, E));
3931 }
3932 }
3933 retainAll(elements) {
3934 let retainSet = new (SplayTreeSet$(E))(this[_comparator], this[_validKey ]);
3935 let modificationCount = this[_modificationCount];
3936 for (let object of elements) {
3937 if (modificationCount != this[_modificationCount]) {
3938 dart.throw(new core.ConcurrentModificationError(this));
3939 }
3940 if (dart.notNull(this[_validKey](object)) && this[_splay](dart.as(obje ct, E)) == 0) retainSet.add(this[_root].key);
3941 }
3942 if (retainSet[_count] != this[_count]) {
3943 this[_root] = retainSet[_root];
3944 this[_count] = retainSet[_count];
3945 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3946 }
3947 }
3948 lookup(object) {
3949 if (!dart.notNull(this[_validKey](object))) return null;
3950 let comp = this[_splay](dart.as(object, E));
3951 if (comp != 0) return null;
3952 return this[_root].key;
3953 }
3954 intersection(other) {
3955 let result = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]);
3956 for (let element of this) {
3957 if (dart.notNull(other.contains(element))) result.add(element);
3958 }
3959 return result;
3960 }
3961 difference(other) {
3962 let result = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]);
3963 for (let element of this) {
3964 if (!dart.notNull(other.contains(element))) result.add(element);
3965 }
3966 return result;
3967 }
3968 union(other) {
3969 dart.as(other, core.Set$(E));
3970 let _ = this[_clone]();
3971 _.addAll(other);
3972 return _;
3973 }
3974 [_clone]() {
3975 let set = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]);
3976 set[_count] = this[_count];
3977 set[_root] = this[_copyNode](this[_root]);
3978 return set;
3979 }
3980 [_copyNode](node) {
3981 dart.as(node, _SplayTreeNode$(E));
3982 if (node == null) return null;
3983 let _ = new (_SplayTreeNode$(E))(node.key);
3984 _.left = this[_copyNode](node.left);
3985 _.right = this[_copyNode](node.right);
3986 return _;
3987 }
3988 clear() {
3989 this[_clear]();
3990 }
3991 toSet() {
3992 return this[_clone]();
3993 }
3994 toString() {
3995 return IterableBase.iterableToFullString(this, '{', '}');
3996 }
3997 }
3998 dart.setSignature(SplayTreeSet, {
3999 constructors: () => ({
4000 SplayTreeSet: [SplayTreeSet$(E), [], [dart.functionType(core.int, [E, E] ), dart.functionType(core.bool, [core.Object])]],
4001 from: [SplayTreeSet$(E), [core.Iterable], [dart.functionType(core.int, [ E, E]), dart.functionType(core.bool, [core.Object])]]
4002 }),
4003 methods: () => ({
4004 [_compare]: [core.int, [E, E]],
4005 contains: [core.bool, [core.Object]],
4006 add: [core.bool, [E]],
4007 remove: [core.bool, [core.Object]],
4008 addAll: [dart.void, [core.Iterable$(E)]],
4009 lookup: [E, [core.Object]],
4010 intersection: [core.Set$(E), [core.Set$(core.Object)]],
4011 difference: [core.Set$(E), [core.Set$(core.Object)]],
4012 union: [core.Set$(E), [core.Set$(E)]],
4013 [_clone]: [SplayTreeSet$(E), []],
4014 [_copyNode]: [_SplayTreeNode$(E), [_SplayTreeNode$(E)]],
4015 toSet: [core.Set$(E), []]
4016 })
4017 });
4018 dart.defineExtensionMembers(SplayTreeSet, [
4019 'contains',
4020 'toSet',
4021 'iterator',
4022 'length',
4023 'isEmpty',
4024 'isNotEmpty',
4025 'first',
4026 'last',
4027 'single'
4028 ]);
4029 return SplayTreeSet;
4030 });
4031 let SplayTreeSet = SplayTreeSet$();
4032 const _strings = Symbol('_strings');
4033 const _nums = Symbol('_nums');
4034 const _rest = Symbol('_rest');
4035 const _containsKey = Symbol('_containsKey');
4036 const _getBucket = Symbol('_getBucket');
4037 const _findBucketIndex = Symbol('_findBucketIndex');
4038 const _computeKeys = Symbol('_computeKeys');
4039 const _get = Symbol('_get');
4040 const _addHashTableEntry = Symbol('_addHashTableEntry');
4041 const _set = Symbol('_set');
4042 const _computeHashCode = Symbol('_computeHashCode');
4043 const _removeHashTableEntry = Symbol('_removeHashTableEntry');
4044 const _HashMap$ = dart.generic(function(K, V) {
4045 class _HashMap extends core.Object {
4046 _HashMap() {
4047 this[_length] = 0;
4048 this[_strings] = null;
4049 this[_nums] = null;
4050 this[_rest] = null;
4051 this[_keys] = null;
4052 }
4053 get length() {
4054 return this[_length];
4055 }
4056 get isEmpty() {
4057 return this[_length] == 0;
4058 }
4059 get isNotEmpty() {
4060 return !dart.notNull(this.isEmpty);
4061 }
4062 get keys() {
4063 return new (HashMapKeyIterable$(K))(this);
4064 }
4065 get values() {
4066 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => {
4067 dart.as(each, K);
4068 return this.get(each);
4069 }, V, [K]));
4070 }
4071 containsKey(key) {
4072 if (dart.notNull(_HashMap$()._isStringKey(key))) {
4073 let strings = this[_strings];
4074 return strings == null ? false : _HashMap$()._hasTableEntry(strings, k ey);
4075 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) {
4076 let nums = this[_nums];
4077 return nums == null ? false : _HashMap$()._hasTableEntry(nums, key);
4078 } else {
4079 return this[_containsKey](key);
4080 }
4081 }
4082 [_containsKey](key) {
4083 let rest = this[_rest];
4084 if (rest == null) return false;
4085 let bucket = this[_getBucket](rest, key);
4086 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0;
4087 }
4088 containsValue(value) {
4089 return this[_computeKeys]()[dartx.any](dart.fn(each => dart.equals(this. get(each), value), core.bool, [dart.dynamic]));
4090 }
4091 addAll(other) {
4092 dart.as(other, core.Map$(K, V));
4093 other[dartx.forEach](dart.fn((key, value) => {
4094 dart.as(key, K);
4095 dart.as(value, V);
4096 this.set(key, value);
4097 }, dart.void, [K, V]));
4098 }
4099 get(key) {
4100 if (dart.notNull(_HashMap$()._isStringKey(key))) {
4101 let strings = this[_strings];
4102 return dart.as(strings == null ? null : _HashMap$()._getTableEntry(str ings, key), V);
4103 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) {
4104 let nums = this[_nums];
4105 return dart.as(nums == null ? null : _HashMap$()._getTableEntry(nums, key), V);
4106 } else {
4107 return this[_get](key);
4108 }
4109 }
4110 [_get](key) {
4111 let rest = this[_rest];
4112 if (rest == null) return null;
4113 let bucket = this[_getBucket](rest, key);
4114 let index = this[_findBucketIndex](bucket, key);
4115 return dart.as(dart.notNull(index) < 0 ? null : bucket[dart.notNull(inde x) + 1], V);
4116 }
4117 set(key, value) {
4118 dart.as(key, K);
4119 dart.as(value, V);
4120 if (dart.notNull(_HashMap$()._isStringKey(key))) {
4121 let strings = this[_strings];
4122 if (strings == null) this[_strings] = strings = _HashMap$()._newHashTa ble();
4123 this[_addHashTableEntry](strings, key, value);
4124 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) {
4125 let nums = this[_nums];
4126 if (nums == null) this[_nums] = nums = _HashMap$()._newHashTable();
4127 this[_addHashTableEntry](nums, key, value);
4128 } else {
4129 this[_set](key, value);
4130 }
4131 return value;
4132 }
4133 [_set](key, value) {
4134 dart.as(key, K);
4135 dart.as(value, V);
4136 let rest = this[_rest];
4137 if (rest == null) this[_rest] = rest = _HashMap$()._newHashTable();
4138 let hash = this[_computeHashCode](key);
4139 let bucket = rest[hash];
4140 if (bucket == null) {
4141 _HashMap$()._setTableEntry(rest, hash, [key, value]);
4142 this[_length] = dart.notNull(this[_length]) + 1;
4143 this[_keys] = null;
4144 } else {
4145 let index = this[_findBucketIndex](bucket, key);
4146 if (dart.notNull(index) >= 0) {
4147 bucket[dart.notNull(index) + 1] = value;
4148 } else {
4149 bucket.push(key, value);
4150 this[_length] = dart.notNull(this[_length]) + 1;
4151 this[_keys] = null;
4152 }
4153 }
4154 }
4155 putIfAbsent(key, ifAbsent) {
4156 dart.as(key, K);
4157 dart.as(ifAbsent, dart.functionType(V, []));
4158 if (dart.notNull(this.containsKey(key))) return this.get(key);
4159 let value = ifAbsent();
4160 this.set(key, value);
4161 return value;
4162 }
4163 remove(key) {
4164 if (dart.notNull(_HashMap$()._isStringKey(key))) {
4165 return this[_removeHashTableEntry](this[_strings], key);
4166 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) {
4167 return this[_removeHashTableEntry](this[_nums], key);
4168 } else {
4169 return this[_remove](key);
4170 }
4171 }
4172 [_remove](key) {
4173 let rest = this[_rest];
4174 if (rest == null) return null;
4175 let bucket = this[_getBucket](rest, key);
4176 let index = this[_findBucketIndex](bucket, key);
4177 if (dart.notNull(index) < 0) return null;
4178 this[_length] = dart.notNull(this[_length]) - 1;
4179 this[_keys] = null;
4180 return dart.as(bucket.splice(index, 2)[1], V);
4181 }
4182 clear() {
4183 if (dart.notNull(this[_length]) > 0) {
4184 this[_strings] = this[_nums] = this[_rest] = this[_keys] = null;
4185 this[_length] = 0;
4186 }
4187 }
4188 forEach(action) {
4189 dart.as(action, dart.functionType(dart.void, [K, V]));
4190 let keys = this[_computeKeys]();
4191 for (let i = 0, length = keys[dartx.length]; i < dart.notNull(length); i ++) {
4192 let key = keys[i];
4193 action(dart.as(key, K), this.get(key));
4194 if (keys !== this[_keys]) {
4195 dart.throw(new core.ConcurrentModificationError(this));
4196 }
4197 }
4198 }
4199 [_computeKeys]() {
4200 if (this[_keys] != null) return this[_keys];
4201 let result = core.List.new(this[_length]);
4202 let index = 0;
4203 let strings = this[_strings];
4204 if (strings != null) {
4205 let names = Object.getOwnPropertyNames(strings);
4206 let entries = names.length;
4207 for (let i = 0; i < entries; i++) {
4208 let key = names[i];
4209 result[index] = key;
4210 index++;
4211 }
4212 }
4213 let nums = this[_nums];
4214 if (nums != null) {
4215 let names = Object.getOwnPropertyNames(nums);
4216 let entries = names.length;
4217 for (let i = 0; i < entries; i++) {
4218 let key = +names[i];
4219 result[index] = key;
4220 index++;
4221 }
4222 }
4223 let rest = this[_rest];
4224 if (rest != null) {
4225 let names = Object.getOwnPropertyNames(rest);
4226 let entries = names.length;
4227 for (let i = 0; i < entries; i++) {
4228 let key = names[i];
4229 let bucket = rest[key];
4230 let length = bucket.length;
4231 for (let i = 0; i < length; i = i + 2) {
4232 let key = bucket[i];
4233 result[index] = key;
4234 index++;
4235 }
4236 }
4237 }
4238 dart.assert(index == this[_length]);
4239 return this[_keys] = result;
4240 }
4241 [_addHashTableEntry](table, key, value) {
4242 dart.as(key, K);
4243 dart.as(value, V);
4244 if (!dart.notNull(_HashMap$()._hasTableEntry(table, key))) {
4245 this[_length] = dart.notNull(this[_length]) + 1;
4246 this[_keys] = null;
4247 }
4248 _HashMap$()._setTableEntry(table, key, value);
4249 }
4250 [_removeHashTableEntry](table, key) {
4251 if (table != null && dart.notNull(_HashMap$()._hasTableEntry(table, key) )) {
4252 let value = dart.as(_HashMap$()._getTableEntry(table, key), V);
4253 _HashMap$()._deleteTableEntry(table, key);
4254 this[_length] = dart.notNull(this[_length]) - 1;
4255 this[_keys] = null;
4256 return value;
4257 } else {
4258 return null;
4259 }
4260 }
4261 static _isStringKey(key) {
4262 return typeof key == 'string' && key != '__proto__';
4263 }
4264 static _isNumericKey(key) {
4265 return typeof key == 'number' && (key & 0x3ffffff) === key;
4266 }
4267 [_computeHashCode](key) {
4268 return dart.hashCode(key) & 0x3ffffff;
4269 }
4270 static _hasTableEntry(table, key) {
4271 let entry = table[key];
4272 return entry != null;
4273 }
4274 static _getTableEntry(table, key) {
4275 let entry = table[key];
4276 return entry === table ? null : entry;
4277 }
4278 static _setTableEntry(table, key, value) {
4279 if (value == null) {
4280 table[key] = table;
4281 } else {
4282 table[key] = value;
4283 }
4284 }
4285 static _deleteTableEntry(table, key) {
4286 delete table[key];
4287 }
4288 [_getBucket](table, key) {
4289 let hash = this[_computeHashCode](key);
4290 return dart.as(table[hash], core.List);
4291 }
4292 [_findBucketIndex](bucket, key) {
4293 if (bucket == null) return -1;
4294 let length = bucket.length;
4295 for (let i = 0; i < length; i = i + 2) {
4296 if (dart.equals(bucket[i], key)) return i;
4297 }
4298 return -1;
4299 }
4300 static _newHashTable() {
4301 let table = Object.create(null);
4302 let temporaryKey = '<non-identifier-key>';
4303 _HashMap$()._setTableEntry(table, temporaryKey, table);
4304 _HashMap$()._deleteTableEntry(table, temporaryKey);
4305 return table;
4306 }
4307 }
4308 _HashMap[dart.implements] = () => [HashMap$(K, V)];
4309 dart.setSignature(_HashMap, {
4310 constructors: () => ({_HashMap: [_HashMap$(K, V), []]}),
4311 methods: () => ({
4312 containsKey: [core.bool, [core.Object]],
4313 [_containsKey]: [core.bool, [core.Object]],
4314 containsValue: [core.bool, [core.Object]],
4315 addAll: [dart.void, [core.Map$(K, V)]],
4316 get: [V, [core.Object]],
4317 [_get]: [V, [core.Object]],
4318 set: [dart.void, [K, V]],
4319 [_set]: [dart.void, [K, V]],
4320 putIfAbsent: [V, [K, dart.functionType(V, [])]],
4321 remove: [V, [core.Object]],
4322 [_remove]: [V, [core.Object]],
4323 clear: [dart.void, []],
4324 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]],
4325 [_computeKeys]: [core.List, []],
4326 [_addHashTableEntry]: [dart.void, [dart.dynamic, K, V]],
4327 [_removeHashTableEntry]: [V, [dart.dynamic, core.Object]],
4328 [_computeHashCode]: [core.int, [dart.dynamic]],
4329 [_getBucket]: [core.List, [dart.dynamic, dart.dynamic]],
4330 [_findBucketIndex]: [core.int, [dart.dynamic, dart.dynamic]]
4331 }),
4332 statics: () => ({
4333 _isStringKey: [core.bool, [dart.dynamic]],
4334 _isNumericKey: [core.bool, [dart.dynamic]],
4335 _hasTableEntry: [core.bool, [dart.dynamic, dart.dynamic]],
4336 _getTableEntry: [dart.dynamic, [dart.dynamic, dart.dynamic]],
4337 _setTableEntry: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]],
4338 _deleteTableEntry: [dart.void, [dart.dynamic, dart.dynamic]],
4339 _newHashTable: [dart.dynamic, []]
4340 }),
4341 names: ['_isStringKey', '_isNumericKey', '_hasTableEntry', '_getTableEntry ', '_setTableEntry', '_deleteTableEntry', '_newHashTable']
4342 });
4343 dart.defineExtensionMembers(_HashMap, [
4344 'containsKey',
4345 'containsValue',
4346 'addAll',
4347 'get',
4348 'set',
4349 'putIfAbsent',
4350 'remove',
4351 'clear',
4352 'forEach',
4353 'length',
4354 'isEmpty',
4355 'isNotEmpty',
4356 'keys',
4357 'values'
4358 ]);
4359 return _HashMap;
4360 });
4361 let _HashMap = _HashMap$();
4362 const _IdentityHashMap$ = dart.generic(function(K, V) {
4363 class _IdentityHashMap extends _HashMap$(K, V) {
4364 _IdentityHashMap() {
4365 super._HashMap();
4366 }
4367 [_computeHashCode](key) {
4368 return core.identityHashCode(key) & 0x3ffffff;
4369 }
4370 [_findBucketIndex](bucket, key) {
4371 if (bucket == null) return -1;
4372 let length = bucket.length;
4373 for (let i = 0; i < length; i = i + 2) {
4374 if (core.identical(bucket[i], key)) return i;
4375 }
4376 return -1;
4377 }
4378 }
4379 return _IdentityHashMap;
4380 });
4381 let _IdentityHashMap = _IdentityHashMap$();
4382 const _equals = Symbol('_equals');
4383 const _hashCode = Symbol('_hashCode');
4384 const _CustomHashMap$ = dart.generic(function(K, V) {
4385 class _CustomHashMap extends _HashMap$(K, V) {
4386 _CustomHashMap(equals, hashCode, validKey) {
4387 this[_equals] = equals;
4388 this[_hashCode] = hashCode;
4389 this[_validKey] = validKey != null ? validKey : dart.fn(v => dart.is(v, K), core.bool, [core.Object]);
4390 super._HashMap();
4391 }
4392 get(key) {
4393 if (!dart.notNull(this[_validKey](key))) return null;
4394 return super[_get](key);
4395 }
4396 set(key, value) {
4397 dart.as(key, K);
4398 dart.as(value, V);
4399 super[_set](key, value);
4400 return value;
4401 }
4402 containsKey(key) {
4403 if (!dart.notNull(this[_validKey](key))) return false;
4404 return super[_containsKey](key);
4405 }
4406 remove(key) {
4407 if (!dart.notNull(this[_validKey](key))) return null;
4408 return super[_remove](key);
4409 }
4410 [_computeHashCode](key) {
4411 return this[_hashCode](dart.as(key, K)) & 0x3ffffff;
4412 }
4413 [_findBucketIndex](bucket, key) {
4414 if (bucket == null) return -1;
4415 let length = bucket.length;
4416 for (let i = 0; i < length; i = i + 2) {
4417 if (dart.notNull(this[_equals](dart.as(bucket[i], K), dart.as(key, K)) )) return i;
4418 }
4419 return -1;
4420 }
4421 toString() {
4422 return Maps.mapToString(this);
4423 }
4424 }
4425 dart.setSignature(_CustomHashMap, {
4426 constructors: () => ({_CustomHashMap: [_CustomHashMap$(K, V), [_Equality$( K), _Hasher$(K), dart.functionType(core.bool, [core.Object])]]}),
4427 methods: () => ({
4428 get: [V, [core.Object]],
4429 set: [dart.void, [K, V]],
4430 remove: [V, [core.Object]]
4431 })
4432 });
4433 dart.defineExtensionMembers(_CustomHashMap, ['get', 'set', 'containsKey', 'r emove']);
4434 return _CustomHashMap;
4435 });
4436 let _CustomHashMap = _CustomHashMap$();
4437 const HashMapKeyIterable$ = dart.generic(function(E) {
4438 class HashMapKeyIterable extends IterableBase$(E) {
4439 HashMapKeyIterable(map) {
4440 this[_map] = map;
4441 super.IterableBase();
4442 }
4443 get length() {
4444 return dart.as(dart.dload(this[_map], _length), core.int);
4445 }
4446 get isEmpty() {
4447 return dart.equals(dart.dload(this[_map], _length), 0);
4448 }
4449 get iterator() {
4450 return new (HashMapKeyIterator$(E))(this[_map], dart.as(dart.dsend(this[ _map], _computeKeys), core.List));
4451 }
4452 contains(element) {
4453 return dart.as(dart.dsend(this[_map], 'containsKey', element), core.bool );
4454 }
4455 forEach(f) {
4456 dart.as(f, dart.functionType(dart.void, [E]));
4457 let keys = dart.as(dart.dsend(this[_map], _computeKeys), core.List);
4458 for (let i = 0, length = keys.length; i < length; i++) {
4459 f(dart.as(keys[i], E));
4460 if (keys !== dart.dload(this[_map], _keys)) {
4461 dart.throw(new core.ConcurrentModificationError(this[_map]));
4462 }
4463 }
4464 }
4465 }
4466 HashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength];
4467 dart.setSignature(HashMapKeyIterable, {
4468 constructors: () => ({HashMapKeyIterable: [HashMapKeyIterable$(E), [dart.d ynamic]]}),
4469 methods: () => ({forEach: [dart.void, [dart.functionType(dart.void, [E])]] })
4470 });
4471 dart.defineExtensionMembers(HashMapKeyIterable, [
4472 'contains',
4473 'forEach',
4474 'length',
4475 'isEmpty',
4476 'iterator'
4477 ]);
4478 return HashMapKeyIterable;
4479 });
4480 let HashMapKeyIterable = HashMapKeyIterable$();
4481 const _offset = Symbol('_offset');
4482 const HashMapKeyIterator$ = dart.generic(function(E) {
4483 class HashMapKeyIterator extends core.Object {
4484 HashMapKeyIterator(map, keys) {
4485 this[_map] = map;
4486 this[_keys] = keys;
4487 this[_offset] = 0;
4488 this[_current] = null;
4489 }
4490 get current() {
4491 return this[_current];
4492 }
4493 moveNext() {
4494 let keys = this[_keys];
4495 let offset = this[_offset];
4496 if (keys !== dart.dload(this[_map], _keys)) {
4497 dart.throw(new core.ConcurrentModificationError(this[_map]));
4498 } else if (dart.notNull(offset) >= keys.length) {
4499 this[_current] = null;
4500 return false;
4501 } else {
4502 this[_current] = dart.as(keys[offset], E);
4503 this[_offset] = dart.notNull(offset) + 1;
4504 return true;
4505 }
4506 }
4507 }
4508 HashMapKeyIterator[dart.implements] = () => [core.Iterator$(E)];
4509 dart.setSignature(HashMapKeyIterator, {
4510 constructors: () => ({HashMapKeyIterator: [HashMapKeyIterator$(E), [dart.d ynamic, core.List]]}),
4511 methods: () => ({moveNext: [core.bool, []]})
4512 });
4513 return HashMapKeyIterator;
4514 });
4515 let HashMapKeyIterator = HashMapKeyIterator$();
4516 const _modifications = Symbol('_modifications');
4517 const _value = Symbol('_value');
4518 const _newLinkedCell = Symbol('_newLinkedCell');
4519 const _unlinkCell = Symbol('_unlinkCell');
4520 const _modified = Symbol('_modified');
4521 const _key = Symbol('_key');
4522 const _LinkedHashMap$ = dart.generic(function(K, V) {
4523 class _LinkedHashMap extends core.Object {
4524 _LinkedHashMap() {
4525 this[_length] = 0;
4526 this[_strings] = null;
4527 this[_nums] = null;
4528 this[_rest] = null;
4529 this[_first] = null;
4530 this[_last] = null;
4531 this[_modifications] = 0;
4532 }
4533 get length() {
4534 return this[_length];
4535 }
4536 get isEmpty() {
4537 return this[_length] == 0;
4538 }
4539 get isNotEmpty() {
4540 return !dart.notNull(this.isEmpty);
4541 }
4542 get keys() {
4543 return new (LinkedHashMapKeyIterable$(K))(this);
4544 }
4545 get values() {
4546 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => {
4547 dart.as(each, K);
4548 return this.get(each);
4549 }, V, [K]));
4550 }
4551 containsKey(key) {
4552 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) {
4553 let strings = this[_strings];
4554 if (strings == null) return false;
4555 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin kedHashMapCell);
4556 return cell != null;
4557 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) {
4558 let nums = this[_nums];
4559 if (nums == null) return false;
4560 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked HashMapCell);
4561 return cell != null;
4562 } else {
4563 return this[_containsKey](key);
4564 }
4565 }
4566 [_containsKey](key) {
4567 let rest = this[_rest];
4568 if (rest == null) return false;
4569 let bucket = this[_getBucket](rest, key);
4570 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0;
4571 }
4572 containsValue(value) {
4573 return this.keys[dartx.any](dart.fn(each => {
4574 dart.as(each, K);
4575 return dart.equals(this.get(each), value);
4576 }, core.bool, [K]));
4577 }
4578 addAll(other) {
4579 dart.as(other, core.Map$(K, V));
4580 other[dartx.forEach](dart.fn((key, value) => {
4581 dart.as(key, K);
4582 dart.as(value, V);
4583 this.set(key, value);
4584 }, dart.void, [K, V]));
4585 }
4586 get(key) {
4587 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) {
4588 let strings = this[_strings];
4589 if (strings == null) return null;
4590 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin kedHashMapCell);
4591 return dart.as(cell == null ? null : cell[_value], V);
4592 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) {
4593 let nums = this[_nums];
4594 if (nums == null) return null;
4595 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked HashMapCell);
4596 return dart.as(cell == null ? null : cell[_value], V);
4597 } else {
4598 return this[_get](key);
4599 }
4600 }
4601 [_get](key) {
4602 let rest = this[_rest];
4603 if (rest == null) return null;
4604 let bucket = this[_getBucket](rest, key);
4605 let index = this[_findBucketIndex](bucket, key);
4606 if (dart.notNull(index) < 0) return null;
4607 let cell = dart.as(bucket[index], LinkedHashMapCell);
4608 return dart.as(cell[_value], V);
4609 }
4610 set(key, value) {
4611 dart.as(key, K);
4612 dart.as(value, V);
4613 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) {
4614 let strings = this[_strings];
4615 if (strings == null) this[_strings] = strings = _LinkedHashMap$()._new HashTable();
4616 this[_addHashTableEntry](strings, key, value);
4617 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) {
4618 let nums = this[_nums];
4619 if (nums == null) this[_nums] = nums = _LinkedHashMap$()._newHashTable ();
4620 this[_addHashTableEntry](nums, key, value);
4621 } else {
4622 this[_set](key, value);
4623 }
4624 return value;
4625 }
4626 [_set](key, value) {
4627 dart.as(key, K);
4628 dart.as(value, V);
4629 let rest = this[_rest];
4630 if (rest == null) this[_rest] = rest = _LinkedHashMap$()._newHashTable() ;
4631 let hash = this[_computeHashCode](key);
4632 let bucket = rest[hash];
4633 if (bucket == null) {
4634 let cell = this[_newLinkedCell](key, value);
4635 _LinkedHashMap$()._setTableEntry(rest, hash, [cell]);
4636 } else {
4637 let index = this[_findBucketIndex](bucket, key);
4638 if (dart.notNull(index) >= 0) {
4639 let cell = dart.as(bucket[index], LinkedHashMapCell);
4640 cell[_value] = value;
4641 } else {
4642 let cell = this[_newLinkedCell](key, value);
4643 bucket.push(cell);
4644 }
4645 }
4646 }
4647 putIfAbsent(key, ifAbsent) {
4648 dart.as(key, K);
4649 dart.as(ifAbsent, dart.functionType(V, []));
4650 if (dart.notNull(this.containsKey(key))) return this.get(key);
4651 let value = ifAbsent();
4652 this.set(key, value);
4653 return value;
4654 }
4655 remove(key) {
4656 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) {
4657 return this[_removeHashTableEntry](this[_strings], key);
4658 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) {
4659 return this[_removeHashTableEntry](this[_nums], key);
4660 } else {
4661 return this[_remove](key);
4662 }
4663 }
4664 [_remove](key) {
4665 let rest = this[_rest];
4666 if (rest == null) return null;
4667 let bucket = this[_getBucket](rest, key);
4668 let index = this[_findBucketIndex](bucket, key);
4669 if (dart.notNull(index) < 0) return null;
4670 let cell = dart.as(bucket.splice(index, 1)[0], LinkedHashMapCell);
4671 this[_unlinkCell](cell);
4672 return dart.as(cell[_value], V);
4673 }
4674 clear() {
4675 if (dart.notNull(this[_length]) > 0) {
4676 this[_strings] = this[_nums] = this[_rest] = this[_first] = this[_last ] = null;
4677 this[_length] = 0;
4678 this[_modified]();
4679 }
4680 }
4681 forEach(action) {
4682 dart.as(action, dart.functionType(dart.void, [K, V]));
4683 let cell = this[_first];
4684 let modifications = this[_modifications];
4685 while (cell != null) {
4686 action(dart.as(cell[_key], K), dart.as(cell[_value], V));
4687 if (modifications != this[_modifications]) {
4688 dart.throw(new core.ConcurrentModificationError(this));
4689 }
4690 cell = cell[_next];
4691 }
4692 }
4693 [_addHashTableEntry](table, key, value) {
4694 dart.as(key, K);
4695 dart.as(value, V);
4696 let cell = dart.as(_LinkedHashMap$()._getTableEntry(table, key), LinkedH ashMapCell);
4697 if (cell == null) {
4698 _LinkedHashMap$()._setTableEntry(table, key, this[_newLinkedCell](key, value));
4699 } else {
4700 cell[_value] = value;
4701 }
4702 }
4703 [_removeHashTableEntry](table, key) {
4704 if (table == null) return null;
4705 let cell = dart.as(_LinkedHashMap$()._getTableEntry(table, key), LinkedH ashMapCell);
4706 if (cell == null) return null;
4707 this[_unlinkCell](cell);
4708 _LinkedHashMap$()._deleteTableEntry(table, key);
4709 return dart.as(cell[_value], V);
4710 }
4711 [_modified]() {
4712 this[_modifications] = dart.notNull(this[_modifications]) + 1 & 67108863 ;
4713 }
4714 [_newLinkedCell](key, value) {
4715 dart.as(key, K);
4716 dart.as(value, V);
4717 let cell = new LinkedHashMapCell(key, value);
4718 if (this[_first] == null) {
4719 this[_first] = this[_last] = cell;
4720 } else {
4721 let last = this[_last];
4722 cell[_previous] = last;
4723 this[_last] = last[_next] = cell;
4724 }
4725 this[_length] = dart.notNull(this[_length]) + 1;
4726 this[_modified]();
4727 return cell;
4728 }
4729 [_unlinkCell](cell) {
4730 let previous = cell[_previous];
4731 let next = cell[_next];
4732 if (previous == null) {
4733 dart.assert(dart.equals(cell, this[_first]));
4734 this[_first] = next;
4735 } else {
4736 previous[_next] = next;
4737 }
4738 if (next == null) {
4739 dart.assert(dart.equals(cell, this[_last]));
4740 this[_last] = previous;
4741 } else {
4742 next[_previous] = previous;
4743 }
4744 this[_length] = dart.notNull(this[_length]) - 1;
4745 this[_modified]();
4746 }
4747 static _isStringKey(key) {
4748 return typeof key == 'string' && key != '__proto__';
4749 }
4750 static _isNumericKey(key) {
4751 return typeof key == 'number' && (key & 0x3ffffff) === key;
4752 }
4753 [_computeHashCode](key) {
4754 return dart.hashCode(key) & 0x3ffffff;
4755 }
4756 static _getTableEntry(table, key) {
4757 return table[key];
4758 }
4759 static _setTableEntry(table, key, value) {
4760 dart.assert(value != null);
4761 table[key] = value;
4762 }
4763 static _deleteTableEntry(table, key) {
4764 delete table[key];
4765 }
4766 [_getBucket](table, key) {
4767 let hash = this[_computeHashCode](key);
4768 return dart.as(table[hash], core.List);
4769 }
4770 [_findBucketIndex](bucket, key) {
4771 if (bucket == null) return -1;
4772 let length = bucket.length;
4773 for (let i = 0; i < length; i++) {
4774 let cell = dart.as(bucket[i], LinkedHashMapCell);
4775 if (dart.equals(cell[_key], key)) return i;
4776 }
4777 return -1;
4778 }
4779 static _newHashTable() {
4780 let table = Object.create(null);
4781 let temporaryKey = '<non-identifier-key>';
4782 _LinkedHashMap$()._setTableEntry(table, temporaryKey, table);
4783 _LinkedHashMap$()._deleteTableEntry(table, temporaryKey);
4784 return table;
4785 }
4786 toString() {
4787 return Maps.mapToString(this);
4788 }
4789 }
4790 _LinkedHashMap[dart.implements] = () => [LinkedHashMap$(K, V), _js_helper.In ternalMap];
4791 dart.setSignature(_LinkedHashMap, {
4792 constructors: () => ({_LinkedHashMap: [_LinkedHashMap$(K, V), []]}),
4793 methods: () => ({
4794 containsKey: [core.bool, [core.Object]],
4795 [_containsKey]: [core.bool, [core.Object]],
4796 containsValue: [core.bool, [core.Object]],
4797 addAll: [dart.void, [core.Map$(K, V)]],
4798 get: [V, [core.Object]],
4799 [_get]: [V, [core.Object]],
4800 set: [dart.void, [K, V]],
4801 [_set]: [dart.void, [K, V]],
4802 putIfAbsent: [V, [K, dart.functionType(V, [])]],
4803 remove: [V, [core.Object]],
4804 [_remove]: [V, [core.Object]],
4805 clear: [dart.void, []],
4806 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]],
4807 [_addHashTableEntry]: [dart.void, [dart.dynamic, K, V]],
4808 [_removeHashTableEntry]: [V, [dart.dynamic, core.Object]],
4809 [_modified]: [dart.void, []],
4810 [_newLinkedCell]: [LinkedHashMapCell, [K, V]],
4811 [_unlinkCell]: [dart.void, [LinkedHashMapCell]],
4812 [_computeHashCode]: [core.int, [dart.dynamic]],
4813 [_getBucket]: [core.List, [dart.dynamic, dart.dynamic]],
4814 [_findBucketIndex]: [core.int, [dart.dynamic, dart.dynamic]]
4815 }),
4816 statics: () => ({
4817 _isStringKey: [core.bool, [dart.dynamic]],
4818 _isNumericKey: [core.bool, [dart.dynamic]],
4819 _getTableEntry: [dart.dynamic, [dart.dynamic, dart.dynamic]],
4820 _setTableEntry: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]],
4821 _deleteTableEntry: [dart.void, [dart.dynamic, dart.dynamic]],
4822 _newHashTable: [dart.dynamic, []]
4823 }),
4824 names: ['_isStringKey', '_isNumericKey', '_getTableEntry', '_setTableEntry ', '_deleteTableEntry', '_newHashTable']
4825 });
4826 dart.defineExtensionMembers(_LinkedHashMap, [
4827 'containsKey',
4828 'containsValue',
4829 'addAll',
4830 'get',
4831 'set',
4832 'putIfAbsent',
4833 'remove',
4834 'clear',
4835 'forEach',
4836 'length',
4837 'isEmpty',
4838 'isNotEmpty',
4839 'keys',
4840 'values'
4841 ]);
4842 return _LinkedHashMap;
4843 });
4844 let _LinkedHashMap = _LinkedHashMap$();
4845 const _LinkedIdentityHashMap$ = dart.generic(function(K, V) {
4846 class _LinkedIdentityHashMap extends _LinkedHashMap$(K, V) {
4847 _LinkedIdentityHashMap() {
4848 super._LinkedHashMap();
4849 }
4850 [_computeHashCode](key) {
4851 return core.identityHashCode(key) & 0x3ffffff;
4852 }
4853 [_findBucketIndex](bucket, key) {
4854 if (bucket == null) return -1;
4855 let length = bucket.length;
4856 for (let i = 0; i < length; i++) {
4857 let cell = dart.as(bucket[i], LinkedHashMapCell);
4858 if (core.identical(cell[_key], key)) return i;
4859 }
4860 return -1;
4861 }
4862 }
4863 return _LinkedIdentityHashMap;
4864 });
4865 let _LinkedIdentityHashMap = _LinkedIdentityHashMap$();
4866 const _LinkedCustomHashMap$ = dart.generic(function(K, V) {
4867 class _LinkedCustomHashMap extends _LinkedHashMap$(K, V) {
4868 _LinkedCustomHashMap(equals, hashCode, validKey) {
4869 this[_equals] = equals;
4870 this[_hashCode] = hashCode;
4871 this[_validKey] = validKey != null ? validKey : dart.fn(v => dart.is(v, K), core.bool, [core.Object]);
4872 super._LinkedHashMap();
4873 }
4874 get(key) {
4875 if (!dart.notNull(this[_validKey](key))) return null;
4876 return super[_get](key);
4877 }
4878 set(key, value) {
4879 dart.as(key, K);
4880 dart.as(value, V);
4881 super[_set](key, value);
4882 return value;
4883 }
4884 containsKey(key) {
4885 if (!dart.notNull(this[_validKey](key))) return false;
4886 return super[_containsKey](key);
4887 }
4888 remove(key) {
4889 if (!dart.notNull(this[_validKey](key))) return null;
4890 return super[_remove](key);
4891 }
4892 [_computeHashCode](key) {
4893 return this[_hashCode](dart.as(key, K)) & 0x3ffffff;
4894 }
4895 [_findBucketIndex](bucket, key) {
4896 if (bucket == null) return -1;
4897 let length = bucket.length;
4898 for (let i = 0; i < length; i++) {
4899 let cell = dart.as(bucket[i], LinkedHashMapCell);
4900 if (dart.notNull(this[_equals](dart.as(cell[_key], K), dart.as(key, K) ))) return i;
4901 }
4902 return -1;
4903 }
4904 }
4905 dart.setSignature(_LinkedCustomHashMap, {
4906 constructors: () => ({_LinkedCustomHashMap: [_LinkedCustomHashMap$(K, V), [_Equality$(K), _Hasher$(K), dart.functionType(core.bool, [core.Object])]]}),
4907 methods: () => ({
4908 get: [V, [core.Object]],
4909 set: [dart.void, [K, V]],
4910 remove: [V, [core.Object]]
4911 })
4912 });
4913 dart.defineExtensionMembers(_LinkedCustomHashMap, ['get', 'set', 'containsKe y', 'remove']);
4914 return _LinkedCustomHashMap;
4915 });
4916 let _LinkedCustomHashMap = _LinkedCustomHashMap$();
4917 class LinkedHashMapCell extends core.Object {
4918 LinkedHashMapCell(key, value) {
4919 this[_key] = key;
4920 this[_value] = value;
4921 this[_next] = null;
4922 this[_previous] = null;
4923 }
4924 }
4925 dart.setSignature(LinkedHashMapCell, {
4926 constructors: () => ({LinkedHashMapCell: [LinkedHashMapCell, [dart.dynamic, dart.dynamic]]})
4927 });
4928 const LinkedHashMapKeyIterable$ = dart.generic(function(E) {
4929 class LinkedHashMapKeyIterable extends IterableBase$(E) {
4930 LinkedHashMapKeyIterable(map) {
4931 this[_map] = map;
4932 super.IterableBase();
4933 }
4934 get length() {
4935 return dart.as(dart.dload(this[_map], _length), core.int);
4936 }
4937 get isEmpty() {
4938 return dart.equals(dart.dload(this[_map], _length), 0);
4939 }
4940 get iterator() {
4941 return new (LinkedHashMapKeyIterator$(E))(this[_map], dart.as(dart.dload (this[_map], _modifications), core.int));
4942 }
4943 contains(element) {
4944 return dart.as(dart.dsend(this[_map], 'containsKey', element), core.bool );
4945 }
4946 forEach(f) {
4947 dart.as(f, dart.functionType(dart.void, [E]));
4948 let cell = dart.as(dart.dload(this[_map], _first), LinkedHashMapCell);
4949 let modifications = dart.as(dart.dload(this[_map], _modifications), core .int);
4950 while (cell != null) {
4951 f(dart.as(cell[_key], E));
4952 if (!dart.equals(modifications, dart.dload(this[_map], _modifications) )) {
4953 dart.throw(new core.ConcurrentModificationError(this[_map]));
4954 }
4955 cell = cell[_next];
4956 }
4957 }
4958 }
4959 LinkedHashMapKeyIterable[dart.implements] = () => [_internal.EfficientLength ];
4960 dart.setSignature(LinkedHashMapKeyIterable, {
4961 constructors: () => ({LinkedHashMapKeyIterable: [LinkedHashMapKeyIterable$ (E), [dart.dynamic]]}),
4962 methods: () => ({forEach: [dart.void, [dart.functionType(dart.void, [E])]] })
4963 });
4964 dart.defineExtensionMembers(LinkedHashMapKeyIterable, [
4965 'contains',
4966 'forEach',
4967 'length',
4968 'isEmpty',
4969 'iterator'
4970 ]);
4971 return LinkedHashMapKeyIterable;
4972 });
4973 let LinkedHashMapKeyIterable = LinkedHashMapKeyIterable$();
4974 const _cell = Symbol('_cell');
4975 const LinkedHashMapKeyIterator$ = dart.generic(function(E) {
4976 class LinkedHashMapKeyIterator extends core.Object {
4977 LinkedHashMapKeyIterator(map, modifications) {
4978 this[_map] = map;
4979 this[_modifications] = modifications;
4980 this[_cell] = null;
4981 this[_current] = null;
4982 this[_cell] = dart.as(dart.dload(this[_map], _first), LinkedHashMapCell) ;
4983 }
4984 get current() {
4985 return this[_current];
4986 }
4987 moveNext() {
4988 if (!dart.equals(this[_modifications], dart.dload(this[_map], _modificat ions))) {
4989 dart.throw(new core.ConcurrentModificationError(this[_map]));
4990 } else if (this[_cell] == null) {
4991 this[_current] = null;
4992 return false;
4993 } else {
4994 this[_current] = dart.as(this[_cell][_key], E);
4995 this[_cell] = this[_cell][_next];
4996 return true;
4997 }
4998 }
4999 }
5000 LinkedHashMapKeyIterator[dart.implements] = () => [core.Iterator$(E)];
5001 dart.setSignature(LinkedHashMapKeyIterator, {
5002 constructors: () => ({LinkedHashMapKeyIterator: [LinkedHashMapKeyIterator$ (E), [dart.dynamic, core.int]]}),
5003 methods: () => ({moveNext: [core.bool, []]})
5004 });
5005 return LinkedHashMapKeyIterator;
5006 });
5007 let LinkedHashMapKeyIterator = LinkedHashMapKeyIterator$();
5008 const _elements = Symbol('_elements');
5009 const _computeElements = Symbol('_computeElements');
5010 const _contains = Symbol('_contains');
5011 const _lookup = Symbol('_lookup');
5012 const _HashSet$ = dart.generic(function(E) {
5013 class _HashSet extends _HashSetBase$(E) {
5014 _HashSet() {
5015 this[_length] = 0;
5016 this[_strings] = null;
5017 this[_nums] = null;
5018 this[_rest] = null;
5019 this[_elements] = null;
5020 }
5021 [_newSet]() {
5022 return new (_HashSet$(E))();
5023 }
5024 get iterator() {
5025 return new (HashSetIterator$(E))(this, this[_computeElements]());
5026 }
5027 get length() {
5028 return this[_length];
5029 }
5030 get isEmpty() {
5031 return this[_length] == 0;
5032 }
5033 get isNotEmpty() {
5034 return !dart.notNull(this.isEmpty);
5035 }
5036 contains(object) {
5037 if (dart.notNull(_HashSet$()._isStringElement(object))) {
5038 let strings = this[_strings];
5039 return strings == null ? false : _HashSet$()._hasTableEntry(strings, o bject);
5040 } else if (dart.notNull(_HashSet$()._isNumericElement(object))) {
5041 let nums = this[_nums];
5042 return nums == null ? false : _HashSet$()._hasTableEntry(nums, object) ;
5043 } else {
5044 return this[_contains](object);
5045 }
5046 }
5047 [_contains](object) {
5048 let rest = this[_rest];
5049 if (rest == null) return false;
5050 let bucket = this[_getBucket](rest, object);
5051 return dart.notNull(this[_findBucketIndex](bucket, object)) >= 0;
5052 }
5053 lookup(object) {
5054 if (dart.notNull(_HashSet$()._isStringElement(object)) || dart.notNull(_ HashSet$()._isNumericElement(object))) {
5055 return dart.as(dart.notNull(this.contains(object)) ? object : null, E) ;
5056 }
5057 return this[_lookup](object);
5058 }
5059 [_lookup](object) {
5060 let rest = this[_rest];
5061 if (rest == null) return null;
5062 let bucket = this[_getBucket](rest, object);
5063 let index = this[_findBucketIndex](bucket, object);
5064 if (dart.notNull(index) < 0) return null;
5065 return dart.as(bucket[dartx.get](index), E);
5066 }
5067 add(element) {
5068 dart.as(element, E);
5069 if (dart.notNull(_HashSet$()._isStringElement(element))) {
5070 let strings = this[_strings];
5071 if (strings == null) this[_strings] = strings = _HashSet$()._newHashTa ble();
5072 return this[_addHashTableEntry](strings, element);
5073 } else if (dart.notNull(_HashSet$()._isNumericElement(element))) {
5074 let nums = this[_nums];
5075 if (nums == null) this[_nums] = nums = _HashSet$()._newHashTable();
5076 return this[_addHashTableEntry](nums, element);
5077 } else {
5078 return this[_add](element);
5079 }
5080 }
5081 [_add](element) {
5082 dart.as(element, E);
5083 let rest = this[_rest];
5084 if (rest == null) this[_rest] = rest = _HashSet$()._newHashTable();
5085 let hash = this[_computeHashCode](element);
5086 let bucket = rest[hash];
5087 if (bucket == null) {
5088 _HashSet$()._setTableEntry(rest, hash, [element]);
5089 } else {
5090 let index = this[_findBucketIndex](bucket, element);
5091 if (dart.notNull(index) >= 0) return false;
5092 bucket.push(element);
5093 }
5094 this[_length] = dart.notNull(this[_length]) + 1;
5095 this[_elements] = null;
5096 return true;
5097 }
5098 addAll(objects) {
5099 dart.as(objects, core.Iterable$(E));
5100 for (let each of objects) {
5101 this.add(each);
5102 }
5103 }
5104 remove(object) {
5105 if (dart.notNull(_HashSet$()._isStringElement(object))) {
5106 return this[_removeHashTableEntry](this[_strings], object);
5107 } else if (dart.notNull(_HashSet$()._isNumericElement(object))) {
5108 return this[_removeHashTableEntry](this[_nums], object);
5109 } else {
5110 return this[_remove](object);
5111 }
5112 }
5113 [_remove](object) {
5114 let rest = this[_rest];
5115 if (rest == null) return false;
5116 let bucket = this[_getBucket](rest, object);
5117 let index = this[_findBucketIndex](bucket, object);
5118 if (dart.notNull(index) < 0) return false;
5119 this[_length] = dart.notNull(this[_length]) - 1;
5120 this[_elements] = null;
5121 bucket.splice(index, 1);
5122 return true;
5123 }
5124 clear() {
5125 if (dart.notNull(this[_length]) > 0) {
5126 this[_strings] = this[_nums] = this[_rest] = this[_elements] = null;
5127 this[_length] = 0;
5128 }
5129 }
5130 [_computeElements]() {
5131 if (this[_elements] != null) return this[_elements];
5132 let result = core.List.new(this[_length]);
5133 let index = 0;
5134 let strings = this[_strings];
5135 if (strings != null) {
5136 let names = Object.getOwnPropertyNames(strings);
5137 let entries = names.length;
5138 for (let i = 0; i < entries; i++) {
5139 let element = names[i];
5140 result[index] = element;
5141 index++;
5142 }
5143 }
5144 let nums = this[_nums];
5145 if (nums != null) {
5146 let names = Object.getOwnPropertyNames(nums);
5147 let entries = names.length;
5148 for (let i = 0; i < entries; i++) {
5149 let element = +names[i];
5150 result[index] = element;
5151 index++;
5152 }
5153 }
5154 let rest = this[_rest];
5155 if (rest != null) {
5156 let names = Object.getOwnPropertyNames(rest);
5157 let entries = names.length;
5158 for (let i = 0; i < entries; i++) {
5159 let entry = names[i];
5160 let bucket = rest[entry];
5161 let length = bucket.length;
5162 for (let i = 0; i < length; i++) {
5163 result[index] = bucket[i];
5164 index++;
5165 }
5166 }
5167 }
5168 dart.assert(index == this[_length]);
5169 return this[_elements] = result;
5170 }
5171 [_addHashTableEntry](table, element) {
5172 dart.as(element, E);
5173 if (dart.notNull(_HashSet$()._hasTableEntry(table, element))) return fal se;
5174 _HashSet$()._setTableEntry(table, element, 0);
5175 this[_length] = dart.notNull(this[_length]) + 1;
5176 this[_elements] = null;
5177 return true;
5178 }
5179 [_removeHashTableEntry](table, element) {
5180 if (table != null && dart.notNull(_HashSet$()._hasTableEntry(table, elem ent))) {
5181 _HashSet$()._deleteTableEntry(table, element);
5182 this[_length] = dart.notNull(this[_length]) - 1;
5183 this[_elements] = null;
5184 return true;
5185 } else {
5186 return false;
5187 }
5188 }
5189 static _isStringElement(element) {
5190 return typeof element == 'string' && element != '__proto__';
5191 }
5192 static _isNumericElement(element) {
5193 return typeof element == 'number' && (element & 0x3ffffff) === element;
5194 }
5195 [_computeHashCode](element) {
5196 return dart.hashCode(element) & 0x3ffffff;
5197 }
5198 static _hasTableEntry(table, key) {
5199 let entry = table[key];
5200 return entry != null;
5201 }
5202 static _setTableEntry(table, key, value) {
5203 dart.assert(value != null);
5204 table[key] = value;
5205 }
5206 static _deleteTableEntry(table, key) {
5207 delete table[key];
5208 }
5209 [_getBucket](table, element) {
5210 let hash = this[_computeHashCode](element);
5211 return dart.as(table[hash], core.List);
5212 }
5213 [_findBucketIndex](bucket, element) {
5214 if (bucket == null) return -1;
5215 let length = bucket.length;
5216 for (let i = 0; i < length; i++) {
5217 if (dart.equals(bucket[i], element)) return i;
5218 }
5219 return -1;
5220 }
5221 static _newHashTable() {
5222 let table = Object.create(null);
5223 let temporaryKey = '<non-identifier-key>';
5224 _HashSet$()._setTableEntry(table, temporaryKey, table);
5225 _HashSet$()._deleteTableEntry(table, temporaryKey);
5226 return table;
5227 }
5228 }
5229 _HashSet[dart.implements] = () => [HashSet$(E)];
5230 dart.setSignature(_HashSet, {
5231 constructors: () => ({_HashSet: [_HashSet$(E), []]}),
5232 methods: () => ({
5233 [_newSet]: [core.Set$(E), []],
5234 contains: [core.bool, [core.Object]],
5235 [_contains]: [core.bool, [core.Object]],
5236 lookup: [E, [core.Object]],
5237 [_lookup]: [E, [core.Object]],
5238 add: [core.bool, [E]],
5239 [_add]: [core.bool, [E]],
5240 addAll: [dart.void, [core.Iterable$(E)]],
5241 remove: [core.bool, [core.Object]],
5242 [_remove]: [core.bool, [core.Object]],
5243 [_computeElements]: [core.List, []],
5244 [_addHashTableEntry]: [core.bool, [dart.dynamic, E]],
5245 [_removeHashTableEntry]: [core.bool, [dart.dynamic, core.Object]],
5246 [_computeHashCode]: [core.int, [dart.dynamic]],
5247 [_getBucket]: [core.List, [dart.dynamic, dart.dynamic]],
5248 [_findBucketIndex]: [core.int, [dart.dynamic, dart.dynamic]]
5249 }),
5250 statics: () => ({
5251 _isStringElement: [core.bool, [dart.dynamic]],
5252 _isNumericElement: [core.bool, [dart.dynamic]],
5253 _hasTableEntry: [core.bool, [dart.dynamic, dart.dynamic]],
5254 _setTableEntry: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]],
5255 _deleteTableEntry: [dart.void, [dart.dynamic, dart.dynamic]],
5256 _newHashTable: [dart.dynamic, []]
5257 }),
5258 names: ['_isStringElement', '_isNumericElement', '_hasTableEntry', '_setTa bleEntry', '_deleteTableEntry', '_newHashTable']
5259 });
5260 dart.defineExtensionMembers(_HashSet, [
5261 'contains',
5262 'iterator',
5263 'length',
5264 'isEmpty',
5265 'isNotEmpty'
5266 ]);
5267 return _HashSet;
5268 });
5269 let _HashSet = _HashSet$();
5270 const _IdentityHashSet$ = dart.generic(function(E) {
5271 class _IdentityHashSet extends _HashSet$(E) {
5272 _IdentityHashSet() {
5273 super._HashSet();
5274 }
5275 [_newSet]() {
5276 return new (_IdentityHashSet$(E))();
5277 }
5278 [_computeHashCode](key) {
5279 return core.identityHashCode(key) & 0x3ffffff;
5280 }
5281 [_findBucketIndex](bucket, element) {
5282 if (bucket == null) return -1;
5283 let length = bucket.length;
5284 for (let i = 0; i < length; i++) {
5285 if (core.identical(bucket[i], element)) return i;
5286 }
5287 return -1;
5288 }
5289 }
5290 dart.setSignature(_IdentityHashSet, {
5291 methods: () => ({[_newSet]: [core.Set$(E), []]})
5292 });
5293 return _IdentityHashSet;
5294 });
5295 let _IdentityHashSet = _IdentityHashSet$();
5296 const _equality = Symbol('_equality');
5297 const _hasher = Symbol('_hasher');
5298 const _CustomHashSet$ = dart.generic(function(E) {
5299 class _CustomHashSet extends _HashSet$(E) {
5300 _CustomHashSet(equality, hasher, validKey) {
5301 this[_equality] = equality;
5302 this[_hasher] = hasher;
5303 this[_validKey] = validKey != null ? validKey : dart.fn(x => dart.is(x, E), core.bool, [core.Object]);
5304 super._HashSet();
5305 }
5306 [_newSet]() {
5307 return new (_CustomHashSet$(E))(this[_equality], this[_hasher], this[_va lidKey]);
5308 }
5309 [_findBucketIndex](bucket, element) {
5310 if (bucket == null) return -1;
5311 let length = bucket.length;
5312 for (let i = 0; i < length; i++) {
5313 if (dart.notNull(this[_equality](dart.as(bucket[i], E), dart.as(elemen t, E)))) return i;
5314 }
5315 return -1;
5316 }
5317 [_computeHashCode](element) {
5318 return this[_hasher](dart.as(element, E)) & 0x3ffffff;
5319 }
5320 add(object) {
5321 dart.as(object, E);
5322 return super[_add](object);
5323 }
5324 contains(object) {
5325 if (!dart.notNull(this[_validKey](object))) return false;
5326 return super[_contains](object);
5327 }
5328 lookup(object) {
5329 if (!dart.notNull(this[_validKey](object))) return null;
5330 return super[_lookup](object);
5331 }
5332 remove(object) {
5333 if (!dart.notNull(this[_validKey](object))) return false;
5334 return super[_remove](object);
5335 }
5336 }
5337 dart.setSignature(_CustomHashSet, {
5338 constructors: () => ({_CustomHashSet: [_CustomHashSet$(E), [_Equality$(E), _Hasher$(E), dart.functionType(core.bool, [core.Object])]]}),
5339 methods: () => ({
5340 [_newSet]: [core.Set$(E), []],
5341 add: [core.bool, [E]],
5342 lookup: [E, [core.Object]]
5343 })
5344 });
5345 dart.defineExtensionMembers(_CustomHashSet, ['contains']);
5346 return _CustomHashSet;
5347 });
5348 let _CustomHashSet = _CustomHashSet$();
5349 const HashSetIterator$ = dart.generic(function(E) {
5350 class HashSetIterator extends core.Object {
5351 HashSetIterator(set, elements) {
5352 this[_set] = set;
5353 this[_elements] = elements;
5354 this[_offset] = 0;
5355 this[_current] = null;
5356 }
5357 get current() {
5358 return this[_current];
5359 }
5360 moveNext() {
5361 let elements = this[_elements];
5362 let offset = this[_offset];
5363 if (elements !== dart.dload(this[_set], _elements)) {
5364 dart.throw(new core.ConcurrentModificationError(this[_set]));
5365 } else if (dart.notNull(offset) >= elements.length) {
5366 this[_current] = null;
5367 return false;
5368 } else {
5369 this[_current] = dart.as(elements[offset], E);
5370 this[_offset] = dart.notNull(offset) + 1;
5371 return true;
5372 }
5373 }
5374 }
5375 HashSetIterator[dart.implements] = () => [core.Iterator$(E)];
5376 dart.setSignature(HashSetIterator, {
5377 constructors: () => ({HashSetIterator: [HashSetIterator$(E), [dart.dynamic , core.List]]}),
5378 methods: () => ({moveNext: [core.bool, []]})
5379 });
5380 return HashSetIterator;
5381 });
5382 let HashSetIterator = HashSetIterator$();
5383 const _unsupported = Symbol('_unsupported');
5384 const _LinkedHashSet$ = dart.generic(function(E) {
5385 class _LinkedHashSet extends _HashSetBase$(E) {
5386 _LinkedHashSet() {
5387 this[_length] = 0;
5388 this[_strings] = null;
5389 this[_nums] = null;
5390 this[_rest] = null;
5391 this[_first] = null;
5392 this[_last] = null;
5393 this[_modifications] = 0;
5394 }
5395 [_newSet]() {
5396 return new (_LinkedHashSet$(E))();
5397 }
5398 [_unsupported](operation) {
5399 dart.throw(`LinkedHashSet: unsupported ${operation}`);
5400 }
5401 get iterator() {
5402 return new (LinkedHashSetIterator$(E))(this, this[_modifications]);
5403 }
5404 get length() {
5405 return this[_length];
5406 }
5407 get isEmpty() {
5408 return this[_length] == 0;
5409 }
5410 get isNotEmpty() {
5411 return !dart.notNull(this.isEmpty);
5412 }
5413 contains(object) {
5414 if (dart.notNull(_LinkedHashSet$()._isStringElement(object))) {
5415 let strings = this[_strings];
5416 if (strings == null) return false;
5417 let cell = dart.as(_LinkedHashSet$()._getTableEntry(strings, object), LinkedHashSetCell);
5418 return cell != null;
5419 } else if (dart.notNull(_LinkedHashSet$()._isNumericElement(object))) {
5420 let nums = this[_nums];
5421 if (nums == null) return false;
5422 let cell = dart.as(_LinkedHashSet$()._getTableEntry(nums, object), Lin kedHashSetCell);
5423 return cell != null;
5424 } else {
5425 return this[_contains](object);
5426 }
5427 }
5428 [_contains](object) {
5429 let rest = this[_rest];
5430 if (rest == null) return false;
5431 let bucket = this[_getBucket](rest, object);
5432 return dart.notNull(this[_findBucketIndex](bucket, object)) >= 0;
5433 }
5434 lookup(object) {
5435 if (dart.notNull(_LinkedHashSet$()._isStringElement(object)) || dart.not Null(_LinkedHashSet$()._isNumericElement(object))) {
5436 return dart.as(dart.notNull(this.contains(object)) ? object : null, E) ;
5437 } else {
5438 return this[_lookup](object);
5439 }
5440 }
5441 [_lookup](object) {
5442 let rest = this[_rest];
5443 if (rest == null) return null;
5444 let bucket = this[_getBucket](rest, object);
5445 let index = this[_findBucketIndex](bucket, object);
5446 if (dart.notNull(index) < 0) return null;
5447 return dart.as(dart.dload(bucket[dartx.get](index), _element), E);
5448 }
5449 forEach(action) {
5450 dart.as(action, dart.functionType(dart.void, [E]));
5451 let cell = this[_first];
5452 let modifications = this[_modifications];
5453 while (cell != null) {
5454 action(dart.as(cell[_element], E));
5455 if (modifications != this[_modifications]) {
5456 dart.throw(new core.ConcurrentModificationError(this));
5457 }
5458 cell = cell[_next];
5459 }
5460 }
5461 get first() {
5462 if (this[_first] == null) dart.throw(new core.StateError("No elements")) ;
5463 return dart.as(this[_first][_element], E);
5464 }
5465 get last() {
5466 if (this[_last] == null) dart.throw(new core.StateError("No elements"));
5467 return dart.as(this[_last][_element], E);
5468 }
5469 add(element) {
5470 dart.as(element, E);
5471 if (dart.notNull(_LinkedHashSet$()._isStringElement(element))) {
5472 let strings = this[_strings];
5473 if (strings == null) this[_strings] = strings = _LinkedHashSet$()._new HashTable();
5474 return this[_addHashTableEntry](strings, element);
5475 } else if (dart.notNull(_LinkedHashSet$()._isNumericElement(element))) {
5476 let nums = this[_nums];
5477 if (nums == null) this[_nums] = nums = _LinkedHashSet$()._newHashTable ();
5478 return this[_addHashTableEntry](nums, element);
5479 } else {
5480 return this[_add](element);
5481 }
5482 }
5483 [_add](element) {
5484 dart.as(element, E);
5485 let rest = this[_rest];
5486 if (rest == null) this[_rest] = rest = _LinkedHashSet$()._newHashTable() ;
5487 let hash = this[_computeHashCode](element);
5488 let bucket = rest[hash];
5489 if (bucket == null) {
5490 let cell = this[_newLinkedCell](element);
5491 _LinkedHashSet$()._setTableEntry(rest, hash, [cell]);
5492 } else {
5493 let index = this[_findBucketIndex](bucket, element);
5494 if (dart.notNull(index) >= 0) return false;
5495 let cell = this[_newLinkedCell](element);
5496 bucket.push(cell);
5497 }
5498 return true;
5499 }
5500 remove(object) {
5501 if (dart.notNull(_LinkedHashSet$()._isStringElement(object))) {
5502 return this[_removeHashTableEntry](this[_strings], object);
5503 } else if (dart.notNull(_LinkedHashSet$()._isNumericElement(object))) {
5504 return this[_removeHashTableEntry](this[_nums], object);
5505 } else {
5506 return this[_remove](object);
5507 }
5508 }
5509 [_remove](object) {
5510 let rest = this[_rest];
5511 if (rest == null) return false;
5512 let bucket = this[_getBucket](rest, object);
5513 let index = this[_findBucketIndex](bucket, object);
5514 if (dart.notNull(index) < 0) return false;
5515 let cell = dart.as(bucket.splice(index, 1)[0], LinkedHashSetCell);
5516 this[_unlinkCell](cell);
5517 return true;
5518 }
5519 removeWhere(test) {
5520 dart.as(test, dart.functionType(core.bool, [E]));
5521 this[_filterWhere](test, true);
5522 }
5523 retainWhere(test) {
5524 dart.as(test, dart.functionType(core.bool, [E]));
5525 this[_filterWhere](test, false);
5526 }
5527 [_filterWhere](test, removeMatching) {
5528 dart.as(test, dart.functionType(core.bool, [E]));
5529 let cell = this[_first];
5530 while (cell != null) {
5531 let element = dart.as(cell[_element], E);
5532 let next = cell[_next];
5533 let modifications = this[_modifications];
5534 let shouldRemove = removeMatching == test(element);
5535 if (modifications != this[_modifications]) {
5536 dart.throw(new core.ConcurrentModificationError(this));
5537 }
5538 if (shouldRemove) this.remove(element);
5539 cell = next;
5540 }
5541 }
5542 clear() {
5543 if (dart.notNull(this[_length]) > 0) {
5544 this[_strings] = this[_nums] = this[_rest] = this[_first] = this[_last ] = null;
5545 this[_length] = 0;
5546 this[_modified]();
5547 }
5548 }
5549 [_addHashTableEntry](table, element) {
5550 dart.as(element, E);
5551 let cell = dart.as(_LinkedHashSet$()._getTableEntry(table, element), Lin kedHashSetCell);
5552 if (cell != null) return false;
5553 _LinkedHashSet$()._setTableEntry(table, element, this[_newLinkedCell](el ement));
5554 return true;
5555 }
5556 [_removeHashTableEntry](table, element) {
5557 if (table == null) return false;
5558 let cell = dart.as(_LinkedHashSet$()._getTableEntry(table, element), Lin kedHashSetCell);
5559 if (cell == null) return false;
5560 this[_unlinkCell](cell);
5561 _LinkedHashSet$()._deleteTableEntry(table, element);
5562 return true;
5563 }
5564 [_modified]() {
5565 this[_modifications] = dart.notNull(this[_modifications]) + 1 & 67108863 ;
5566 }
5567 [_newLinkedCell](element) {
5568 dart.as(element, E);
5569 let cell = new LinkedHashSetCell(element);
5570 if (this[_first] == null) {
5571 this[_first] = this[_last] = cell;
5572 } else {
5573 let last = this[_last];
5574 cell[_previous] = last;
5575 this[_last] = last[_next] = cell;
5576 }
5577 this[_length] = dart.notNull(this[_length]) + 1;
5578 this[_modified]();
5579 return cell;
5580 }
5581 [_unlinkCell](cell) {
5582 let previous = cell[_previous];
5583 let next = cell[_next];
5584 if (previous == null) {
5585 dart.assert(dart.equals(cell, this[_first]));
5586 this[_first] = next;
5587 } else {
5588 previous[_next] = next;
5589 }
5590 if (next == null) {
5591 dart.assert(dart.equals(cell, this[_last]));
5592 this[_last] = previous;
5593 } else {
5594 next[_previous] = previous;
5595 }
5596 this[_length] = dart.notNull(this[_length]) - 1;
5597 this[_modified]();
5598 }
5599 static _isStringElement(element) {
5600 return typeof element == 'string' && element != '__proto__';
5601 }
5602 static _isNumericElement(element) {
5603 return typeof element == 'number' && (element & 0x3ffffff) === element;
5604 }
5605 [_computeHashCode](element) {
5606 return dart.hashCode(element) & 0x3ffffff;
5607 }
5608 static _getTableEntry(table, key) {
5609 return table[key];
5610 }
5611 static _setTableEntry(table, key, value) {
5612 dart.assert(value != null);
5613 table[key] = value;
5614 }
5615 static _deleteTableEntry(table, key) {
5616 delete table[key];
5617 }
5618 [_getBucket](table, element) {
5619 let hash = this[_computeHashCode](element);
5620 return dart.as(table[hash], core.List);
5621 }
5622 [_findBucketIndex](bucket, element) {
5623 if (bucket == null) return -1;
5624 let length = bucket.length;
5625 for (let i = 0; i < length; i++) {
5626 let cell = dart.as(bucket[i], LinkedHashSetCell);
5627 if (dart.equals(cell[_element], element)) return i;
5628 }
5629 return -1;
5630 }
5631 static _newHashTable() {
5632 let table = Object.create(null);
5633 let temporaryKey = '<non-identifier-key>';
5634 _LinkedHashSet$()._setTableEntry(table, temporaryKey, table);
5635 _LinkedHashSet$()._deleteTableEntry(table, temporaryKey);
5636 return table;
5637 }
5638 }
5639 _LinkedHashSet[dart.implements] = () => [LinkedHashSet$(E)];
5640 dart.setSignature(_LinkedHashSet, {
5641 constructors: () => ({_LinkedHashSet: [_LinkedHashSet$(E), []]}),
5642 methods: () => ({
5643 [_newSet]: [core.Set$(E), []],
5644 [_unsupported]: [dart.void, [core.String]],
5645 contains: [core.bool, [core.Object]],
5646 [_contains]: [core.bool, [core.Object]],
5647 lookup: [E, [core.Object]],
5648 [_lookup]: [E, [core.Object]],
5649 forEach: [dart.void, [dart.functionType(dart.void, [E])]],
5650 add: [core.bool, [E]],
5651 [_add]: [core.bool, [E]],
5652 remove: [core.bool, [core.Object]],
5653 [_remove]: [core.bool, [core.Object]],
5654 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]],
5655 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]],
5656 [_filterWhere]: [dart.void, [dart.functionType(core.bool, [E]), core.boo l]],
5657 [_addHashTableEntry]: [core.bool, [dart.dynamic, E]],
5658 [_removeHashTableEntry]: [core.bool, [dart.dynamic, core.Object]],
5659 [_modified]: [dart.void, []],
5660 [_newLinkedCell]: [LinkedHashSetCell, [E]],
5661 [_unlinkCell]: [dart.void, [LinkedHashSetCell]],
5662 [_computeHashCode]: [core.int, [dart.dynamic]],
5663 [_getBucket]: [core.List, [dart.dynamic, dart.dynamic]],
5664 [_findBucketIndex]: [core.int, [dart.dynamic, dart.dynamic]]
5665 }),
5666 statics: () => ({
5667 _isStringElement: [core.bool, [dart.dynamic]],
5668 _isNumericElement: [core.bool, [dart.dynamic]],
5669 _getTableEntry: [dart.dynamic, [dart.dynamic, dart.dynamic]],
5670 _setTableEntry: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]],
5671 _deleteTableEntry: [dart.void, [dart.dynamic, dart.dynamic]],
5672 _newHashTable: [dart.dynamic, []]
5673 }),
5674 names: ['_isStringElement', '_isNumericElement', '_getTableEntry', '_setTa bleEntry', '_deleteTableEntry', '_newHashTable']
5675 });
5676 dart.defineExtensionMembers(_LinkedHashSet, [
5677 'contains',
5678 'forEach',
5679 'iterator',
5680 'length',
5681 'isEmpty',
5682 'isNotEmpty',
5683 'first',
5684 'last'
5685 ]);
5686 return _LinkedHashSet;
5687 });
5688 let _LinkedHashSet = _LinkedHashSet$();
5689 const _LinkedIdentityHashSet$ = dart.generic(function(E) {
5690 class _LinkedIdentityHashSet extends _LinkedHashSet$(E) {
5691 _LinkedIdentityHashSet() {
5692 super._LinkedHashSet();
5693 }
5694 [_newSet]() {
5695 return new (_LinkedIdentityHashSet$(E))();
5696 }
5697 [_computeHashCode](key) {
5698 return core.identityHashCode(key) & 0x3ffffff;
5699 }
5700 [_findBucketIndex](bucket, element) {
5701 if (bucket == null) return -1;
5702 let length = bucket.length;
5703 for (let i = 0; i < length; i++) {
5704 let cell = dart.as(bucket[i], LinkedHashSetCell);
5705 if (core.identical(cell[_element], element)) return i;
5706 }
5707 return -1;
5708 }
5709 }
5710 dart.setSignature(_LinkedIdentityHashSet, {
5711 methods: () => ({[_newSet]: [core.Set$(E), []]})
5712 });
5713 return _LinkedIdentityHashSet;
5714 });
5715 let _LinkedIdentityHashSet = _LinkedIdentityHashSet$();
5716 const _LinkedCustomHashSet$ = dart.generic(function(E) {
5717 class _LinkedCustomHashSet extends _LinkedHashSet$(E) {
5718 _LinkedCustomHashSet(equality, hasher, validKey) {
5719 this[_equality] = equality;
5720 this[_hasher] = hasher;
5721 this[_validKey] = validKey != null ? validKey : dart.fn(x => dart.is(x, E), core.bool, [core.Object]);
5722 super._LinkedHashSet();
5723 }
5724 [_newSet]() {
5725 return new (_LinkedCustomHashSet$(E))(this[_equality], this[_hasher], th is[_validKey]);
5726 }
5727 [_findBucketIndex](bucket, element) {
5728 if (bucket == null) return -1;
5729 let length = bucket.length;
5730 for (let i = 0; i < length; i++) {
5731 let cell = dart.as(bucket[i], LinkedHashSetCell);
5732 if (dart.notNull(this[_equality](dart.as(cell[_element], E), dart.as(e lement, E)))) return i;
5733 }
5734 return -1;
5735 }
5736 [_computeHashCode](element) {
5737 return this[_hasher](dart.as(element, E)) & 0x3ffffff;
5738 }
5739 add(element) {
5740 dart.as(element, E);
5741 return super[_add](element);
5742 }
5743 contains(object) {
5744 if (!dart.notNull(this[_validKey](object))) return false;
5745 return super[_contains](object);
5746 }
5747 lookup(object) {
5748 if (!dart.notNull(this[_validKey](object))) return null;
5749 return super[_lookup](object);
5750 }
5751 remove(object) {
5752 if (!dart.notNull(this[_validKey](object))) return false;
5753 return super[_remove](object);
5754 }
5755 containsAll(elements) {
5756 for (let element of elements) {
5757 if (!dart.notNull(this[_validKey](element)) || !dart.notNull(this.cont ains(element))) return false;
5758 }
5759 return true;
5760 }
5761 removeAll(elements) {
5762 for (let element of elements) {
5763 if (dart.notNull(this[_validKey](element))) {
5764 super[_remove](element);
5765 }
5766 }
5767 }
5768 }
5769 dart.setSignature(_LinkedCustomHashSet, {
5770 constructors: () => ({_LinkedCustomHashSet: [_LinkedCustomHashSet$(E), [_E quality$(E), _Hasher$(E), dart.functionType(core.bool, [core.Object])]]}),
5771 methods: () => ({
5772 [_newSet]: [core.Set$(E), []],
5773 add: [core.bool, [E]],
5774 lookup: [E, [core.Object]]
5775 })
5776 });
5777 dart.defineExtensionMembers(_LinkedCustomHashSet, ['contains']);
5778 return _LinkedCustomHashSet;
5779 });
5780 let _LinkedCustomHashSet = _LinkedCustomHashSet$();
5781 class LinkedHashSetCell extends core.Object {
5782 LinkedHashSetCell(element) {
5783 this[_element] = element;
5784 this[_next] = null;
5785 this[_previous] = null;
5786 }
5787 }
5788 dart.setSignature(LinkedHashSetCell, {
5789 constructors: () => ({LinkedHashSetCell: [LinkedHashSetCell, [dart.dynamic]] })
5790 });
5791 const LinkedHashSetIterator$ = dart.generic(function(E) {
5792 class LinkedHashSetIterator extends core.Object {
5793 LinkedHashSetIterator(set, modifications) {
5794 this[_set] = set;
5795 this[_modifications] = modifications;
5796 this[_cell] = null;
5797 this[_current] = null;
5798 this[_cell] = dart.as(dart.dload(this[_set], _first), LinkedHashSetCell) ;
5799 }
5800 get current() {
5801 return this[_current];
5802 }
5803 moveNext() {
5804 if (!dart.equals(this[_modifications], dart.dload(this[_set], _modificat ions))) {
5805 dart.throw(new core.ConcurrentModificationError(this[_set]));
5806 } else if (this[_cell] == null) {
5807 this[_current] = null;
5808 return false;
5809 } else {
5810 this[_current] = dart.as(this[_cell][_element], E);
5811 this[_cell] = this[_cell][_next];
5812 return true;
5813 }
5814 }
5815 }
5816 LinkedHashSetIterator[dart.implements] = () => [core.Iterator$(E)];
5817 dart.setSignature(LinkedHashSetIterator, {
5818 constructors: () => ({LinkedHashSetIterator: [LinkedHashSetIterator$(E), [ dart.dynamic, core.int]]}),
5819 methods: () => ({moveNext: [core.bool, []]})
5820 });
5821 return LinkedHashSetIterator;
5822 });
5823 let LinkedHashSetIterator = LinkedHashSetIterator$();
5824 // Exports:
5825 exports.UnmodifiableListView$ = UnmodifiableListView$;
5826 exports.HashMap$ = HashMap$;
5827 exports.HashMap = HashMap;
5828 exports.SetMixin$ = SetMixin$;
5829 exports.SetMixin = SetMixin;
5830 exports.SetBase$ = SetBase$;
5831 exports.SetBase = SetBase;
5832 exports.HashSet$ = HashSet$;
5833 exports.HashSet = HashSet;
5834 exports.IterableMixin$ = IterableMixin$;
5835 exports.IterableMixin = IterableMixin;
5836 exports.IterableBase$ = IterableBase$;
5837 exports.IterableBase = IterableBase;
5838 exports.HasNextIterator$ = HasNextIterator$;
5839 exports.HasNextIterator = HasNextIterator;
5840 exports.LinkedHashMap$ = LinkedHashMap$;
5841 exports.LinkedHashMap = LinkedHashMap;
5842 exports.LinkedHashSet$ = LinkedHashSet$;
5843 exports.LinkedHashSet = LinkedHashSet;
5844 exports.LinkedList$ = LinkedList$;
5845 exports.LinkedList = LinkedList;
5846 exports.LinkedListEntry$ = LinkedListEntry$;
5847 exports.LinkedListEntry = LinkedListEntry;
5848 exports.ListMixin$ = ListMixin$;
5849 exports.ListMixin = ListMixin;
5850 exports.ListBase$ = ListBase$;
5851 exports.ListBase = ListBase;
5852 exports.MapMixin$ = MapMixin$;
5853 exports.MapMixin = MapMixin;
5854 exports.MapBase$ = MapBase$;
5855 exports.MapBase = MapBase;
5856 exports.UnmodifiableMapBase$ = UnmodifiableMapBase$;
5857 exports.UnmodifiableMapBase = UnmodifiableMapBase;
5858 exports.MapView$ = MapView$;
5859 exports.MapView = MapView;
5860 exports.UnmodifiableMapView$ = UnmodifiableMapView$;
5861 exports.UnmodifiableMapView = UnmodifiableMapView;
5862 exports.Maps = Maps;
5863 exports.Queue$ = Queue$;
5864 exports.Queue = Queue;
5865 exports.DoubleLinkedQueueEntry$ = DoubleLinkedQueueEntry$;
5866 exports.DoubleLinkedQueueEntry = DoubleLinkedQueueEntry;
5867 exports.DoubleLinkedQueue$ = DoubleLinkedQueue$;
5868 exports.DoubleLinkedQueue = DoubleLinkedQueue;
5869 exports.ListQueue$ = ListQueue$;
5870 exports.ListQueue = ListQueue;
5871 exports.SplayTreeMap$ = SplayTreeMap$;
5872 exports.SplayTreeMap = SplayTreeMap;
5873 exports.SplayTreeSet$ = SplayTreeSet$;
5874 exports.SplayTreeSet = SplayTreeSet;
5875 exports.HashMapKeyIterable$ = HashMapKeyIterable$;
5876 exports.HashMapKeyIterable = HashMapKeyIterable;
5877 exports.HashMapKeyIterator$ = HashMapKeyIterator$;
5878 exports.HashMapKeyIterator = HashMapKeyIterator;
5879 exports.LinkedHashMapCell = LinkedHashMapCell;
5880 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
5881 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
5882 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
5883 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
5884 exports.HashSetIterator$ = HashSetIterator$;
5885 exports.HashSetIterator = HashSetIterator;
5886 exports.LinkedHashSetCell = LinkedHashSetCell;
5887 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
5888 exports.LinkedHashSetIterator = LinkedHashSetIterator;
5889 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698