OLD | NEW |
1 dart_library.library('dart/collection', null, /* Imports */[ | 1 dart_library.library('dart/collection', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core' | 3 'dart/core' |
4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
5 'dart/_internal', | 5 'dart/_internal', |
6 'dart/_js_helper', | 6 'dart/_js_helper', |
7 'dart/math' | 7 'dart/math' |
8 ], function(exports, dart, core, _internal, _js_helper, math) { | 8 ], function(exports, dart, core, _internal, _js_helper, math) { |
9 'use strict'; | 9 'use strict'; |
10 let dartx = dart.dartx; | 10 let dartx = dart.dartx; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (dart.notNull(other.contains(element))) result.remove(element); | 184 if (dart.notNull(other.contains(element))) result.remove(element); |
185 } | 185 } |
186 return result; | 186 return result; |
187 } | 187 } |
188 toList(opts) { | 188 toList(opts) { |
189 let growable = opts && 'growable' in opts ? opts.growable : true; | 189 let growable = opts && 'growable' in opts ? opts.growable : true; |
190 let result = dart.notNull(growable) ? (() => { | 190 let result = dart.notNull(growable) ? (() => { |
191 let _ = core.List$(E).new(); | 191 let _ = core.List$(E).new(); |
192 _[dartx.length] = this.length; | 192 _[dartx.length] = this.length; |
193 return _; | 193 return _; |
194 }).bind(this)() : core.List$(E).new(this.length); | 194 })() : core.List$(E).new(this.length); |
195 let i = 0; | 195 let i = 0; |
196 for (let element of this) | 196 for (let element of this) |
197 result[dartx.set](i++, element); | 197 result[dartx.set](i++, element); |
198 return result; | 198 return result; |
199 } | 199 } |
200 map(f) { | 200 map(f) { |
201 dart.as(f, dart.functionType(dart.dynamic, [E])); | 201 dart.as(f, dart.functionType(dart.dynamic, [E])); |
202 return new (_internal.EfficientLengthMappedIterable$(E, dart.dynamic))(t
his, f); | 202 return new (_internal.EfficientLengthMappedIterable$(E, dart.dynamic))(t
his, f); |
203 } | 203 } |
204 get single() { | 204 get single() { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 for (let element of this) { | 449 for (let element of this) { |
450 if (dart.notNull(other.contains(element))) result.add(element); | 450 if (dart.notNull(other.contains(element))) result.add(element); |
451 } | 451 } |
452 return result; | 452 return result; |
453 } | 453 } |
454 toSet() { | 454 toSet() { |
455 return (() => { | 455 return (() => { |
456 let _ = this[_newSet](); | 456 let _ = this[_newSet](); |
457 _.addAll(this); | 457 _.addAll(this); |
458 return _; | 458 return _; |
459 }).bind(this)(); | 459 })(); |
460 } | 460 } |
461 } | 461 } |
462 dart.setSignature(_HashSetBase, { | 462 dart.setSignature(_HashSetBase, { |
463 methods: () => ({ | 463 methods: () => ({ |
464 difference: [core.Set$(E), [core.Set$(core.Object)]], | 464 difference: [core.Set$(E), [core.Set$(core.Object)]], |
465 intersection: [core.Set$(E), [core.Set$(core.Object)]], | 465 intersection: [core.Set$(E), [core.Set$(core.Object)]], |
466 toSet: [core.Set$(E), []] | 466 toSet: [core.Set$(E), []] |
467 }) | 467 }) |
468 }); | 468 }); |
469 dart.defineExtensionMembers(_HashSetBase, ['toSet']); | 469 dart.defineExtensionMembers(_HashSetBase, ['toSet']); |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 addFirst(entry) { | 1356 addFirst(entry) { |
1357 dart.as(entry, E); | 1357 dart.as(entry, E); |
1358 this[_insertAfter](this, entry); | 1358 this[_insertAfter](this, entry); |
1359 } | 1359 } |
1360 add(entry) { | 1360 add(entry) { |
1361 dart.as(entry, E); | 1361 dart.as(entry, E); |
1362 this[_insertAfter](this[_previous], entry); | 1362 this[_insertAfter](this[_previous], entry); |
1363 } | 1363 } |
1364 addAll(entries) { | 1364 addAll(entries) { |
1365 dart.as(entries, core.Iterable$(E)); | 1365 dart.as(entries, core.Iterable$(E)); |
1366 entries[dartx.forEach](dart.fn((entry => this[_insertAfter](this[_previo
us], entry)).bind(this), dart.void, [E])); | 1366 entries[dartx.forEach](dart.fn(entry => this[_insertAfter](this[_previou
s], entry), dart.void, [E])); |
1367 } | 1367 } |
1368 remove(entry) { | 1368 remove(entry) { |
1369 dart.as(entry, E); | 1369 dart.as(entry, E); |
1370 if (!dart.equals(entry[_list], this)) return false; | 1370 if (!dart.equals(entry[_list], this)) return false; |
1371 this[_unlink](entry); | 1371 this[_unlink](entry); |
1372 return true; | 1372 return true; |
1373 } | 1373 } |
1374 get iterator() { | 1374 get iterator() { |
1375 return new (_LinkedListIterator$(E))(this); | 1375 return new (_LinkedListIterator$(E))(this); |
1376 } | 1376 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 result.add(this.get(i)); | 1756 result.add(this.get(i)); |
1757 } | 1757 } |
1758 return result; | 1758 return result; |
1759 } | 1759 } |
1760 add(element) { | 1760 add(element) { |
1761 dart.as(element, E); | 1761 dart.as(element, E); |
1762 this.set((() => { | 1762 this.set((() => { |
1763 let x = this.length; | 1763 let x = this.length; |
1764 this.length = dart.notNull(x) + 1; | 1764 this.length = dart.notNull(x) + 1; |
1765 return x; | 1765 return x; |
1766 }).bind(this)(), element); | 1766 })(), element); |
1767 } | 1767 } |
1768 addAll(iterable) { | 1768 addAll(iterable) { |
1769 dart.as(iterable, core.Iterable$(E)); | 1769 dart.as(iterable, core.Iterable$(E)); |
1770 for (let element of iterable) { | 1770 for (let element of iterable) { |
1771 this.set((() => { | 1771 this.set((() => { |
1772 let x = this.length; | 1772 let x = this.length; |
1773 this.length = dart.notNull(x) + 1; | 1773 this.length = dart.notNull(x) + 1; |
1774 return x; | 1774 return x; |
1775 }).bind(this)(), element); | 1775 })(), element); |
1776 } | 1776 } |
1777 } | 1777 } |
1778 remove(element) { | 1778 remove(element) { |
1779 for (let i = 0; i < dart.notNull(this.length); i++) { | 1779 for (let i = 0; i < dart.notNull(this.length); i++) { |
1780 if (dart.equals(this.get(i), element)) { | 1780 if (dart.equals(this.get(i), element)) { |
1781 this.setRange(i, dart.notNull(this.length) - 1, this, i + 1); | 1781 this.setRange(i, dart.notNull(this.length) - 1, this, i + 1); |
1782 this.length = dart.notNull(this.length) - 1; | 1782 this.length = dart.notNull(this.length) - 1; |
1783 return true; | 1783 return true; |
1784 } | 1784 } |
1785 } | 1785 } |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 } | 3435 } |
3436 return null; | 3436 return null; |
3437 } | 3437 } |
3438 remove(key) { | 3438 remove(key) { |
3439 if (!dart.notNull(this[_validKey](key))) return null; | 3439 if (!dart.notNull(this[_validKey](key))) return null; |
3440 let mapRoot = dart.as(this[_remove](dart.as(key, K)), _SplayTreeMapNode)
; | 3440 let mapRoot = dart.as(this[_remove](dart.as(key, K)), _SplayTreeMapNode)
; |
3441 if (mapRoot != null) return dart.as(mapRoot.value, V); | 3441 if (mapRoot != null) return dart.as(mapRoot.value, V); |
3442 return null; | 3442 return null; |
3443 } | 3443 } |
3444 set(key, value) { | 3444 set(key, value) { |
3445 ((() => { | 3445 (() => { |
3446 dart.as(key, K); | 3446 dart.as(key, K); |
3447 dart.as(value, V); | 3447 dart.as(value, V); |
3448 if (key == null) dart.throw(new core.ArgumentError(key)); | 3448 if (key == null) dart.throw(new core.ArgumentError(key)); |
3449 let comp = this[_splay](key); | 3449 let comp = this[_splay](key); |
3450 if (comp == 0) { | 3450 if (comp == 0) { |
3451 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); | 3451 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); |
3452 mapRoot.value = value; | 3452 mapRoot.value = value; |
3453 return; | 3453 return; |
3454 } | 3454 } |
3455 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value
), comp); | 3455 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value
), comp); |
3456 }).bind(this))(); | 3456 })(); |
3457 return value; | 3457 return value; |
3458 } | 3458 } |
3459 putIfAbsent(key, ifAbsent) { | 3459 putIfAbsent(key, ifAbsent) { |
3460 dart.as(key, K); | 3460 dart.as(key, K); |
3461 dart.as(ifAbsent, dart.functionType(V, [])); | 3461 dart.as(ifAbsent, dart.functionType(V, [])); |
3462 if (key == null) dart.throw(new core.ArgumentError(key)); | 3462 if (key == null) dart.throw(new core.ArgumentError(key)); |
3463 let comp = this[_splay](key); | 3463 let comp = this[_splay](key); |
3464 if (comp == 0) { | 3464 if (comp == 0) { |
3465 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); | 3465 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); |
3466 return dart.as(mapRoot.value, V); | 3466 return dart.as(mapRoot.value, V); |
3467 } | 3467 } |
3468 let modificationCount = this[_modificationCount]; | 3468 let modificationCount = this[_modificationCount]; |
3469 let splayCount = this[_splayCount]; | 3469 let splayCount = this[_splayCount]; |
3470 let value = ifAbsent(); | 3470 let value = ifAbsent(); |
3471 if (modificationCount != this[_modificationCount]) { | 3471 if (modificationCount != this[_modificationCount]) { |
3472 dart.throw(new core.ConcurrentModificationError(this)); | 3472 dart.throw(new core.ConcurrentModificationError(this)); |
3473 } | 3473 } |
3474 if (splayCount != this[_splayCount]) { | 3474 if (splayCount != this[_splayCount]) { |
3475 comp = this[_splay](key); | 3475 comp = this[_splay](key); |
3476 dart.assert(comp != 0); | 3476 dart.assert(comp != 0); |
3477 } | 3477 } |
3478 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value),
comp); | 3478 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value),
comp); |
3479 return value; | 3479 return value; |
3480 } | 3480 } |
3481 addAll(other) { | 3481 addAll(other) { |
3482 dart.as(other, core.Map$(K, V)); | 3482 dart.as(other, core.Map$(K, V)); |
3483 other.forEach(dart.fn(((key, value) => { | 3483 other.forEach(dart.fn((key, value) => { |
3484 dart.as(key, K); | 3484 dart.as(key, K); |
3485 dart.as(value, V); | 3485 dart.as(value, V); |
3486 this.set(key, value); | 3486 this.set(key, value); |
3487 }).bind(this), dart.void, [K, V])); | 3487 }, dart.void, [K, V])); |
3488 } | 3488 } |
3489 get isEmpty() { | 3489 get isEmpty() { |
3490 return this[_root] == null; | 3490 return this[_root] == null; |
3491 } | 3491 } |
3492 get isNotEmpty() { | 3492 get isNotEmpty() { |
3493 return !dart.notNull(this.isEmpty); | 3493 return !dart.notNull(this.isEmpty); |
3494 } | 3494 } |
3495 forEach(f) { | 3495 forEach(f) { |
3496 dart.as(f, dart.functionType(dart.void, [K, V])); | 3496 dart.as(f, dart.functionType(dart.void, [K, V])); |
3497 let nodes = new (_SplayTreeNodeIterator$(K))(this); | 3497 let nodes = new (_SplayTreeNodeIterator$(K))(this); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3999 get isEmpty() { | 3999 get isEmpty() { |
4000 return this[_length] == 0; | 4000 return this[_length] == 0; |
4001 } | 4001 } |
4002 get isNotEmpty() { | 4002 get isNotEmpty() { |
4003 return !dart.notNull(this.isEmpty); | 4003 return !dart.notNull(this.isEmpty); |
4004 } | 4004 } |
4005 get keys() { | 4005 get keys() { |
4006 return new (HashMapKeyIterable$(K))(this); | 4006 return new (HashMapKeyIterable$(K))(this); |
4007 } | 4007 } |
4008 get values() { | 4008 get values() { |
4009 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn((each => t
his.get(each)).bind(this), V, [K])); | 4009 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => th
is.get(each), V, [K])); |
4010 } | 4010 } |
4011 containsKey(key) { | 4011 containsKey(key) { |
4012 if (dart.notNull(_HashMap$()._isStringKey(key))) { | 4012 if (dart.notNull(_HashMap$()._isStringKey(key))) { |
4013 let strings = this[_strings]; | 4013 let strings = this[_strings]; |
4014 return strings == null ? false : _HashMap$()._hasTableEntry(strings, k
ey); | 4014 return strings == null ? false : _HashMap$()._hasTableEntry(strings, k
ey); |
4015 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { | 4015 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { |
4016 let nums = this[_nums]; | 4016 let nums = this[_nums]; |
4017 return nums == null ? false : _HashMap$()._hasTableEntry(nums, key); | 4017 return nums == null ? false : _HashMap$()._hasTableEntry(nums, key); |
4018 } else { | 4018 } else { |
4019 return this[_containsKey](key); | 4019 return this[_containsKey](key); |
4020 } | 4020 } |
4021 } | 4021 } |
4022 [_containsKey](key) { | 4022 [_containsKey](key) { |
4023 let rest = this[_rest]; | 4023 let rest = this[_rest]; |
4024 if (rest == null) return false; | 4024 if (rest == null) return false; |
4025 let bucket = this[_getBucket](rest, key); | 4025 let bucket = this[_getBucket](rest, key); |
4026 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; | 4026 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; |
4027 } | 4027 } |
4028 containsValue(value) { | 4028 containsValue(value) { |
4029 return this[_computeKeys]()[dartx.any](dart.fn((each => dart.equals(this
.get(each), value)).bind(this), core.bool, [dart.dynamic])); | 4029 return this[_computeKeys]()[dartx.any](dart.fn(each => dart.equals(this.
get(each), value), core.bool, [dart.dynamic])); |
4030 } | 4030 } |
4031 addAll(other) { | 4031 addAll(other) { |
4032 dart.as(other, core.Map$(K, V)); | 4032 dart.as(other, core.Map$(K, V)); |
4033 other.forEach(dart.fn(((key, value) => { | 4033 other.forEach(dart.fn((key, value) => { |
4034 dart.as(key, K); | 4034 dart.as(key, K); |
4035 dart.as(value, V); | 4035 dart.as(value, V); |
4036 this.set(key, value); | 4036 this.set(key, value); |
4037 }).bind(this), dart.void, [K, V])); | 4037 }, dart.void, [K, V])); |
4038 } | 4038 } |
4039 get(key) { | 4039 get(key) { |
4040 if (dart.notNull(_HashMap$()._isStringKey(key))) { | 4040 if (dart.notNull(_HashMap$()._isStringKey(key))) { |
4041 let strings = this[_strings]; | 4041 let strings = this[_strings]; |
4042 return dart.as(strings == null ? null : _HashMap$()._getTableEntry(str
ings, key), V); | 4042 return dart.as(strings == null ? null : _HashMap$()._getTableEntry(str
ings, key), V); |
4043 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { | 4043 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { |
4044 let nums = this[_nums]; | 4044 let nums = this[_nums]; |
4045 return dart.as(nums == null ? null : _HashMap$()._getTableEntry(nums,
key), V); | 4045 return dart.as(nums == null ? null : _HashMap$()._getTableEntry(nums,
key), V); |
4046 } else { | 4046 } else { |
4047 return this[_get](key); | 4047 return this[_get](key); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4459 get isEmpty() { | 4459 get isEmpty() { |
4460 return this[_length] == 0; | 4460 return this[_length] == 0; |
4461 } | 4461 } |
4462 get isNotEmpty() { | 4462 get isNotEmpty() { |
4463 return !dart.notNull(this.isEmpty); | 4463 return !dart.notNull(this.isEmpty); |
4464 } | 4464 } |
4465 get keys() { | 4465 get keys() { |
4466 return new (LinkedHashMapKeyIterable$(K))(this); | 4466 return new (LinkedHashMapKeyIterable$(K))(this); |
4467 } | 4467 } |
4468 get values() { | 4468 get values() { |
4469 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn((each => t
his.get(each)).bind(this), V, [K])); | 4469 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => th
is.get(each), V, [K])); |
4470 } | 4470 } |
4471 containsKey(key) { | 4471 containsKey(key) { |
4472 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { | 4472 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { |
4473 let strings = this[_strings]; | 4473 let strings = this[_strings]; |
4474 if (strings == null) return false; | 4474 if (strings == null) return false; |
4475 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); | 4475 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); |
4476 return cell != null; | 4476 return cell != null; |
4477 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { | 4477 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { |
4478 let nums = this[_nums]; | 4478 let nums = this[_nums]; |
4479 if (nums == null) return false; | 4479 if (nums == null) return false; |
4480 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked
HashMapCell); | 4480 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked
HashMapCell); |
4481 return cell != null; | 4481 return cell != null; |
4482 } else { | 4482 } else { |
4483 return this[_containsKey](key); | 4483 return this[_containsKey](key); |
4484 } | 4484 } |
4485 } | 4485 } |
4486 [_containsKey](key) { | 4486 [_containsKey](key) { |
4487 let rest = this[_rest]; | 4487 let rest = this[_rest]; |
4488 if (rest == null) return false; | 4488 if (rest == null) return false; |
4489 let bucket = this[_getBucket](rest, key); | 4489 let bucket = this[_getBucket](rest, key); |
4490 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; | 4490 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; |
4491 } | 4491 } |
4492 containsValue(value) { | 4492 containsValue(value) { |
4493 return this.keys[dartx.any](dart.fn((each => dart.equals(this.get(each),
value)).bind(this), core.bool, [K])); | 4493 return this.keys[dartx.any](dart.fn(each => dart.equals(this.get(each),
value), core.bool, [K])); |
4494 } | 4494 } |
4495 addAll(other) { | 4495 addAll(other) { |
4496 dart.as(other, core.Map$(K, V)); | 4496 dart.as(other, core.Map$(K, V)); |
4497 other.forEach(dart.fn(((key, value) => { | 4497 other.forEach(dart.fn((key, value) => { |
4498 dart.as(key, K); | 4498 dart.as(key, K); |
4499 dart.as(value, V); | 4499 dart.as(value, V); |
4500 this.set(key, value); | 4500 this.set(key, value); |
4501 }).bind(this), dart.void, [K, V])); | 4501 }, dart.void, [K, V])); |
4502 } | 4502 } |
4503 get(key) { | 4503 get(key) { |
4504 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { | 4504 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { |
4505 let strings = this[_strings]; | 4505 let strings = this[_strings]; |
4506 if (strings == null) return null; | 4506 if (strings == null) return null; |
4507 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); | 4507 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); |
4508 return dart.as(cell == null ? null : cell[_value], V); | 4508 return dart.as(cell == null ? null : cell[_value], V); |
4509 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { | 4509 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { |
4510 let nums = this[_nums]; | 4510 let nums = this[_nums]; |
4511 if (nums == null) return null; | 4511 if (nums == null) return null; |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5780 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; | 5780 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; |
5781 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; | 5781 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; |
5782 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; | 5782 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; |
5783 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; | 5783 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; |
5784 exports.HashSetIterator$ = HashSetIterator$; | 5784 exports.HashSetIterator$ = HashSetIterator$; |
5785 exports.HashSetIterator = HashSetIterator; | 5785 exports.HashSetIterator = HashSetIterator; |
5786 exports.LinkedHashSetCell = LinkedHashSetCell; | 5786 exports.LinkedHashSetCell = LinkedHashSetCell; |
5787 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; | 5787 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; |
5788 exports.LinkedHashSetIterator = LinkedHashSetIterator; | 5788 exports.LinkedHashSetIterator = LinkedHashSetIterator; |
5789 }); | 5789 }); |
OLD | NEW |