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