OLD | NEW |
1 dart_library.library('dart/collection', null, /* Imports */[ | 1 dart_library.library('dart/collection', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 result.remove(element); | 189 result.remove(element); |
190 } | 190 } |
191 return result; | 191 return result; |
192 } | 192 } |
193 toList(opts) { | 193 toList(opts) { |
194 let growable = opts && 'growable' in opts ? opts.growable : true; | 194 let growable = opts && 'growable' in opts ? opts.growable : true; |
195 let result = dart.notNull(growable) ? (() => { | 195 let result = dart.notNull(growable) ? (() => { |
196 let _ = core.List$(E).new(); | 196 let _ = core.List$(E).new(); |
197 _[dartx.length] = this.length; | 197 _[dartx.length] = this.length; |
198 return _; | 198 return _; |
199 })() : core.List$(E).new(this.length); | 199 }).bind(this)() : core.List$(E).new(this.length); |
200 let i = 0; | 200 let i = 0; |
201 for (let element of this) | 201 for (let element of this) |
202 result[dartx.set]((() => { | 202 result[dartx.set]((() => { |
203 let x = i; | 203 let x = i; |
204 i = dart.notNull(x) + 1; | 204 i = dart.notNull(x) + 1; |
205 return x; | 205 return x; |
206 })(), element); | 206 })(), element); |
207 return result; | 207 return result; |
208 } | 208 } |
209 map(f) { | 209 map(f) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (dart.notNull(other.contains(element))) | 473 if (dart.notNull(other.contains(element))) |
474 result.add(element); | 474 result.add(element); |
475 } | 475 } |
476 return result; | 476 return result; |
477 } | 477 } |
478 toSet() { | 478 toSet() { |
479 return (() => { | 479 return (() => { |
480 let _ = this[_newSet](); | 480 let _ = this[_newSet](); |
481 _.addAll(this); | 481 _.addAll(this); |
482 return _; | 482 return _; |
483 })(); | 483 }).bind(this)(); |
484 } | 484 } |
485 } | 485 } |
486 dart.setSignature(_HashSetBase, { | 486 dart.setSignature(_HashSetBase, { |
487 methods: () => ({ | 487 methods: () => ({ |
488 difference: [core.Set$(E), [core.Set$(core.Object)]], | 488 difference: [core.Set$(E), [core.Set$(core.Object)]], |
489 intersection: [core.Set$(E), [core.Set$(core.Object)]], | 489 intersection: [core.Set$(E), [core.Set$(core.Object)]], |
490 toSet: [core.Set$(E), []] | 490 toSet: [core.Set$(E), []] |
491 }) | 491 }) |
492 }); | 492 }); |
493 dart.defineExtensionMembers(_HashSetBase, ['toSet']); | 493 dart.defineExtensionMembers(_HashSetBase, ['toSet']); |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 addFirst(entry) { | 1417 addFirst(entry) { |
1418 dart.as(entry, E); | 1418 dart.as(entry, E); |
1419 this[_insertAfter](this, entry); | 1419 this[_insertAfter](this, entry); |
1420 } | 1420 } |
1421 add(entry) { | 1421 add(entry) { |
1422 dart.as(entry, E); | 1422 dart.as(entry, E); |
1423 this[_insertAfter](this[_previous], entry); | 1423 this[_insertAfter](this[_previous], entry); |
1424 } | 1424 } |
1425 addAll(entries) { | 1425 addAll(entries) { |
1426 dart.as(entries, core.Iterable$(E)); | 1426 dart.as(entries, core.Iterable$(E)); |
1427 entries[dartx.forEach](dart.fn(entry => this[_insertAfter](this[_previou
s], dart.as(entry, E)), dart.void, [dart.dynamic])); | 1427 entries[dartx.forEach](dart.fn((entry => this[_insertAfter](this[_previo
us], dart.as(entry, E))).bind(this), dart.void, [dart.dynamic])); |
1428 } | 1428 } |
1429 remove(entry) { | 1429 remove(entry) { |
1430 dart.as(entry, E); | 1430 dart.as(entry, E); |
1431 if (!dart.equals(entry[_list], this)) | 1431 if (!dart.equals(entry[_list], this)) |
1432 return false; | 1432 return false; |
1433 this[_unlink](entry); | 1433 this[_unlink](entry); |
1434 return true; | 1434 return true; |
1435 } | 1435 } |
1436 get iterator() { | 1436 get iterator() { |
1437 return new (_LinkedListIterator$(E))(this); | 1437 return new (_LinkedListIterator$(E))(this); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 result.add(this.get(i)); | 1835 result.add(this.get(i)); |
1836 } | 1836 } |
1837 return result; | 1837 return result; |
1838 } | 1838 } |
1839 add(element) { | 1839 add(element) { |
1840 dart.as(element, E); | 1840 dart.as(element, E); |
1841 this.set((() => { | 1841 this.set((() => { |
1842 let x = this.length; | 1842 let x = this.length; |
1843 this.length = dart.notNull(x) + 1; | 1843 this.length = dart.notNull(x) + 1; |
1844 return x; | 1844 return x; |
1845 })(), element); | 1845 }).bind(this)(), element); |
1846 } | 1846 } |
1847 addAll(iterable) { | 1847 addAll(iterable) { |
1848 dart.as(iterable, core.Iterable$(E)); | 1848 dart.as(iterable, core.Iterable$(E)); |
1849 for (let element of iterable) { | 1849 for (let element of iterable) { |
1850 this.set((() => { | 1850 this.set((() => { |
1851 let x = this.length; | 1851 let x = this.length; |
1852 this.length = dart.notNull(x) + 1; | 1852 this.length = dart.notNull(x) + 1; |
1853 return x; | 1853 return x; |
1854 })(), element); | 1854 }).bind(this)(), element); |
1855 } | 1855 } |
1856 } | 1856 } |
1857 remove(element) { | 1857 remove(element) { |
1858 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { | 1858 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no
tNull(i) + 1) { |
1859 if (dart.equals(this.get(i), element)) { | 1859 if (dart.equals(this.get(i), element)) { |
1860 this.setRange(i, dart.notNull(this.length) - 1, this, dart.notNull(i
) + 1); | 1860 this.setRange(i, dart.notNull(this.length) - 1, this, dart.notNull(i
) + 1); |
1861 this.length = dart.notNull(this.length) - 1; | 1861 this.length = dart.notNull(this.length) - 1; |
1862 return true; | 1862 return true; |
1863 } | 1863 } |
1864 } | 1864 } |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3591 } | 3591 } |
3592 if (splayCount != this[_splayCount]) { | 3592 if (splayCount != this[_splayCount]) { |
3593 comp = this[_splay](key); | 3593 comp = this[_splay](key); |
3594 dart.assert(comp != 0); | 3594 dart.assert(comp != 0); |
3595 } | 3595 } |
3596 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value),
comp); | 3596 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value),
comp); |
3597 return value; | 3597 return value; |
3598 } | 3598 } |
3599 addAll(other) { | 3599 addAll(other) { |
3600 dart.as(other, core.Map$(K, V)); | 3600 dart.as(other, core.Map$(K, V)); |
3601 other.forEach(dart.fn((key, value) => { | 3601 other.forEach(dart.fn(((key, value) => { |
3602 dart.as(key, K); | 3602 dart.as(key, K); |
3603 dart.as(value, V); | 3603 dart.as(value, V); |
3604 this.set(key, value); | 3604 this.set(key, value); |
3605 }, dart.dynamic, [K, V])); | 3605 }).bind(this), dart.dynamic, [K, V])); |
3606 } | 3606 } |
3607 get isEmpty() { | 3607 get isEmpty() { |
3608 return this[_root] == null; | 3608 return this[_root] == null; |
3609 } | 3609 } |
3610 get isNotEmpty() { | 3610 get isNotEmpty() { |
3611 return !dart.notNull(this.isEmpty); | 3611 return !dart.notNull(this.isEmpty); |
3612 } | 3612 } |
3613 forEach(f) { | 3613 forEach(f) { |
3614 dart.as(f, dart.functionType(dart.void, [K, V])); | 3614 dart.as(f, dart.functionType(dart.void, [K, V])); |
3615 let nodes = new (_SplayTreeNodeIterator$(K))(this); | 3615 let nodes = new (_SplayTreeNodeIterator$(K))(this); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4154 get isEmpty() { | 4154 get isEmpty() { |
4155 return this[_length] == 0; | 4155 return this[_length] == 0; |
4156 } | 4156 } |
4157 get isNotEmpty() { | 4157 get isNotEmpty() { |
4158 return !dart.notNull(this.isEmpty); | 4158 return !dart.notNull(this.isEmpty); |
4159 } | 4159 } |
4160 get keys() { | 4160 get keys() { |
4161 return new (HashMapKeyIterable$(K))(this); | 4161 return new (HashMapKeyIterable$(K))(this); |
4162 } | 4162 } |
4163 get values() { | 4163 get values() { |
4164 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => th
is.get(each), V, [dart.dynamic])); | 4164 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn((each => t
his.get(each)).bind(this), V, [dart.dynamic])); |
4165 } | 4165 } |
4166 containsKey(key) { | 4166 containsKey(key) { |
4167 if (dart.notNull(_HashMap$()._isStringKey(key))) { | 4167 if (dart.notNull(_HashMap$()._isStringKey(key))) { |
4168 let strings = this[_strings]; | 4168 let strings = this[_strings]; |
4169 return strings == null ? false : _HashMap$()._hasTableEntry(strings, k
ey); | 4169 return strings == null ? false : _HashMap$()._hasTableEntry(strings, k
ey); |
4170 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { | 4170 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { |
4171 let nums = this[_nums]; | 4171 let nums = this[_nums]; |
4172 return nums == null ? false : _HashMap$()._hasTableEntry(nums, key); | 4172 return nums == null ? false : _HashMap$()._hasTableEntry(nums, key); |
4173 } else { | 4173 } else { |
4174 return this[_containsKey](key); | 4174 return this[_containsKey](key); |
4175 } | 4175 } |
4176 } | 4176 } |
4177 [_containsKey](key) { | 4177 [_containsKey](key) { |
4178 let rest = this[_rest]; | 4178 let rest = this[_rest]; |
4179 if (rest == null) | 4179 if (rest == null) |
4180 return false; | 4180 return false; |
4181 let bucket = this[_getBucket](rest, key); | 4181 let bucket = this[_getBucket](rest, key); |
4182 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; | 4182 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; |
4183 } | 4183 } |
4184 containsValue(value) { | 4184 containsValue(value) { |
4185 return this[_computeKeys]()[dartx.any](dart.fn(each => dart.equals(this.
get(each), value), core.bool, [dart.dynamic])); | 4185 return this[_computeKeys]()[dartx.any](dart.fn((each => dart.equals(this
.get(each), value)).bind(this), core.bool, [dart.dynamic])); |
4186 } | 4186 } |
4187 addAll(other) { | 4187 addAll(other) { |
4188 dart.as(other, core.Map$(K, V)); | 4188 dart.as(other, core.Map$(K, V)); |
4189 other.forEach(dart.fn((key, value) => { | 4189 other.forEach(dart.fn(((key, value) => { |
4190 dart.as(key, K); | 4190 dart.as(key, K); |
4191 dart.as(value, V); | 4191 dart.as(value, V); |
4192 this.set(key, value); | 4192 this.set(key, value); |
4193 }, dart.dynamic, [K, V])); | 4193 }).bind(this), dart.dynamic, [K, V])); |
4194 } | 4194 } |
4195 get(key) { | 4195 get(key) { |
4196 if (dart.notNull(_HashMap$()._isStringKey(key))) { | 4196 if (dart.notNull(_HashMap$()._isStringKey(key))) { |
4197 let strings = this[_strings]; | 4197 let strings = this[_strings]; |
4198 return strings == null ? null : dart.as(_HashMap$()._getTableEntry(str
ings, key), V); | 4198 return strings == null ? null : dart.as(_HashMap$()._getTableEntry(str
ings, key), V); |
4199 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { | 4199 } else if (dart.notNull(_HashMap$()._isNumericKey(key))) { |
4200 let nums = this[_nums]; | 4200 let nums = this[_nums]; |
4201 return nums == null ? null : dart.as(_HashMap$()._getTableEntry(nums,
key), V); | 4201 return nums == null ? null : dart.as(_HashMap$()._getTableEntry(nums,
key), V); |
4202 } else { | 4202 } else { |
4203 return this[_get](key); | 4203 return this[_get](key); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 get isEmpty() { | 4630 get isEmpty() { |
4631 return this[_length] == 0; | 4631 return this[_length] == 0; |
4632 } | 4632 } |
4633 get isNotEmpty() { | 4633 get isNotEmpty() { |
4634 return !dart.notNull(this.isEmpty); | 4634 return !dart.notNull(this.isEmpty); |
4635 } | 4635 } |
4636 get keys() { | 4636 get keys() { |
4637 return new (LinkedHashMapKeyIterable$(K))(this); | 4637 return new (LinkedHashMapKeyIterable$(K))(this); |
4638 } | 4638 } |
4639 get values() { | 4639 get values() { |
4640 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn(each => th
is.get(each), V, [dart.dynamic])); | 4640 return _internal.MappedIterable$(K, V).new(this.keys, dart.fn((each => t
his.get(each)).bind(this), V, [dart.dynamic])); |
4641 } | 4641 } |
4642 containsKey(key) { | 4642 containsKey(key) { |
4643 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { | 4643 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { |
4644 let strings = this[_strings]; | 4644 let strings = this[_strings]; |
4645 if (strings == null) | 4645 if (strings == null) |
4646 return false; | 4646 return false; |
4647 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); | 4647 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); |
4648 return cell != null; | 4648 return cell != null; |
4649 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { | 4649 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { |
4650 let nums = this[_nums]; | 4650 let nums = this[_nums]; |
4651 if (nums == null) | 4651 if (nums == null) |
4652 return false; | 4652 return false; |
4653 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked
HashMapCell); | 4653 let cell = dart.as(_LinkedHashMap$()._getTableEntry(nums, key), Linked
HashMapCell); |
4654 return cell != null; | 4654 return cell != null; |
4655 } else { | 4655 } else { |
4656 return this[_containsKey](key); | 4656 return this[_containsKey](key); |
4657 } | 4657 } |
4658 } | 4658 } |
4659 [_containsKey](key) { | 4659 [_containsKey](key) { |
4660 let rest = this[_rest]; | 4660 let rest = this[_rest]; |
4661 if (rest == null) | 4661 if (rest == null) |
4662 return false; | 4662 return false; |
4663 let bucket = this[_getBucket](rest, key); | 4663 let bucket = this[_getBucket](rest, key); |
4664 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; | 4664 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; |
4665 } | 4665 } |
4666 containsValue(value) { | 4666 containsValue(value) { |
4667 return this.keys[dartx.any](dart.fn(each => dart.equals(this.get(each),
value), core.bool, [dart.dynamic])); | 4667 return this.keys[dartx.any](dart.fn((each => dart.equals(this.get(each),
value)).bind(this), core.bool, [dart.dynamic])); |
4668 } | 4668 } |
4669 addAll(other) { | 4669 addAll(other) { |
4670 dart.as(other, core.Map$(K, V)); | 4670 dart.as(other, core.Map$(K, V)); |
4671 other.forEach(dart.fn((key, value) => { | 4671 other.forEach(dart.fn(((key, value) => { |
4672 dart.as(key, K); | 4672 dart.as(key, K); |
4673 dart.as(value, V); | 4673 dart.as(value, V); |
4674 this.set(key, value); | 4674 this.set(key, value); |
4675 }, dart.dynamic, [K, V])); | 4675 }).bind(this), dart.dynamic, [K, V])); |
4676 } | 4676 } |
4677 get(key) { | 4677 get(key) { |
4678 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { | 4678 if (dart.notNull(_LinkedHashMap$()._isStringKey(key))) { |
4679 let strings = this[_strings]; | 4679 let strings = this[_strings]; |
4680 if (strings == null) | 4680 if (strings == null) |
4681 return null; | 4681 return null; |
4682 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); | 4682 let cell = dart.as(_LinkedHashMap$()._getTableEntry(strings, key), Lin
kedHashMapCell); |
4683 return cell == null ? null : dart.as(cell[_value], V); | 4683 return cell == null ? null : dart.as(cell[_value], V); |
4684 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { | 4684 } else if (dart.notNull(_LinkedHashMap$()._isNumericKey(key))) { |
4685 let nums = this[_nums]; | 4685 let nums = this[_nums]; |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6020 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; | 6020 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; |
6021 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; | 6021 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; |
6022 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; | 6022 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; |
6023 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; | 6023 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; |
6024 exports.HashSetIterator$ = HashSetIterator$; | 6024 exports.HashSetIterator$ = HashSetIterator$; |
6025 exports.HashSetIterator = HashSetIterator; | 6025 exports.HashSetIterator = HashSetIterator; |
6026 exports.LinkedHashSetCell = LinkedHashSetCell; | 6026 exports.LinkedHashSetCell = LinkedHashSetCell; |
6027 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; | 6027 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; |
6028 exports.LinkedHashSetIterator = LinkedHashSetIterator; | 6028 exports.LinkedHashSetIterator = LinkedHashSetIterator; |
6029 }); | 6029 }); |
OLD | NEW |