| OLD | NEW |
| 1 part of dart.collection; | 1 part of dart.collection; |
| 2 typedef bool _Predicate<T>(T value); | 2 typedef bool _Predicate<T>(T value); |
| 3 class _SplayTreeNode<K> {final K key; | 3 class _SplayTreeNode<K> {final K key; |
| 4 _SplayTreeNode<K> left; | 4 _SplayTreeNode<K> left; |
| 5 _SplayTreeNode<K> right; | 5 _SplayTreeNode<K> right; |
| 6 _SplayTreeNode(K this.key); | 6 _SplayTreeNode(K this.key); |
| 7 } | 7 } |
| 8 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {V value; | 8 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {V value; |
| 9 _SplayTreeMapNode(K key, V this.value) : super(key); | 9 _SplayTreeMapNode(K key, V this.value) : super(key); |
| 10 } | 10 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (_root == null) return null; | 136 if (_root == null) return null; |
| 137 _root = _splayMax(_root); | 137 _root = _splayMax(_root); |
| 138 return _root; | 138 return _root; |
| 139 } | 139 } |
| 140 void _clear() { | 140 void _clear() { |
| 141 _root = null; | 141 _root = null; |
| 142 _count = 0; | 142 _count = 0; |
| 143 _modificationCount++; | 143 _modificationCount++; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 class _TypeTest<T> {bool test(v) => v is T; | |
| 147 } | |
| 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator
<K> _comparator; | 146 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator
<K> _comparator; |
| 149 _Predicate _validKey; | 147 _Predicate _validKey; |
| 150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x12) => DEVC$RT.cast(__x12, dynamic, DEVC$RT.type((Comparator<K>
_) { | 148 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x16) => DEVC$RT.cast(__x16, dynamic, DEVC$RT.type((Comparator<K>
_) { |
| 151 } | 149 } |
| 152 ), "CompositeCast", """line 268, column 23 of dart:collection/splay_tree.dart: "
"", __x12 is Comparator<K>, false))((compare == null) ? Comparable.compare : com
pare), _validKey = ((__x13) => DEVC$RT.cast(__x13, dynamic, DEVC$RT.type((_Predi
cate<dynamic> _) { | 150 ), "CompositeCast", """line 264, column 23 of dart:collection/splay_tree.dart: "
"", __x16 is Comparator<K>, false))((compare == null) ? Comparable.compare : com
pare), _validKey = ((__x17) => DEVC$RT.cast(__x17, dynamic, DEVC$RT.type((_Predi
cate<dynamic> _) { |
| 153 } | 151 } |
| 154 ), "CompositeCast", """line 269, column 21 of dart:collection/splay_tree.dart: "
"", __x13 is _Predicate<dynamic>, false))((isValidKey != null) ? isValidKey : ((
v) => v is K)); | 152 ), "CompositeCast", """line 265, column 21 of dart:collection/splay_tree.dart: "
"", __x17 is _Predicate<dynamic>, false))((isValidKey != null) ? isValidKey : ((
v) => v is K)); |
| 155 factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValid
Key(potentialKey)]) { | 153 factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValid
Key(potentialKey)]) { |
| 156 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); | 154 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); |
| 157 other.forEach((k, v) { | 155 other.forEach((k, v) { |
| 158 result[k] = DEVC$RT.cast(v, dynamic, V, "CompositeCast", """line 278, column 40
of dart:collection/splay_tree.dart: """, v is V, false); | 156 result[k] = DEVC$RT.cast(v, dynamic, V, "CompositeCast", """line 274, column 40
of dart:collection/splay_tree.dart: """, v is V, false); |
| 159 } | 157 } |
| 160 ); | 158 ); |
| 161 return result; | 159 return result; |
| 162 } | 160 } |
| 163 factory SplayTreeMap.fromIterable(Iterable iterable, { | 161 factory SplayTreeMap.fromIterable(Iterable iterable, { |
| 164 K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(p
otentialKey)} | 162 K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(p
otentialKey)} |
| 165 ) { | 163 ) { |
| 166 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 164 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 167 Maps._fillMapWithMappedIterable(map, iterable, key, value); | 165 Maps._fillMapWithMappedIterable(map, iterable, key, value); |
| 168 return map; | 166 return map; |
| 169 } | 167 } |
| 170 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, [int c
ompare(K key1, K key2), bool isValidKey(potentialKey)]) { | 168 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, [int c
ompare(K key1, K key2), bool isValidKey(potentialKey)]) { |
| 171 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 169 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 172 Maps._fillMapWithIterables(map, keys, values); | 170 Maps._fillMapWithIterables(map, keys, values); |
| 173 return map; | 171 return map; |
| 174 } | 172 } |
| 175 int _compare(K key1, K key2) => _comparator(key1, key2); | 173 int _compare(K key1, K key2) => _comparator(key1, key2); |
| 176 SplayTreeMap._internal(); | 174 SplayTreeMap._internal(); |
| 177 V operator [](Object key) { | 175 V operator [](Object key) { |
| 178 if (key == null) throw new ArgumentError(key); | 176 if (key == null) throw new ArgumentError(key); |
| 179 if (!_validKey(key)) return null; | 177 if (!_validKey(key)) return null; |
| 180 if (_root != null) { | 178 if (_root != null) { |
| 181 int comp = _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 331, col
umn 25 of dart:collection/splay_tree.dart: """, key is K, false)); | 179 int comp = _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 327, col
umn 25 of dart:collection/splay_tree.dart: """, key is K, false)); |
| 182 if (comp == 0) { | 180 if (comp == 0) { |
| 183 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { | 181 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { |
| 184 } | 182 } |
| 185 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 183 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 186 } | 184 } |
| 187 ), "AssignmentCast", """line 333, column 37 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 185 ), "AssignmentCast", """line 329, column 37 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 188 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 334, co
lumn 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); | 186 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 330, co
lumn 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); |
| 189 } | 187 } |
| 190 } | 188 } |
| 191 return null; | 189 return null; |
| 192 } | 190 } |
| 193 V remove(Object key) { | 191 V remove(Object key) { |
| 194 if (!_validKey(key)) return null; | 192 if (!_validKey(key)) return null; |
| 195 _SplayTreeMapNode mapRoot = ((__x14) => DEVC$RT.cast(__x14, DEVC$RT.type((_Spla
yTreeNode<dynamic> _) { | 193 _SplayTreeMapNode mapRoot = ((__x18) => DEVC$RT.cast(__x18, DEVC$RT.type((_Spla
yTreeNode<dynamic> _) { |
| 196 } | 194 } |
| 197 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 195 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 198 } | 196 } |
| 199 ), "AssignmentCast", """line 342, column 33 of dart:collection/splay_tree.dart:
""", __x14 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DEVC$RT.cast(k
ey, Object, K, "CompositeCast", """line 342, column 41 of dart:collection/splay_
tree.dart: """, key is K, false))); | 197 ), "AssignmentCast", """line 338, column 33 of dart:collection/splay_tree.dart:
""", __x18 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DEVC$RT.cast(k
ey, Object, K, "CompositeCast", """line 338, column 41 of dart:collection/splay_
tree.dart: """, key is K, false))); |
| 200 if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeC
ast", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.va
lue is V, false); | 198 if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeC
ast", """line 339, column 33 of dart:collection/splay_tree.dart: """, mapRoot.va
lue is V, false); |
| 201 return null; | 199 return null; |
| 202 } | 200 } |
| 203 void operator []=(K key, V value) { | 201 void operator []=(K key, V value) { |
| 204 if (key == null) throw new ArgumentError(key); | 202 if (key == null) throw new ArgumentError(key); |
| 205 int comp = _splay(key); | 203 int comp = _splay(key); |
| 206 if (comp == 0) { | 204 if (comp == 0) { |
| 207 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { | 205 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { |
| 208 } | 206 } |
| 209 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 207 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 210 } | 208 } |
| 211 ), "AssignmentCast", """line 353, column 35 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 209 ), "AssignmentCast", """line 349, column 35 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 212 mapRoot.value = value; | 210 mapRoot.value = value; |
| 213 return;} | 211 return;} |
| 214 _addNewRoot(new _SplayTreeMapNode<K, dynamic>(key, value), comp); | 212 _addNewRoot(new _SplayTreeMapNode<K, dynamic>(key, value), comp); |
| 215 } | 213 } |
| 216 V putIfAbsent(K key, V ifAbsent()) { | 214 V putIfAbsent(K key, V ifAbsent()) { |
| 217 if (key == null) throw new ArgumentError(key); | 215 if (key == null) throw new ArgumentError(key); |
| 218 int comp = _splay(key); | 216 int comp = _splay(key); |
| 219 if (comp == 0) { | 217 if (comp == 0) { |
| 220 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { | 218 _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K>
_) { |
| 221 } | 219 } |
| 222 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 220 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 223 } | 221 } |
| 224 ), "AssignmentCast", """line 365, column 35 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 222 ), "AssignmentCast", """line 361, column 35 of dart:collection/splay_tree.dart:
""", _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 225 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 366, co
lumn 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); | 223 return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 362, co
lumn 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); |
| 226 } | 224 } |
| 227 int modificationCount = _modificationCount; | 225 int modificationCount = _modificationCount; |
| 228 int splayCount = _splayCount; | 226 int splayCount = _splayCount; |
| 229 V value = ifAbsent(); | 227 V value = ifAbsent(); |
| 230 if (modificationCount != _modificationCount) { | 228 if (modificationCount != _modificationCount) { |
| 231 throw new ConcurrentModificationError(this); | 229 throw new ConcurrentModificationError(this); |
| 232 } | 230 } |
| 233 if (splayCount != _splayCount) { | 231 if (splayCount != _splayCount) { |
| 234 comp = _splay(key); | 232 comp = _splay(key); |
| 235 assert (comp != 0);} | 233 assert (comp != 0);} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 246 return (_root == null); | 244 return (_root == null); |
| 247 } | 245 } |
| 248 bool get isNotEmpty => !isEmpty; | 246 bool get isNotEmpty => !isEmpty; |
| 249 void forEach(void f(K key, V value)) { | 247 void forEach(void f(K key, V value)) { |
| 250 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this); | 248 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this); |
| 251 while (nodes.moveNext()) { | 249 while (nodes.moveNext()) { |
| 252 _SplayTreeMapNode<K, V> node = DEVC$RT.cast(nodes.current, DEVC$RT.type((_SplayT
reeNode<K> _) { | 250 _SplayTreeMapNode<K, V> node = DEVC$RT.cast(nodes.current, DEVC$RT.type((_SplayT
reeNode<K> _) { |
| 253 } | 251 } |
| 254 ), DEVC$RT.type((_SplayTreeMapNode<K, V> _) { | 252 ), DEVC$RT.type((_SplayTreeMapNode<K, V> _) { |
| 255 } | 253 } |
| 256 ), "CompositeCast", """line 397, column 38 of dart:collection/splay_tree.dart: "
"", nodes.current is _SplayTreeMapNode<K, V>, false); | 254 ), "CompositeCast", """line 393, column 38 of dart:collection/splay_tree.dart: "
"", nodes.current is _SplayTreeMapNode<K, V>, false); |
| 257 f(node.key, node.value); | 255 f(node.key, node.value); |
| 258 } | 256 } |
| 259 } | 257 } |
| 260 int get length { | 258 int get length { |
| 261 return _count; | 259 return _count; |
| 262 } | 260 } |
| 263 void clear() { | 261 void clear() { |
| 264 _clear(); | 262 _clear(); |
| 265 } | 263 } |
| 266 bool containsKey(Object key) { | 264 bool containsKey(Object key) { |
| 267 return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", ""
"line 411, column 37 of dart:collection/splay_tree.dart: """, key is K, false))
== 0; | 265 return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", ""
"line 407, column 37 of dart:collection/splay_tree.dart: """, key is K, false))
== 0; |
| 268 } | 266 } |
| 269 bool containsValue(Object value) { | 267 bool containsValue(Object value) { |
| 270 bool found = false; | 268 bool found = false; |
| 271 int initialSplayCount = _splayCount; | 269 int initialSplayCount = _splayCount; |
| 272 bool visit(_SplayTreeMapNode node) { | 270 bool visit(_SplayTreeMapNode node) { |
| 273 while (node != null) { | 271 while (node != null) { |
| 274 if (node.value == value) return true; | 272 if (node.value == value) return true; |
| 275 if (initialSplayCount != _splayCount) { | 273 if (initialSplayCount != _splayCount) { |
| 276 throw new ConcurrentModificationError(this); | 274 throw new ConcurrentModificationError(this); |
| 277 } | 275 } |
| 278 if (node.right != null && visit(DEVC$RT.cast(node.right, DEVC$RT.type((_SplayTr
eeNode<dynamic> _) { | 276 if (node.right != null && visit(DEVC$RT.cast(node.right, DEVC$RT.type((_SplayTr
eeNode<dynamic> _) { |
| 279 } | 277 } |
| 280 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 278 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 281 } | 279 } |
| 282 ), "ImplicitCast", """line 423, column 41 of dart:collection/splay_tree.dart: ""
", node.right is _SplayTreeMapNode<dynamic, dynamic>, true))) return true; | 280 ), "ImplicitCast", """line 419, column 41 of dart:collection/splay_tree.dart: ""
", node.right is _SplayTreeMapNode<dynamic, dynamic>, true))) return true; |
| 283 node = DEVC$RT.cast(node.left, DEVC$RT.type((_SplayTreeNode<dynamic> _) { | 281 node = DEVC$RT.cast(node.left, DEVC$RT.type((_SplayTreeNode<dynamic> _) { |
| 284 } | 282 } |
| 285 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 283 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 286 } | 284 } |
| 287 ), "ImplicitCast", """line 424, column 16 of dart:collection/splay_tree.dart: ""
", node.left is _SplayTreeMapNode<dynamic, dynamic>, true); | 285 ), "ImplicitCast", """line 420, column 16 of dart:collection/splay_tree.dart: ""
", node.left is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 288 } | 286 } |
| 289 return false; | 287 return false; |
| 290 } | 288 } |
| 291 return visit(DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { | 289 return visit(DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode<K> _) { |
| 292 } | 290 } |
| 293 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 291 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 294 } | 292 } |
| 295 ), "ImplicitCast", """line 428, column 18 of dart:collection/splay_tree.dart: ""
", _root is _SplayTreeMapNode<dynamic, dynamic>, true)); | 293 ), "ImplicitCast", """line 424, column 18 of dart:collection/splay_tree.dart: ""
", _root is _SplayTreeMapNode<dynamic, dynamic>, true)); |
| 296 } | 294 } |
| 297 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); | 295 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); |
| 298 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); | 296 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); |
| 299 String toString() { | 297 String toString() { |
| 300 return Maps.mapToString(this); | 298 return Maps.mapToString(this); |
| 301 } | 299 } |
| 302 K firstKey() { | 300 K firstKey() { |
| 303 if (_root == null) return null; | 301 if (_root == null) return null; |
| 304 return DEVC$RT.cast(_first.key, dynamic, K, "CompositeCast", """line 444, colum
n 12 of dart:collection/splay_tree.dart: """, _first.key is K, false); | 302 return DEVC$RT.cast(_first.key, dynamic, K, "CompositeCast", """line 440, colum
n 12 of dart:collection/splay_tree.dart: """, _first.key is K, false); |
| 305 } | 303 } |
| 306 K lastKey() { | 304 K lastKey() { |
| 307 if (_root == null) return null; | 305 if (_root == null) return null; |
| 308 return DEVC$RT.cast(_last.key, dynamic, K, "CompositeCast", """line 452, column
12 of dart:collection/splay_tree.dart: """, _last.key is K, false); | 306 return DEVC$RT.cast(_last.key, dynamic, K, "CompositeCast", """line 448, column
12 of dart:collection/splay_tree.dart: """, _last.key is K, false); |
| 309 } | 307 } |
| 310 K lastKeyBefore(K key) { | 308 K lastKeyBefore(K key) { |
| 311 if (key == null) throw new ArgumentError(key); | 309 if (key == null) throw new ArgumentError(key); |
| 312 if (_root == null) return null; | 310 if (_root == null) return null; |
| 313 int comp = _splay(key); | 311 int comp = _splay(key); |
| 314 if (comp < 0) return _root.key; | 312 if (comp < 0) return _root.key; |
| 315 _SplayTreeNode<K> node = _root.left; | 313 _SplayTreeNode<K> node = _root.left; |
| 316 if (node == null) return null; | 314 if (node == null) return null; |
| 317 while (node.right != null) { | 315 while (node.right != null) { |
| 318 node = node.right; | 316 node = node.right; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 345 _splayCount = tree._splayCount; | 343 _splayCount = tree._splayCount; |
| 346 if (compare < 0) { | 344 if (compare < 0) { |
| 347 _findLeftMostDescendent(tree._root.right); | 345 _findLeftMostDescendent(tree._root.right); |
| 348 } | 346 } |
| 349 else { | 347 else { |
| 350 _workList.add(tree._root); | 348 _workList.add(tree._root); |
| 351 } | 349 } |
| 352 } | 350 } |
| 353 T get current { | 351 T get current { |
| 354 if (_currentNode == null) return null; | 352 if (_currentNode == null) return null; |
| 355 return _getValue(_currentNode); | 353 return _getValue(DEVC$RT.cast(_currentNode, DEVC$RT.type((_SplayTreeNode<dynami
c> _) { |
| 354 } |
| 355 ), DEVC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 356 } |
| 357 ), "ImplicitCast", """line 544, column 22 of dart:collection/splay_tree.dart: ""
", _currentNode is _SplayTreeMapNode<dynamic, dynamic>, true)); |
| 356 } | 358 } |
| 357 void _findLeftMostDescendent(_SplayTreeNode node) { | 359 void _findLeftMostDescendent(_SplayTreeNode node) { |
| 358 while (node != null) { | 360 while (node != null) { |
| 359 _workList.add(node); | 361 _workList.add(node); |
| 360 node = node.left; | 362 node = node.left; |
| 361 } | 363 } |
| 362 } | 364 } |
| 363 void _rebuildWorkList(_SplayTreeNode currentNode) { | 365 void _rebuildWorkList(_SplayTreeNode currentNode) { |
| 364 assert (!_workList.isEmpty); _workList.clear(); | 366 assert (!_workList.isEmpty); _workList.clear(); |
| 365 if (currentNode == null) { | 367 if (currentNode == null) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 378 _currentNode = null; | 380 _currentNode = null; |
| 379 return false; | 381 return false; |
| 380 } | 382 } |
| 381 if (_tree._splayCount != _splayCount && _currentNode != null) { | 383 if (_tree._splayCount != _splayCount && _currentNode != null) { |
| 382 _rebuildWorkList(_currentNode); | 384 _rebuildWorkList(_currentNode); |
| 383 } | 385 } |
| 384 _currentNode = _workList.removeLast(); | 386 _currentNode = _workList.removeLast(); |
| 385 _findLeftMostDescendent(_currentNode.right); | 387 _findLeftMostDescendent(_currentNode.right); |
| 386 return true; | 388 return true; |
| 387 } | 389 } |
| 388 T _getValue(_SplayTreeNode node); | 390 T _getValue(_SplayTreeMapNode node); |
| 389 } | 391 } |
| 390 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng
th {_SplayTree<K> _tree; | 392 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng
th {_SplayTree<K> _tree; |
| 391 _SplayTreeKeyIterable(this._tree); | 393 _SplayTreeKeyIterable(this._tree); |
| 392 int get length => _tree._count; | 394 int get length => _tree._count; |
| 393 bool get isEmpty => _tree._count == 0; | 395 bool get isEmpty => _tree._count == 0; |
| 394 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); | 396 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); |
| 395 Set<K> toSet() { | 397 Set<K> toSet() { |
| 396 var setOrMap = _tree; | 398 var setOrMap = _tree; |
| 397 SplayTreeSet<K> set = new SplayTreeSet<K>(DEVC$RT.cast(setOrMap._comparator, dy
namic, DEVC$RT.type((__CastType15<K> _) { | 399 SplayTreeSet<K> set = new SplayTreeSet<K>(DEVC$RT.cast(setOrMap._comparator, dy
namic, DEVC$RT.type((__CastType19<K> _) { |
| 398 } | 400 } |
| 399 ), "CompositeCast", """line 613, column 29 of dart:collection/splay_tree.dart: "
"", setOrMap._comparator is __CastType15<K>, false), DEVC$RT.cast(setOrMap._vali
dKey, dynamic, __CastType18, "CompositeCast", """line 613, column 51 of dart:col
lection/splay_tree.dart: """, setOrMap._validKey is __CastType18, false)); | 401 ), "CompositeCast", """line 609, column 29 of dart:collection/splay_tree.dart: "
"", setOrMap._comparator is __CastType19<K>, false), DEVC$RT.cast(setOrMap._vali
dKey, dynamic, __CastType22, "CompositeCast", """line 609, column 51 of dart:col
lection/splay_tree.dart: """, setOrMap._validKey is __CastType22, false)); |
| 400 set._count = _tree._count; | 402 set._count = _tree._count; |
| 401 set._root = set._copyNode(_tree._root); | 403 set._root = set._copyNode(_tree._root); |
| 402 return set; | 404 return set; |
| 403 } | 405 } |
| 404 } | 406 } |
| 405 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien
tLength {SplayTreeMap<K, V> _map; | 407 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien
tLength {SplayTreeMap<K, V> _map; |
| 406 _SplayTreeValueIterable(this._map); | 408 _SplayTreeValueIterable(this._map); |
| 407 int get length => _map._count; | 409 int get length => _map._count; |
| 408 bool get isEmpty => _map._count == 0; | 410 bool get isEmpty => _map._count == 0; |
| 409 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); | 411 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); |
| 410 } | 412 } |
| 411 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter
ator(_SplayTree<K> map) : super(map); | 413 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter
ator(_SplayTree<K> map) : super(map); |
| 412 K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "Composi
teCast", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.ke
y is K, false); | 414 K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "Composi
teCast", """line 627, column 39 of dart:collection/splay_tree.dart: """, node.ke
y is K, false); |
| 413 } | 415 } |
| 414 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa
lueIterator(SplayTreeMap<K, V> map) : super(map); | 416 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa
lueIterator(SplayTreeMap<K, V> map) : super(map); |
| 415 V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "Co
mpositeCast", """line 636, column 42 of dart:collection/splay_tree.dart: """, no
de.value is V, false); | 417 V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "Co
mpositeCast", """line 632, column 42 of dart:collection/splay_tree.dart: """, no
de.value is V, false); |
| 416 } | 418 } |
| 417 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); | 419 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); |
| 418 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA
t(tree, startKey); | 420 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA
t(tree, startKey); |
| 419 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DEVC$RT.cast(node, DEVC$RT.
type((_SplayTreeNode<dynamic> _) { | 421 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DEVC$RT.cast(node, DEVC$RT.
type((_SplayTreeNode<dynamic> _) { |
| 420 } | 422 } |
| 421 ), DEVC$RT.type((_SplayTreeNode<K> _) { | 423 ), DEVC$RT.type((_SplayTreeNode<K> _) { |
| 422 } | 424 } |
| 423 ), "CompositeCast", """line 644, column 55 of dart:collection/splay_tree.dart: "
"", node is _SplayTreeNode<K>, false); | 425 ), "CompositeCast", """line 640, column 55 of dart:collection/splay_tree.dart: "
"", node is _SplayTreeNode<K>, false); |
| 424 } | 426 } |
| 425 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; | 427 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; |
| 426 _Predicate _validKey; | 428 _Predicate _validKey; |
| 427 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x20) => DEVC$RT.cast(__x20, dynamic, DEVC$RT.type((Comparator<dy
namic> _) { | 429 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x24) => DEVC$RT.cast(__x24, dynamic, DEVC$RT.type((Comparator<dy
namic> _) { |
| 428 } | 430 } |
| 429 ), "CompositeCast", """line 693, column 23 of dart:collection/splay_tree.dart: "
"", __x20 is Comparator<dynamic>, false))((compare == null) ? Comparable.compare
: compare), _validKey = ((__x21) => DEVC$RT.cast(__x21, dynamic, DEVC$RT.type((
_Predicate<dynamic> _) { | 431 ), "CompositeCast", """line 689, column 23 of dart:collection/splay_tree.dart: "
"", __x24 is Comparator<dynamic>, false))((compare == null) ? Comparable.compare
: compare), _validKey = ((__x25) => DEVC$RT.cast(__x25, dynamic, DEVC$RT.type((
_Predicate<dynamic> _) { |
| 430 } | 432 } |
| 431 ), "CompositeCast", """line 694, column 21 of dart:collection/splay_tree.dart: "
"", __x21 is _Predicate<dynamic>, false))((isValidKey != null) ? isValidKey : ((
v) => v is E)); | 433 ), "CompositeCast", """line 690, column 21 of dart:collection/splay_tree.dart: "
"", __x25 is _Predicate<dynamic>, false))((isValidKey != null) ? isValidKey : ((
v) => v is E)); |
| 432 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool
isValidKey(potentialKey)]) { | 434 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool
isValidKey(potentialKey)]) { |
| 433 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); | 435 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); |
| 434 for (final E element in DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic>
_) { | 436 for (final E element in DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic>
_) { |
| 435 } | 437 } |
| 436 ), DEVC$RT.type((Iterable<E> _) { | 438 ), DEVC$RT.type((Iterable<E> _) { |
| 437 } | 439 } |
| 438 ), "CompositeCast", """line 707, column 29 of dart:collection/splay_tree.dart: "
"", elements is Iterable<E>, false)) { | 440 ), "CompositeCast", """line 703, column 29 of dart:collection/splay_tree.dart: "
"", elements is Iterable<E>, false)) { |
| 439 result.add(element); | 441 result.add(element); |
| 440 } | 442 } |
| 441 return result; | 443 return result; |
| 442 } | 444 } |
| 443 int _compare(E e1, E e2) => _comparator(e1, e2); | 445 int _compare(E e1, E e2) => _comparator(e1, e2); |
| 444 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); | 446 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); |
| 445 int get length => _count; | 447 int get length => _count; |
| 446 bool get isEmpty => _root == null; | 448 bool get isEmpty => _root == null; |
| 447 bool get isNotEmpty => _root != null; | 449 bool get isNotEmpty => _root != null; |
| 448 E get first { | 450 E get first { |
| 449 if (_count == 0) throw IterableElementError.noElement(); | 451 if (_count == 0) throw IterableElementError.noElement(); |
| 450 return DEVC$RT.cast(_first.key, dynamic, E, "CompositeCast", """line 725, colum
n 12 of dart:collection/splay_tree.dart: """, _first.key is E, false); | 452 return DEVC$RT.cast(_first.key, dynamic, E, "CompositeCast", """line 721, colum
n 12 of dart:collection/splay_tree.dart: """, _first.key is E, false); |
| 451 } | 453 } |
| 452 E get last { | 454 E get last { |
| 453 if (_count == 0) throw IterableElementError.noElement(); | 455 if (_count == 0) throw IterableElementError.noElement(); |
| 454 return DEVC$RT.cast(_last.key, dynamic, E, "CompositeCast", """line 730, column
12 of dart:collection/splay_tree.dart: """, _last.key is E, false); | 456 return DEVC$RT.cast(_last.key, dynamic, E, "CompositeCast", """line 726, column
12 of dart:collection/splay_tree.dart: """, _last.key is E, false); |
| 455 } | 457 } |
| 456 E get single { | 458 E get single { |
| 457 if (_count == 0) throw IterableElementError.noElement(); | 459 if (_count == 0) throw IterableElementError.noElement(); |
| 458 if (_count > 1) throw IterableElementError.tooMany(); | 460 if (_count > 1) throw IterableElementError.tooMany(); |
| 459 return _root.key; | 461 return _root.key; |
| 460 } | 462 } |
| 461 bool contains(Object object) { | 463 bool contains(Object object) { |
| 462 return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCas
t", """line 741, column 40 of dart:collection/splay_tree.dart: """, object is E,
false)) == 0; | 464 return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCas
t", """line 737, column 40 of dart:collection/splay_tree.dart: """, object is E,
false)) == 0; |
| 463 } | 465 } |
| 464 bool add(E element) { | 466 bool add(E element) { |
| 465 int compare = _splay(element); | 467 int compare = _splay(element); |
| 466 if (compare == 0) return false; | 468 if (compare == 0) return false; |
| 467 _addNewRoot(new _SplayTreeNode<E>(element), compare); | 469 _addNewRoot(new _SplayTreeNode<E>(element), compare); |
| 468 return true; | 470 return true; |
| 469 } | 471 } |
| 470 bool remove(Object object) { | 472 bool remove(Object object) { |
| 471 if (!_validKey(object)) return false; | 473 if (!_validKey(object)) return false; |
| 472 return _remove(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 753, co
lumn 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; | 474 return _remove(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 749, co
lumn 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; |
| 473 } | 475 } |
| 474 void addAll(Iterable<E> elements) { | 476 void addAll(Iterable<E> elements) { |
| 475 for (E element in elements) { | 477 for (E element in elements) { |
| 476 int compare = _splay(element); | 478 int compare = _splay(element); |
| 477 if (compare != 0) { | 479 if (compare != 0) { |
| 478 _addNewRoot(new _SplayTreeNode<E>(element), compare); | 480 _addNewRoot(new _SplayTreeNode<E>(element), compare); |
| 479 } | 481 } |
| 480 } | 482 } |
| 481 } | 483 } |
| 482 void removeAll(Iterable<Object> elements) { | 484 void removeAll(Iterable<Object> elements) { |
| 483 for (Object element in elements) { | 485 for (Object element in elements) { |
| 484 if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CompositeCast"
, """line 767, column 39 of dart:collection/splay_tree.dart: """, element is E,
false)); | 486 if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CompositeCast"
, """line 763, column 39 of dart:collection/splay_tree.dart: """, element is E,
false)); |
| 485 } | 487 } |
| 486 } | 488 } |
| 487 void retainAll(Iterable<Object> elements) { | 489 void retainAll(Iterable<Object> elements) { |
| 488 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$R
T.type((Comparator<dynamic> _) { | 490 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$R
T.type((Comparator<dynamic> _) { |
| 489 } | 491 } |
| 490 ), DEVC$RT.type((__CastType22<E> _) { | 492 ), DEVC$RT.type((__CastType26<E> _) { |
| 491 } | 493 } |
| 492 ), "CompositeCast", """line 773, column 53 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType22<E>, false), _validKey); | 494 ), "CompositeCast", """line 769, column 53 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType26<E>, false), _validKey); |
| 493 int modificationCount = _modificationCount; | 495 int modificationCount = _modificationCount; |
| 494 for (Object object in elements) { | 496 for (Object object in elements) { |
| 495 if (modificationCount != _modificationCount) { | 497 if (modificationCount != _modificationCount) { |
| 496 throw new ConcurrentModificationError(this); | 498 throw new ConcurrentModificationError(this); |
| 497 } | 499 } |
| 498 if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast"
, """line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, f
alse)) == 0) retainSet.add(_root.key); | 500 if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast"
, """line 777, column 39 of dart:collection/splay_tree.dart: """, object is E, f
alse)) == 0) retainSet.add(_root.key); |
| 499 } | 501 } |
| 500 if (retainSet._count != _count) { | 502 if (retainSet._count != _count) { |
| 501 _root = retainSet._root; | 503 _root = retainSet._root; |
| 502 _count = retainSet._count; | 504 _count = retainSet._count; |
| 503 _modificationCount++; | 505 _modificationCount++; |
| 504 } | 506 } |
| 505 } | 507 } |
| 506 E lookup(Object object) { | 508 E lookup(Object object) { |
| 507 if (!_validKey(object)) return null; | 509 if (!_validKey(object)) return null; |
| 508 int comp = _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 793,
column 23 of dart:collection/splay_tree.dart: """, object is E, false)); | 510 int comp = _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 789,
column 23 of dart:collection/splay_tree.dart: """, object is E, false)); |
| 509 if (comp != 0) return null; | 511 if (comp != 0) return null; |
| 510 return _root.key; | 512 return _root.key; |
| 511 } | 513 } |
| 512 Set<E> intersection(Set<E> other) { | 514 Set<E> intersection(Set<Object> other) { |
| 513 Set<E> result = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comp
arator<dynamic> _) { | 515 Set<E> result = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comp
arator<dynamic> _) { |
| 514 } | 516 } |
| 515 ), DEVC$RT.type((__CastType22<E> _) { | 517 ), DEVC$RT.type((__CastType26<E> _) { |
| 516 } | 518 } |
| 517 ), "CompositeCast", """line 799, column 41 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType22<E>, false), _validKey); | 519 ), "CompositeCast", """line 795, column 41 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType26<E>, false), _validKey); |
| 518 for (E element in this) { | 520 for (E element in this) { |
| 519 if (other.contains(element)) result.add(element); | 521 if (other.contains(element)) result.add(element); |
| 520 } | 522 } |
| 521 return result; | 523 return result; |
| 522 } | 524 } |
| 523 Set<E> difference(Set<E> other) { | 525 Set<E> difference(Set<Object> other) { |
| 524 Set<E> result = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comp
arator<dynamic> _) { | 526 Set<E> result = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comp
arator<dynamic> _) { |
| 525 } | 527 } |
| 526 ), DEVC$RT.type((__CastType22<E> _) { | 528 ), DEVC$RT.type((__CastType26<E> _) { |
| 527 } | 529 } |
| 528 ), "CompositeCast", """line 807, column 41 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType22<E>, false), _validKey); | 530 ), "CompositeCast", """line 803, column 41 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType26<E>, false), _validKey); |
| 529 for (E element in this) { | 531 for (E element in this) { |
| 530 if (!other.contains(element)) result.add(element); | 532 if (!other.contains(element)) result.add(element); |
| 531 } | 533 } |
| 532 return result; | 534 return result; |
| 533 } | 535 } |
| 534 Set<E> union(Set<E> other) { | 536 Set<E> union(Set<E> other) { |
| 535 return _clone()..addAll(other); | 537 return _clone()..addAll(other); |
| 536 } | 538 } |
| 537 SplayTreeSet<E> _clone() { | 539 SplayTreeSet<E> _clone() { |
| 538 var set = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator
<dynamic> _) { | 540 var set = new SplayTreeSet<E>(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator
<dynamic> _) { |
| 539 } | 541 } |
| 540 ), DEVC$RT.type((__CastType22<E> _) { | 542 ), DEVC$RT.type((__CastType26<E> _) { |
| 541 } | 543 } |
| 542 ), "CompositeCast", """line 819, column 35 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType22<E>, false), _validKey); | 544 ), "CompositeCast", """line 815, column 35 of dart:collection/splay_tree.dart: "
"", _comparator is __CastType26<E>, false), _validKey); |
| 543 set._count = _count; | 545 set._count = _count; |
| 544 set._root = _copyNode(_root); | 546 set._root = _copyNode(_root); |
| 545 return set; | 547 return set; |
| 546 } | 548 } |
| 547 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { | 549 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { |
| 548 if (node == null) return null; | 550 if (node == null) return null; |
| 549 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); | 551 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); |
| 550 } | 552 } |
| 551 void clear() { | 553 void clear() { |
| 552 _clear(); | 554 _clear(); |
| 553 } | 555 } |
| 554 Set<E> toSet() => _clone(); | 556 Set<E> toSet() => _clone(); |
| 555 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | 557 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
| 556 } | 558 } |
| 557 typedef int __CastType15<K>(K __u16, K __u17); | 559 typedef int __CastType19<K>(K __u20, K __u21); |
| 558 typedef bool __CastType18(dynamic __u19); | 560 typedef bool __CastType22(dynamic __u23); |
| 559 typedef int __CastType22<E>(E __u23, E __u24); | 561 typedef int __CastType26<E>(E __u27, E __u28); |
| OLD | NEW |