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