OLD | NEW |
(Empty) | |
| 1 dart_library.library('collection/wrappers', null, /* Imports */[ |
| 2 'dart/_runtime', |
| 3 'collection/src/canonicalized_map', |
| 4 'dart/core', |
| 5 'dart/math', |
| 6 'dart/collection' |
| 7 ], /* Lazy imports */[ |
| 8 'collection/src/unmodifiable_wrappers' |
| 9 ], function(exports, dart, canonicalized_map, core, math, collection, unmodifiab
le_wrappers) { |
| 10 'use strict'; |
| 11 let dartx = dart.dartx; |
| 12 dart.export_(exports, canonicalized_map); |
| 13 dart.export_(exports, unmodifiable_wrappers); |
| 14 const _base = Symbol('_base'); |
| 15 const _DelegatingIterableBase$ = dart.generic(function(E) { |
| 16 class _DelegatingIterableBase extends core.Object { |
| 17 _DelegatingIterableBase() { |
| 18 } |
| 19 any(test) { |
| 20 dart.as(test, dart.functionType(core.bool, [E])); |
| 21 return this[_base][dartx.any](test); |
| 22 } |
| 23 contains(element) { |
| 24 return this[_base][dartx.contains](element); |
| 25 } |
| 26 elementAt(index) { |
| 27 return this[_base][dartx.elementAt](index); |
| 28 } |
| 29 every(test) { |
| 30 dart.as(test, dart.functionType(core.bool, [E])); |
| 31 return this[_base][dartx.every](test); |
| 32 } |
| 33 expand(f) { |
| 34 dart.as(f, dart.functionType(core.Iterable, [E])); |
| 35 return this[_base][dartx.expand](f); |
| 36 } |
| 37 get first() { |
| 38 return this[_base][dartx.first]; |
| 39 } |
| 40 firstWhere(test, opts) { |
| 41 dart.as(test, dart.functionType(core.bool, [E])); |
| 42 let orElse = opts && 'orElse' in opts ? opts.orElse : null; |
| 43 dart.as(orElse, dart.functionType(E, [])); |
| 44 return this[_base][dartx.firstWhere](test, {orElse: orElse}); |
| 45 } |
| 46 fold(initialValue, combine) { |
| 47 dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E])); |
| 48 return this[_base][dartx.fold](initialValue, combine); |
| 49 } |
| 50 forEach(f) { |
| 51 dart.as(f, dart.functionType(dart.void, [E])); |
| 52 return this[_base][dartx.forEach](f); |
| 53 } |
| 54 get isEmpty() { |
| 55 return this[_base][dartx.isEmpty]; |
| 56 } |
| 57 get isNotEmpty() { |
| 58 return this[_base][dartx.isNotEmpty]; |
| 59 } |
| 60 get iterator() { |
| 61 return this[_base][dartx.iterator]; |
| 62 } |
| 63 [Symbol.iterator]() { |
| 64 return new dart.JsIterator(this.iterator); |
| 65 } |
| 66 join(separator) { |
| 67 if (separator === void 0) separator = ""; |
| 68 return this[_base][dartx.join](separator); |
| 69 } |
| 70 get last() { |
| 71 return this[_base][dartx.last]; |
| 72 } |
| 73 lastWhere(test, opts) { |
| 74 dart.as(test, dart.functionType(core.bool, [E])); |
| 75 let orElse = opts && 'orElse' in opts ? opts.orElse : null; |
| 76 dart.as(orElse, dart.functionType(E, [])); |
| 77 return this[_base][dartx.lastWhere](test, {orElse: orElse}); |
| 78 } |
| 79 get length() { |
| 80 return this[_base][dartx.length]; |
| 81 } |
| 82 map(f) { |
| 83 dart.as(f, dart.functionType(dart.dynamic, [E])); |
| 84 return this[_base][dartx.map](f); |
| 85 } |
| 86 reduce(combine) { |
| 87 dart.as(combine, dart.functionType(E, [E, E])); |
| 88 return this[_base][dartx.reduce](combine); |
| 89 } |
| 90 get single() { |
| 91 return this[_base][dartx.single]; |
| 92 } |
| 93 singleWhere(test) { |
| 94 dart.as(test, dart.functionType(core.bool, [E])); |
| 95 return this[_base][dartx.singleWhere](test); |
| 96 } |
| 97 skip(n) { |
| 98 return this[_base][dartx.skip](n); |
| 99 } |
| 100 skipWhile(test) { |
| 101 dart.as(test, dart.functionType(core.bool, [E])); |
| 102 return this[_base][dartx.skipWhile](test); |
| 103 } |
| 104 take(n) { |
| 105 return this[_base][dartx.take](n); |
| 106 } |
| 107 takeWhile(test) { |
| 108 dart.as(test, dart.functionType(core.bool, [E])); |
| 109 return this[_base][dartx.takeWhile](test); |
| 110 } |
| 111 toList(opts) { |
| 112 let growable = opts && 'growable' in opts ? opts.growable : true; |
| 113 return this[_base][dartx.toList]({growable: growable}); |
| 114 } |
| 115 toSet() { |
| 116 return this[_base][dartx.toSet](); |
| 117 } |
| 118 where(test) { |
| 119 dart.as(test, dart.functionType(core.bool, [E])); |
| 120 return this[_base][dartx.where](test); |
| 121 } |
| 122 toString() { |
| 123 return dart.toString(this[_base]); |
| 124 } |
| 125 } |
| 126 _DelegatingIterableBase[dart.implements] = () => [core.Iterable$(E)]; |
| 127 dart.setSignature(_DelegatingIterableBase, { |
| 128 constructors: () => ({_DelegatingIterableBase: [_DelegatingIterableBase$(E
), []]}), |
| 129 methods: () => ({ |
| 130 any: [core.bool, [dart.functionType(core.bool, [E])]], |
| 131 contains: [core.bool, [core.Object]], |
| 132 elementAt: [E, [core.int]], |
| 133 every: [core.bool, [dart.functionType(core.bool, [E])]], |
| 134 expand: [core.Iterable, [dart.functionType(core.Iterable, [E])]], |
| 135 firstWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.funct
ionType(E, [])}], |
| 136 fold: [dart.dynamic, [dart.dynamic, dart.functionType(dart.dynamic, [dar
t.dynamic, E])]], |
| 137 forEach: [dart.void, [dart.functionType(dart.void, [E])]], |
| 138 join: [core.String, [], [core.String]], |
| 139 lastWhere: [E, [dart.functionType(core.bool, [E])], {orElse: dart.functi
onType(E, [])}], |
| 140 map: [core.Iterable, [dart.functionType(dart.dynamic, [E])]], |
| 141 reduce: [E, [dart.functionType(E, [E, E])]], |
| 142 singleWhere: [E, [dart.functionType(core.bool, [E])]], |
| 143 skip: [core.Iterable$(E), [core.int]], |
| 144 skipWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]], |
| 145 take: [core.Iterable$(E), [core.int]], |
| 146 takeWhile: [core.Iterable$(E), [dart.functionType(core.bool, [E])]], |
| 147 toList: [core.List$(E), [], {growable: core.bool}], |
| 148 toSet: [core.Set$(E), []], |
| 149 where: [core.Iterable$(E), [dart.functionType(core.bool, [E])]] |
| 150 }) |
| 151 }); |
| 152 dart.defineExtensionMembers(_DelegatingIterableBase, [ |
| 153 'any', |
| 154 'contains', |
| 155 'elementAt', |
| 156 'every', |
| 157 'expand', |
| 158 'firstWhere', |
| 159 'fold', |
| 160 'forEach', |
| 161 'join', |
| 162 'lastWhere', |
| 163 'map', |
| 164 'reduce', |
| 165 'singleWhere', |
| 166 'skip', |
| 167 'skipWhile', |
| 168 'take', |
| 169 'takeWhile', |
| 170 'toList', |
| 171 'toSet', |
| 172 'where', |
| 173 'toString', |
| 174 'first', |
| 175 'isEmpty', |
| 176 'isNotEmpty', |
| 177 'iterator', |
| 178 'last', |
| 179 'length', |
| 180 'single' |
| 181 ]); |
| 182 return _DelegatingIterableBase; |
| 183 }); |
| 184 const _DelegatingIterableBase = _DelegatingIterableBase$(); |
| 185 const DelegatingIterable$ = dart.generic(function(E) { |
| 186 class DelegatingIterable extends _DelegatingIterableBase$(E) { |
| 187 DelegatingIterable(base) { |
| 188 this[_base] = base; |
| 189 super._DelegatingIterableBase(); |
| 190 } |
| 191 } |
| 192 dart.setSignature(DelegatingIterable, { |
| 193 constructors: () => ({DelegatingIterable: [DelegatingIterable$(E), [core.I
terable$(E)]]}) |
| 194 }); |
| 195 return DelegatingIterable; |
| 196 }); |
| 197 const DelegatingIterable = DelegatingIterable$(); |
| 198 const _listBase = Symbol('_listBase'); |
| 199 const DelegatingList$ = dart.generic(function(E) { |
| 200 class DelegatingList extends DelegatingIterable$(E) { |
| 201 DelegatingList(base) { |
| 202 super.DelegatingIterable(base); |
| 203 } |
| 204 get [_listBase]() { |
| 205 return dart.as(this[_base], core.List$(E)); |
| 206 } |
| 207 get(index) { |
| 208 return this[_listBase][dartx.get](index); |
| 209 } |
| 210 set(index, value) { |
| 211 dart.as(value, E); |
| 212 this[_listBase][dartx.set](index, value); |
| 213 return value; |
| 214 } |
| 215 add(value) { |
| 216 dart.as(value, E); |
| 217 this[_listBase][dartx.add](value); |
| 218 } |
| 219 addAll(iterable) { |
| 220 dart.as(iterable, core.Iterable$(E)); |
| 221 this[_listBase][dartx.addAll](iterable); |
| 222 } |
| 223 asMap() { |
| 224 return this[_listBase][dartx.asMap](); |
| 225 } |
| 226 clear() { |
| 227 this[_listBase][dartx.clear](); |
| 228 } |
| 229 fillRange(start, end, fillValue) { |
| 230 if (fillValue === void 0) fillValue = null; |
| 231 dart.as(fillValue, E); |
| 232 this[_listBase][dartx.fillRange](start, end, fillValue); |
| 233 } |
| 234 getRange(start, end) { |
| 235 return this[_listBase][dartx.getRange](start, end); |
| 236 } |
| 237 indexOf(element, start) { |
| 238 dart.as(element, E); |
| 239 if (start === void 0) start = 0; |
| 240 return this[_listBase][dartx.indexOf](element, start); |
| 241 } |
| 242 insert(index, element) { |
| 243 dart.as(element, E); |
| 244 this[_listBase][dartx.insert](index, element); |
| 245 } |
| 246 insertAll(index, iterable) { |
| 247 dart.as(iterable, core.Iterable$(E)); |
| 248 this[_listBase][dartx.insertAll](index, iterable); |
| 249 } |
| 250 lastIndexOf(element, start) { |
| 251 dart.as(element, E); |
| 252 if (start === void 0) start = null; |
| 253 return this[_listBase][dartx.lastIndexOf](element, start); |
| 254 } |
| 255 set length(newLength) { |
| 256 this[_listBase][dartx.length] = newLength; |
| 257 } |
| 258 remove(value) { |
| 259 return this[_listBase][dartx.remove](value); |
| 260 } |
| 261 removeAt(index) { |
| 262 return this[_listBase][dartx.removeAt](index); |
| 263 } |
| 264 removeLast() { |
| 265 return this[_listBase][dartx.removeLast](); |
| 266 } |
| 267 removeRange(start, end) { |
| 268 this[_listBase][dartx.removeRange](start, end); |
| 269 } |
| 270 removeWhere(test) { |
| 271 dart.as(test, dart.functionType(core.bool, [E])); |
| 272 this[_listBase][dartx.removeWhere](test); |
| 273 } |
| 274 replaceRange(start, end, iterable) { |
| 275 dart.as(iterable, core.Iterable$(E)); |
| 276 this[_listBase][dartx.replaceRange](start, end, iterable); |
| 277 } |
| 278 retainWhere(test) { |
| 279 dart.as(test, dart.functionType(core.bool, [E])); |
| 280 this[_listBase][dartx.retainWhere](test); |
| 281 } |
| 282 get reversed() { |
| 283 return this[_listBase][dartx.reversed]; |
| 284 } |
| 285 setAll(index, iterable) { |
| 286 dart.as(iterable, core.Iterable$(E)); |
| 287 this[_listBase][dartx.setAll](index, iterable); |
| 288 } |
| 289 setRange(start, end, iterable, skipCount) { |
| 290 dart.as(iterable, core.Iterable$(E)); |
| 291 if (skipCount === void 0) skipCount = 0; |
| 292 this[_listBase][dartx.setRange](start, end, iterable, skipCount); |
| 293 } |
| 294 shuffle(random) { |
| 295 if (random === void 0) random = null; |
| 296 this[_listBase][dartx.shuffle](random); |
| 297 } |
| 298 sort(compare) { |
| 299 if (compare === void 0) compare = null; |
| 300 dart.as(compare, dart.functionType(core.int, [E, E])); |
| 301 this[_listBase][dartx.sort](compare); |
| 302 } |
| 303 sublist(start, end) { |
| 304 if (end === void 0) end = null; |
| 305 return this[_listBase][dartx.sublist](start, end); |
| 306 } |
| 307 } |
| 308 DelegatingList[dart.implements] = () => [core.List$(E)]; |
| 309 dart.setSignature(DelegatingList, { |
| 310 constructors: () => ({DelegatingList: [DelegatingList$(E), [core.List$(E)]
]}), |
| 311 methods: () => ({ |
| 312 get: [E, [core.int]], |
| 313 set: [dart.void, [core.int, E]], |
| 314 add: [dart.void, [E]], |
| 315 addAll: [dart.void, [core.Iterable$(E)]], |
| 316 asMap: [core.Map$(core.int, E), []], |
| 317 clear: [dart.void, []], |
| 318 fillRange: [dart.void, [core.int, core.int], [E]], |
| 319 getRange: [core.Iterable$(E), [core.int, core.int]], |
| 320 indexOf: [core.int, [E], [core.int]], |
| 321 insert: [dart.void, [core.int, E]], |
| 322 insertAll: [dart.void, [core.int, core.Iterable$(E)]], |
| 323 lastIndexOf: [core.int, [E], [core.int]], |
| 324 remove: [core.bool, [core.Object]], |
| 325 removeAt: [E, [core.int]], |
| 326 removeLast: [E, []], |
| 327 removeRange: [dart.void, [core.int, core.int]], |
| 328 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 329 replaceRange: [dart.void, [core.int, core.int, core.Iterable$(E)]], |
| 330 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 331 setAll: [dart.void, [core.int, core.Iterable$(E)]], |
| 332 setRange: [dart.void, [core.int, core.int, core.Iterable$(E)], [core.int
]], |
| 333 shuffle: [dart.void, [], [math.Random]], |
| 334 sort: [dart.void, [], [dart.functionType(core.int, [E, E])]], |
| 335 sublist: [core.List$(E), [core.int], [core.int]] |
| 336 }) |
| 337 }); |
| 338 dart.defineExtensionMembers(DelegatingList, [ |
| 339 'get', |
| 340 'set', |
| 341 'add', |
| 342 'addAll', |
| 343 'asMap', |
| 344 'clear', |
| 345 'fillRange', |
| 346 'getRange', |
| 347 'indexOf', |
| 348 'insert', |
| 349 'insertAll', |
| 350 'lastIndexOf', |
| 351 'remove', |
| 352 'removeAt', |
| 353 'removeLast', |
| 354 'removeRange', |
| 355 'removeWhere', |
| 356 'replaceRange', |
| 357 'retainWhere', |
| 358 'setAll', |
| 359 'setRange', |
| 360 'shuffle', |
| 361 'sort', |
| 362 'sublist', |
| 363 'length', |
| 364 'reversed' |
| 365 ]); |
| 366 return DelegatingList; |
| 367 }); |
| 368 const DelegatingList = DelegatingList$(); |
| 369 const _setBase = Symbol('_setBase'); |
| 370 const DelegatingSet$ = dart.generic(function(E) { |
| 371 class DelegatingSet extends DelegatingIterable$(E) { |
| 372 DelegatingSet(base) { |
| 373 super.DelegatingIterable(base); |
| 374 } |
| 375 get [_setBase]() { |
| 376 return dart.as(this[_base], core.Set$(E)); |
| 377 } |
| 378 add(value) { |
| 379 dart.as(value, E); |
| 380 return this[_setBase].add(value); |
| 381 } |
| 382 addAll(elements) { |
| 383 dart.as(elements, core.Iterable$(E)); |
| 384 this[_setBase].addAll(elements); |
| 385 } |
| 386 clear() { |
| 387 this[_setBase].clear(); |
| 388 } |
| 389 containsAll(other) { |
| 390 return this[_setBase].containsAll(other); |
| 391 } |
| 392 difference(other) { |
| 393 dart.as(other, core.Set$(E)); |
| 394 return this[_setBase].difference(other); |
| 395 } |
| 396 intersection(other) { |
| 397 return this[_setBase].intersection(other); |
| 398 } |
| 399 lookup(element) { |
| 400 return this[_setBase].lookup(element); |
| 401 } |
| 402 remove(value) { |
| 403 return this[_setBase].remove(value); |
| 404 } |
| 405 removeAll(elements) { |
| 406 this[_setBase].removeAll(elements); |
| 407 } |
| 408 removeWhere(test) { |
| 409 dart.as(test, dart.functionType(core.bool, [E])); |
| 410 this[_setBase].removeWhere(test); |
| 411 } |
| 412 retainAll(elements) { |
| 413 this[_setBase].retainAll(elements); |
| 414 } |
| 415 retainWhere(test) { |
| 416 dart.as(test, dart.functionType(core.bool, [E])); |
| 417 this[_setBase].retainWhere(test); |
| 418 } |
| 419 union(other) { |
| 420 dart.as(other, core.Set$(E)); |
| 421 return this[_setBase].union(other); |
| 422 } |
| 423 toSet() { |
| 424 return new (DelegatingSet$(E))(this[_setBase].toSet()); |
| 425 } |
| 426 } |
| 427 DelegatingSet[dart.implements] = () => [core.Set$(E)]; |
| 428 dart.setSignature(DelegatingSet, { |
| 429 constructors: () => ({DelegatingSet: [DelegatingSet$(E), [core.Set$(E)]]})
, |
| 430 methods: () => ({ |
| 431 add: [core.bool, [E]], |
| 432 addAll: [dart.void, [core.Iterable$(E)]], |
| 433 clear: [dart.void, []], |
| 434 containsAll: [core.bool, [core.Iterable$(core.Object)]], |
| 435 difference: [core.Set$(E), [core.Set$(E)]], |
| 436 intersection: [core.Set$(E), [core.Set$(core.Object)]], |
| 437 lookup: [E, [core.Object]], |
| 438 remove: [core.bool, [core.Object]], |
| 439 removeAll: [dart.void, [core.Iterable$(core.Object)]], |
| 440 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 441 retainAll: [dart.void, [core.Iterable$(core.Object)]], |
| 442 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 443 union: [core.Set$(E), [core.Set$(E)]], |
| 444 toSet: [core.Set$(E), []] |
| 445 }) |
| 446 }); |
| 447 dart.defineExtensionMembers(DelegatingSet, ['toSet']); |
| 448 return DelegatingSet; |
| 449 }); |
| 450 const DelegatingSet = DelegatingSet$(); |
| 451 const _baseQueue = Symbol('_baseQueue'); |
| 452 const DelegatingQueue$ = dart.generic(function(E) { |
| 453 class DelegatingQueue extends DelegatingIterable$(E) { |
| 454 DelegatingQueue(queue) { |
| 455 super.DelegatingIterable(queue); |
| 456 } |
| 457 get [_baseQueue]() { |
| 458 return dart.as(this[_base], collection.Queue$(E)); |
| 459 } |
| 460 add(value) { |
| 461 dart.as(value, E); |
| 462 this[_baseQueue].add(value); |
| 463 } |
| 464 addAll(iterable) { |
| 465 dart.as(iterable, core.Iterable$(E)); |
| 466 this[_baseQueue].addAll(iterable); |
| 467 } |
| 468 addFirst(value) { |
| 469 dart.as(value, E); |
| 470 this[_baseQueue].addFirst(value); |
| 471 } |
| 472 addLast(value) { |
| 473 dart.as(value, E); |
| 474 this[_baseQueue].addLast(value); |
| 475 } |
| 476 clear() { |
| 477 this[_baseQueue].clear(); |
| 478 } |
| 479 remove(object) { |
| 480 return this[_baseQueue].remove(object); |
| 481 } |
| 482 removeWhere(test) { |
| 483 dart.as(test, dart.functionType(core.bool, [E])); |
| 484 this[_baseQueue].removeWhere(test); |
| 485 } |
| 486 retainWhere(test) { |
| 487 dart.as(test, dart.functionType(core.bool, [E])); |
| 488 this[_baseQueue].retainWhere(test); |
| 489 } |
| 490 removeFirst() { |
| 491 return this[_baseQueue].removeFirst(); |
| 492 } |
| 493 removeLast() { |
| 494 return this[_baseQueue].removeLast(); |
| 495 } |
| 496 } |
| 497 DelegatingQueue[dart.implements] = () => [collection.Queue$(E)]; |
| 498 dart.setSignature(DelegatingQueue, { |
| 499 constructors: () => ({DelegatingQueue: [DelegatingQueue$(E), [collection.Q
ueue$(E)]]}), |
| 500 methods: () => ({ |
| 501 add: [dart.void, [E]], |
| 502 addAll: [dart.void, [core.Iterable$(E)]], |
| 503 addFirst: [dart.void, [E]], |
| 504 addLast: [dart.void, [E]], |
| 505 clear: [dart.void, []], |
| 506 remove: [core.bool, [core.Object]], |
| 507 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 508 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]], |
| 509 removeFirst: [E, []], |
| 510 removeLast: [E, []] |
| 511 }) |
| 512 }); |
| 513 return DelegatingQueue; |
| 514 }); |
| 515 const DelegatingQueue = DelegatingQueue$(); |
| 516 const DelegatingMap$ = dart.generic(function(K, V) { |
| 517 class DelegatingMap extends core.Object { |
| 518 DelegatingMap(base) { |
| 519 this[_base] = base; |
| 520 } |
| 521 get(key) { |
| 522 return this[_base].get(key); |
| 523 } |
| 524 set(key, value) { |
| 525 dart.as(key, K); |
| 526 dart.as(value, V); |
| 527 this[_base].set(key, value); |
| 528 return value; |
| 529 } |
| 530 addAll(other) { |
| 531 dart.as(other, core.Map$(K, V)); |
| 532 this[_base].addAll(other); |
| 533 } |
| 534 clear() { |
| 535 this[_base].clear(); |
| 536 } |
| 537 containsKey(key) { |
| 538 return this[_base].containsKey(key); |
| 539 } |
| 540 containsValue(value) { |
| 541 return this[_base].containsValue(value); |
| 542 } |
| 543 forEach(f) { |
| 544 dart.as(f, dart.functionType(dart.void, [K, V])); |
| 545 this[_base].forEach(f); |
| 546 } |
| 547 get isEmpty() { |
| 548 return this[_base].isEmpty; |
| 549 } |
| 550 get isNotEmpty() { |
| 551 return this[_base].isNotEmpty; |
| 552 } |
| 553 get keys() { |
| 554 return this[_base].keys; |
| 555 } |
| 556 get length() { |
| 557 return this[_base].length; |
| 558 } |
| 559 putIfAbsent(key, ifAbsent) { |
| 560 dart.as(key, K); |
| 561 dart.as(ifAbsent, dart.functionType(V, [])); |
| 562 return this[_base].putIfAbsent(key, ifAbsent); |
| 563 } |
| 564 remove(key) { |
| 565 return this[_base].remove(key); |
| 566 } |
| 567 get values() { |
| 568 return this[_base].values; |
| 569 } |
| 570 toString() { |
| 571 return dart.toString(this[_base]); |
| 572 } |
| 573 } |
| 574 DelegatingMap[dart.implements] = () => [core.Map$(K, V)]; |
| 575 dart.setSignature(DelegatingMap, { |
| 576 constructors: () => ({DelegatingMap: [DelegatingMap$(K, V), [core.Map$(K,
V)]]}), |
| 577 methods: () => ({ |
| 578 get: [V, [core.Object]], |
| 579 set: [dart.void, [K, V]], |
| 580 addAll: [dart.void, [core.Map$(K, V)]], |
| 581 clear: [dart.void, []], |
| 582 containsKey: [core.bool, [core.Object]], |
| 583 containsValue: [core.bool, [core.Object]], |
| 584 forEach: [dart.void, [dart.functionType(dart.void, [K, V])]], |
| 585 putIfAbsent: [V, [K, dart.functionType(V, [])]], |
| 586 remove: [V, [core.Object]] |
| 587 }) |
| 588 }); |
| 589 return DelegatingMap; |
| 590 }); |
| 591 const DelegatingMap = DelegatingMap$(); |
| 592 const _baseMap = Symbol('_baseMap'); |
| 593 const MapKeySet$ = dart.generic(function(E) { |
| 594 class MapKeySet extends dart.mixin(_DelegatingIterableBase$(E), unmodifiable
_wrappers.UnmodifiableSetMixin$(E)) { |
| 595 MapKeySet(base) { |
| 596 this[_baseMap] = base; |
| 597 super._DelegatingIterableBase(); |
| 598 } |
| 599 get [_base]() { |
| 600 return this[_baseMap].keys; |
| 601 } |
| 602 contains(element) { |
| 603 return this[_baseMap].containsKey(element); |
| 604 } |
| 605 get isEmpty() { |
| 606 return this[_baseMap].isEmpty; |
| 607 } |
| 608 get isNotEmpty() { |
| 609 return this[_baseMap].isNotEmpty; |
| 610 } |
| 611 get length() { |
| 612 return this[_baseMap].length; |
| 613 } |
| 614 toString() { |
| 615 return `{${this[_base][dartx.join](', ')}}`; |
| 616 } |
| 617 containsAll(other) { |
| 618 return other[dartx.every](dart.bind(this, 'contains')); |
| 619 } |
| 620 difference(other) { |
| 621 dart.as(other, core.Set$(E)); |
| 622 return this.where(dart.fn(element => !dart.notNull(other.contains(elemen
t)), core.bool, [E]))[dartx.toSet](); |
| 623 } |
| 624 intersection(other) { |
| 625 return this.where(dart.bind(other, 'contains'))[dartx.toSet](); |
| 626 } |
| 627 lookup(element) { |
| 628 dart.as(element, E); |
| 629 return dart.throw(new core.UnsupportedError("MapKeySet doesn't support l
ookup().")); |
| 630 } |
| 631 union(other) { |
| 632 dart.as(other, core.Set$(E)); |
| 633 return (() => { |
| 634 let _ = this.toSet(); |
| 635 _.addAll(other); |
| 636 return _; |
| 637 })(); |
| 638 } |
| 639 } |
| 640 dart.setSignature(MapKeySet, { |
| 641 constructors: () => ({MapKeySet: [exports.MapKeySet$(E), [core.Map$(E, dar
t.dynamic)]]}), |
| 642 methods: () => ({ |
| 643 containsAll: [core.bool, [core.Iterable$(core.Object)]], |
| 644 difference: [core.Set$(E), [core.Set$(E)]], |
| 645 intersection: [core.Set$(E), [core.Set$(core.Object)]], |
| 646 lookup: [E, [E]], |
| 647 union: [core.Set$(E), [core.Set$(E)]] |
| 648 }) |
| 649 }); |
| 650 dart.defineExtensionMembers(MapKeySet, [ |
| 651 'contains', |
| 652 'toString', |
| 653 'isEmpty', |
| 654 'isNotEmpty', |
| 655 'length' |
| 656 ]); |
| 657 return MapKeySet; |
| 658 }); |
| 659 dart.defineLazyClassGeneric(exports, 'MapKeySet', {get: MapKeySet$}); |
| 660 const _keyForValue = Symbol('_keyForValue'); |
| 661 const MapValueSet$ = dart.generic(function(K, V) { |
| 662 class MapValueSet extends _DelegatingIterableBase$(V) { |
| 663 MapValueSet(base, keyForValue) { |
| 664 this[_baseMap] = base; |
| 665 this[_keyForValue] = keyForValue; |
| 666 super._DelegatingIterableBase(); |
| 667 } |
| 668 get [_base]() { |
| 669 return this[_baseMap].values; |
| 670 } |
| 671 contains(element) { |
| 672 if (element != null && !dart.is(element, V)) return false; |
| 673 return this[_baseMap].containsKey(dart.dcall(this[_keyForValue], element
)); |
| 674 } |
| 675 get isEmpty() { |
| 676 return this[_baseMap].isEmpty; |
| 677 } |
| 678 get isNotEmpty() { |
| 679 return this[_baseMap].isNotEmpty; |
| 680 } |
| 681 get length() { |
| 682 return this[_baseMap].length; |
| 683 } |
| 684 toString() { |
| 685 return dart.toString(this.toSet()); |
| 686 } |
| 687 add(value) { |
| 688 dart.as(value, V); |
| 689 let key = dart.as(dart.dcall(this[_keyForValue], value), K); |
| 690 let result = false; |
| 691 this[_baseMap].putIfAbsent(key, dart.fn(() => { |
| 692 result = true; |
| 693 return value; |
| 694 }, V, [])); |
| 695 return result; |
| 696 } |
| 697 addAll(elements) { |
| 698 dart.as(elements, core.Iterable$(V)); |
| 699 return elements[dartx.forEach](dart.bind(this, 'add')); |
| 700 } |
| 701 clear() { |
| 702 return this[_baseMap].clear(); |
| 703 } |
| 704 containsAll(other) { |
| 705 return other[dartx.every](dart.bind(this, 'contains')); |
| 706 } |
| 707 difference(other) { |
| 708 dart.as(other, core.Set$(V)); |
| 709 return this.where(dart.fn(element => !dart.notNull(other.contains(elemen
t)), core.bool, [V]))[dartx.toSet](); |
| 710 } |
| 711 intersection(other) { |
| 712 return this.where(dart.bind(other, 'contains'))[dartx.toSet](); |
| 713 } |
| 714 lookup(element) { |
| 715 return this[_baseMap].get(dart.dcall(this[_keyForValue], element)); |
| 716 } |
| 717 remove(value) { |
| 718 if (value != null && !dart.is(value, V)) return false; |
| 719 let key = dart.dcall(this[_keyForValue], value); |
| 720 if (!dart.notNull(this[_baseMap].containsKey(key))) return false; |
| 721 this[_baseMap].remove(key); |
| 722 return true; |
| 723 } |
| 724 removeAll(elements) { |
| 725 return elements[dartx.forEach](dart.bind(this, 'remove')); |
| 726 } |
| 727 removeWhere(test) { |
| 728 dart.as(test, dart.functionType(core.bool, [V])); |
| 729 let toRemove = []; |
| 730 this[_baseMap].forEach(dart.fn((key, value) => { |
| 731 dart.as(key, K); |
| 732 dart.as(value, V); |
| 733 if (dart.notNull(test(value))) toRemove[dartx.add](key); |
| 734 }, dart.void, [K, V])); |
| 735 toRemove[dartx.forEach](dart.bind(this[_baseMap], 'remove')); |
| 736 } |
| 737 retainAll(elements) { |
| 738 let valuesToRetain = core.Set$(V).identity(); |
| 739 for (let element of elements) { |
| 740 if (element != null && !dart.is(element, V)) continue; |
| 741 let key = dart.dcall(this[_keyForValue], element); |
| 742 if (!dart.notNull(this[_baseMap].containsKey(key))) continue; |
| 743 valuesToRetain.add(this[_baseMap].get(key)); |
| 744 } |
| 745 let keysToRemove = []; |
| 746 this[_baseMap].forEach(dart.fn((k, v) => { |
| 747 dart.as(k, K); |
| 748 dart.as(v, V); |
| 749 if (!dart.notNull(valuesToRetain.contains(v))) keysToRemove[dartx.add]
(k); |
| 750 }, dart.void, [K, V])); |
| 751 keysToRemove[dartx.forEach](dart.bind(this[_baseMap], 'remove')); |
| 752 } |
| 753 retainWhere(test) { |
| 754 dart.as(test, dart.functionType(core.bool, [V])); |
| 755 return this.removeWhere(dart.fn(element => !dart.notNull(test(element)),
core.bool, [V])); |
| 756 } |
| 757 union(other) { |
| 758 dart.as(other, core.Set$(V)); |
| 759 return (() => { |
| 760 let _ = this.toSet(); |
| 761 _.addAll(other); |
| 762 return _; |
| 763 })(); |
| 764 } |
| 765 } |
| 766 MapValueSet[dart.implements] = () => [core.Set$(V)]; |
| 767 dart.setSignature(MapValueSet, { |
| 768 constructors: () => ({MapValueSet: [MapValueSet$(K, V), [core.Map$(K, V),
dart.functionType(K, [V])]]}), |
| 769 methods: () => ({ |
| 770 add: [core.bool, [V]], |
| 771 addAll: [dart.void, [core.Iterable$(V)]], |
| 772 clear: [dart.void, []], |
| 773 containsAll: [core.bool, [core.Iterable$(core.Object)]], |
| 774 difference: [core.Set$(V), [core.Set$(V)]], |
| 775 intersection: [core.Set$(V), [core.Set$(core.Object)]], |
| 776 lookup: [V, [core.Object]], |
| 777 remove: [core.bool, [core.Object]], |
| 778 removeAll: [dart.void, [core.Iterable$(core.Object)]], |
| 779 removeWhere: [dart.void, [dart.functionType(core.bool, [V])]], |
| 780 retainAll: [dart.void, [core.Iterable$(core.Object)]], |
| 781 retainWhere: [dart.void, [dart.functionType(core.bool, [V])]], |
| 782 union: [core.Set$(V), [core.Set$(V)]] |
| 783 }) |
| 784 }); |
| 785 dart.defineExtensionMembers(MapValueSet, [ |
| 786 'contains', |
| 787 'toString', |
| 788 'isEmpty', |
| 789 'isNotEmpty', |
| 790 'length' |
| 791 ]); |
| 792 return MapValueSet; |
| 793 }); |
| 794 const MapValueSet = MapValueSet$(); |
| 795 // Exports: |
| 796 exports.DelegatingIterable$ = DelegatingIterable$; |
| 797 exports.DelegatingIterable = DelegatingIterable; |
| 798 exports.DelegatingList$ = DelegatingList$; |
| 799 exports.DelegatingList = DelegatingList; |
| 800 exports.DelegatingSet$ = DelegatingSet$; |
| 801 exports.DelegatingSet = DelegatingSet; |
| 802 exports.DelegatingQueue$ = DelegatingQueue$; |
| 803 exports.DelegatingQueue = DelegatingQueue; |
| 804 exports.DelegatingMap$ = DelegatingMap$; |
| 805 exports.DelegatingMap = DelegatingMap; |
| 806 exports.MapKeySet$ = MapKeySet$; |
| 807 exports.MapValueSet$ = MapValueSet$; |
| 808 exports.MapValueSet = MapValueSet; |
| 809 }); |
OLD | NEW |