| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 146 class _TypeTest<T> {bool test(v) => v is T; |
| 147 } | 147 } |
| 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator
<K> _comparator; | 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator
<K> _comparator; |
| 149 _Predicate _validKey; | 149 _Predicate _validKey; |
| 150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c
omparator = (compare == null) ? Comparable.compare : compare, _validKey = (isVal
idKey != null) ? isValidKey : ((v) => v is K); | 150 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x48) => DDC$RT.cast(__x48, dynamic, DDC$RT.type((__t45<K> _) { |
| 151 } |
| 152 ), "CastGeneral", """line 268, column 23 of dart:collection/splay_tree.dart: """
, __x48 is __t45<K>, false))((compare == null) ? Comparable.compare : compare),
_validKey = ((__x51) => DDC$RT.cast(__x51, dynamic, __t49, "CastGeneral", """lin
e 269, column 21 of dart:collection/splay_tree.dart: """, __x51 is __t49, false)
)((isValidKey != null) ? isValidKey : ((v) => v is K)); |
| 151 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)]) { |
| 152 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); | 154 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); |
| 153 other.forEach((k, v) { | 155 other.forEach((k, v) { |
| 154 result[k] = DDC$RT.cast(v, dynamic, V, "CastGeneral", """line 278, column 40 of
dart:collection/splay_tree.dart: """, v is V, false); | 156 result[k] = DDC$RT.cast(v, dynamic, V, "CastGeneral", """line 278, column 40 of
dart:collection/splay_tree.dart: """, v is V, false); |
| 155 } | 157 } |
| 156 ); | 158 ); |
| 157 return result; | 159 return result; |
| 158 } | 160 } |
| 159 factory SplayTreeMap.fromIterable(Iterable iterable, { | 161 factory SplayTreeMap.fromIterable(Iterable iterable, { |
| 160 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)} |
| 161 ) { | 163 ) { |
| 162 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 164 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 163 Maps._fillMapWithMappedIterable(map, iterable, key, value); | 165 Maps._fillMapWithMappedIterable(map, iterable, key, value); |
| 164 return map; | 166 return map; |
| 165 } | 167 } |
| 166 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)]) { |
| 167 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 169 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 168 Maps._fillMapWithIterables(map, keys, values); | 170 Maps._fillMapWithIterables(map, keys, values); |
| 169 return map; | 171 return map; |
| 170 } | 172 } |
| 171 int _compare(K key1, K key2) => _comparator(key1, key2); | 173 int _compare(K key1, K key2) => _comparator(key1, key2); |
| 172 SplayTreeMap._internal(); | 174 SplayTreeMap._internal(); |
| 173 V operator [](Object key) { | 175 V operator [](Object key) { |
| 174 if (key == null) throw new ArgumentError(key); | 176 if (key == null) throw new ArgumentError(key); |
| 175 if (!_validKey(key)) return ((__x45) => DDC$RT.cast(__x45, Null, V, "CastLitera
l", """line 329, column 33 of dart:collection/splay_tree.dart: """, __x45 is V,
false))(null); | 177 if (!_validKey(key)) return ((__x52) => DDC$RT.cast(__x52, Null, V, "CastLitera
l", """line 329, column 33 of dart:collection/splay_tree.dart: """, __x52 is V,
false))(null); |
| 176 if (_root != null) { | 178 if (_root != null) { |
| 177 int comp = _splay(DDC$RT.cast(key, Object, K, "CastGeneral", """line 331, column
25 of dart:collection/splay_tree.dart: """, key is K, false)); | 179 int comp = _splay(DDC$RT.cast(key, Object, K, "CastGeneral", """line 331, column
25 of dart:collection/splay_tree.dart: """, key is K, false)); |
| 178 if (comp == 0) { | 180 if (comp == 0) { |
| 179 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ | 181 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 180 } | 182 } |
| 181 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 183 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 182 } | 184 } |
| 183 ), "CastGeneral", """line 333, column 37 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 185 ), "CastGeneral", """line 333, column 37 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 184 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 334, colum
n 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); | 186 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 334, colum
n 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 return ((__x46) => DDC$RT.cast(__x46, Null, V, "CastLiteral", """line 337, colu
mn 12 of dart:collection/splay_tree.dart: """, __x46 is V, false))(null); | 189 return ((__x53) => DDC$RT.cast(__x53, Null, V, "CastLiteral", """line 337, colu
mn 12 of dart:collection/splay_tree.dart: """, __x53 is V, false))(null); |
| 188 } | 190 } |
| 189 V remove(Object key) { | 191 V remove(Object key) { |
| 190 if (!_validKey(key)) return ((__x47) => DDC$RT.cast(__x47, Null, V, "CastLiteral
", """line 341, column 33 of dart:collection/splay_tree.dart: """, __x47 is V, f
alse))(null); | 192 if (!_validKey(key)) return ((__x54) => DDC$RT.cast(__x54, Null, V, "CastLiteral
", """line 341, column 33 of dart:collection/splay_tree.dart: """, __x54 is V, f
alse))(null); |
| 191 _SplayTreeMapNode mapRoot = ((__x48) => DDC$RT.cast(__x48, DDC$RT.type((_SplayT
reeNode<dynamic> _) { | 193 _SplayTreeMapNode mapRoot = ((__x55) => DDC$RT.cast(__x55, DDC$RT.type((_SplayT
reeNode<dynamic> _) { |
| 192 } | 194 } |
| 193 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 195 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 194 } | 196 } |
| 195 ), "CastGeneral", """line 342, column 33 of dart:collection/splay_tree.dart: """
, __x48 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DDC$RT.cast(key,
Object, K, "CastGeneral", """line 342, column 41 of dart:collection/splay_tree.d
art: """, key is K, false))); | 197 ), "CastGeneral", """line 342, column 33 of dart:collection/splay_tree.dart: """
, __x55 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DDC$RT.cast(key,
Object, K, "CastGeneral", """line 342, column 41 of dart:collection/splay_tree.d
art: """, key is K, false))); |
| 196 if (mapRoot != null) return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral
", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value
is V, false); | 198 if (mapRoot != null) return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral
", """line 343, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value
is V, false); |
| 197 return ((__x49) => DDC$RT.cast(__x49, Null, V, "CastLiteral", """line 344, colu
mn 12 of dart:collection/splay_tree.dart: """, __x49 is V, false))(null); | 199 return ((__x56) => DDC$RT.cast(__x56, Null, V, "CastLiteral", """line 344, colu
mn 12 of dart:collection/splay_tree.dart: """, __x56 is V, false))(null); |
| 198 } | 200 } |
| 199 void operator []=(K key, V value) { | 201 void operator []=(K key, V value) { |
| 200 if (key == null) throw new ArgumentError(key); | 202 if (key == null) throw new ArgumentError(key); |
| 201 int comp = _splay(key); | 203 int comp = _splay(key); |
| 202 if (comp == 0) { | 204 if (comp == 0) { |
| 203 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ | 205 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 204 } | 206 } |
| 205 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 207 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 206 } | 208 } |
| 207 ), "CastGeneral", """line 353, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 209 ), "CastGeneral", """line 353, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 208 mapRoot.value = value; | 210 mapRoot.value = value; |
| 209 return;} | 211 return;} |
| 210 _addNewRoot(((__x50) => DDC$RT.cast(__x50, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { | 212 _addNewRoot(((__x57) => DDC$RT.cast(__x57, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { |
| 211 } | 213 } |
| 212 ), DDC$RT.type((_SplayTreeNode<K> _) { | 214 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 213 } | 215 } |
| 214 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """,
__x50 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); | 216 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """,
__x57 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); |
| 215 } | 217 } |
| 216 V putIfAbsent(K key, V ifAbsent()) { | 218 V putIfAbsent(K key, V ifAbsent()) { |
| 217 if (key == null) throw new ArgumentError(key); | 219 if (key == null) throw new ArgumentError(key); |
| 218 int comp = _splay(key); | 220 int comp = _splay(key); |
| 219 if (comp == 0) { | 221 if (comp == 0) { |
| 220 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ | 222 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 221 } | 223 } |
| 222 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 224 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 223 } | 225 } |
| 224 ), "CastGeneral", """line 365, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 226 ), "CastGeneral", """line 365, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 225 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 366, colum
n 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); | 227 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", """line 366, colum
n 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); |
| 226 } | 228 } |
| 227 int modificationCount = _modificationCount; | 229 int modificationCount = _modificationCount; |
| 228 int splayCount = _splayCount; | 230 int splayCount = _splayCount; |
| 229 V value = ifAbsent(); | 231 V value = ifAbsent(); |
| 230 if (modificationCount != _modificationCount) { | 232 if (modificationCount != _modificationCount) { |
| 231 throw new ConcurrentModificationError(this); | 233 throw new ConcurrentModificationError(this); |
| 232 } | 234 } |
| 233 if (splayCount != _splayCount) { | 235 if (splayCount != _splayCount) { |
| 234 comp = _splay(key); | 236 comp = _splay(key); |
| 235 assert (comp != 0);} | 237 assert (comp != 0);} |
| 236 _addNewRoot(((__x51) => DDC$RT.cast(__x51, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { | 238 _addNewRoot(((__x58) => DDC$RT.cast(__x58, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { |
| 237 } | 239 } |
| 238 ), DDC$RT.type((_SplayTreeNode<K> _) { | 240 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 239 } | 241 } |
| 240 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """,
__x51 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); | 242 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """,
__x58 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); |
| 241 return value; | 243 return value; |
| 242 } | 244 } |
| 243 void addAll(Map<K, V> other) { | 245 void addAll(Map<K, V> other) { |
| 244 other.forEach((K key, V value) { | 246 other.forEach((K key, V value) { |
| 245 this[key] = value; | 247 this[key] = value; |
| 246 } | 248 } |
| 247 ); | 249 ); |
| 248 } | 250 } |
| 249 bool get isEmpty { | 251 bool get isEmpty { |
| 250 return (_root == null); | 252 return (_root == null); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { | 299 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 298 } | 300 } |
| 299 ), "CastGeneral", """line 428, column 18 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true)); | 301 ), "CastGeneral", """line 428, column 18 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true)); |
| 300 } | 302 } |
| 301 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); | 303 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); |
| 302 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); | 304 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); |
| 303 String toString() { | 305 String toString() { |
| 304 return Maps.mapToString(this); | 306 return Maps.mapToString(this); |
| 305 } | 307 } |
| 306 K firstKey() { | 308 K firstKey() { |
| 307 if (_root == null) return ((__x52) => DDC$RT.cast(__x52, Null, K, "CastLiteral",
"""line 443, column 31 of dart:collection/splay_tree.dart: """, __x52 is K, fal
se))(null); | 309 if (_root == null) return ((__x59) => DDC$RT.cast(__x59, Null, K, "CastLiteral",
"""line 443, column 31 of dart:collection/splay_tree.dart: """, __x59 is K, fal
se))(null); |
| 308 return DDC$RT.cast(_first.key, dynamic, K, "CastGeneral", """line 444, column 1
2 of dart:collection/splay_tree.dart: """, _first.key is K, false); | 310 return DDC$RT.cast(_first.key, dynamic, K, "CastGeneral", """line 444, column 1
2 of dart:collection/splay_tree.dart: """, _first.key is K, false); |
| 309 } | 311 } |
| 310 K lastKey() { | 312 K lastKey() { |
| 311 if (_root == null) return ((__x53) => DDC$RT.cast(__x53, Null, K, "CastLiteral",
"""line 451, column 31 of dart:collection/splay_tree.dart: """, __x53 is K, fal
se))(null); | 313 if (_root == null) return ((__x60) => DDC$RT.cast(__x60, Null, K, "CastLiteral",
"""line 451, column 31 of dart:collection/splay_tree.dart: """, __x60 is K, fal
se))(null); |
| 312 return DDC$RT.cast(_last.key, dynamic, K, "CastGeneral", """line 452, column 12
of dart:collection/splay_tree.dart: """, _last.key is K, false); | 314 return DDC$RT.cast(_last.key, dynamic, K, "CastGeneral", """line 452, column 12
of dart:collection/splay_tree.dart: """, _last.key is K, false); |
| 313 } | 315 } |
| 314 K lastKeyBefore(K key) { | 316 K lastKeyBefore(K key) { |
| 315 if (key == null) throw new ArgumentError(key); | 317 if (key == null) throw new ArgumentError(key); |
| 316 if (_root == null) return ((__x54) => DDC$RT.cast(__x54, Null, K, "CastLiteral"
, """line 461, column 31 of dart:collection/splay_tree.dart: """, __x54 is K, fa
lse))(null); | 318 if (_root == null) return ((__x61) => DDC$RT.cast(__x61, Null, K, "CastLiteral"
, """line 461, column 31 of dart:collection/splay_tree.dart: """, __x61 is K, fa
lse))(null); |
| 317 int comp = _splay(key); | 319 int comp = _splay(key); |
| 318 if (comp < 0) return _root.key; | 320 if (comp < 0) return _root.key; |
| 319 _SplayTreeNode<K> node = _root.left; | 321 _SplayTreeNode<K> node = _root.left; |
| 320 if (node == null) return ((__x55) => DDC$RT.cast(__x55, Null, K, "CastLiteral",
"""line 465, column 30 of dart:collection/splay_tree.dart: """, __x55 is K, fal
se))(null); | 322 if (node == null) return ((__x62) => DDC$RT.cast(__x62, Null, K, "CastLiteral",
"""line 465, column 30 of dart:collection/splay_tree.dart: """, __x62 is K, fal
se))(null); |
| 321 while (node.right != null) { | 323 while (node.right != null) { |
| 322 node = node.right; | 324 node = node.right; |
| 323 } | 325 } |
| 324 return node.key; | 326 return node.key; |
| 325 } | 327 } |
| 326 K firstKeyAfter(K key) { | 328 K firstKeyAfter(K key) { |
| 327 if (key == null) throw new ArgumentError(key); | 329 if (key == null) throw new ArgumentError(key); |
| 328 if (_root == null) return ((__x56) => DDC$RT.cast(__x56, Null, K, "CastLiteral"
, """line 478, column 31 of dart:collection/splay_tree.dart: """, __x56 is K, fa
lse))(null); | 330 if (_root == null) return ((__x63) => DDC$RT.cast(__x63, Null, K, "CastLiteral"
, """line 478, column 31 of dart:collection/splay_tree.dart: """, __x63 is K, fa
lse))(null); |
| 329 int comp = _splay(key); | 331 int comp = _splay(key); |
| 330 if (comp > 0) return _root.key; | 332 if (comp > 0) return _root.key; |
| 331 _SplayTreeNode<K> node = _root.right; | 333 _SplayTreeNode<K> node = _root.right; |
| 332 if (node == null) return ((__x57) => DDC$RT.cast(__x57, Null, K, "CastLiteral",
"""line 482, column 30 of dart:collection/splay_tree.dart: """, __x57 is K, fal
se))(null); | 334 if (node == null) return ((__x64) => DDC$RT.cast(__x64, Null, K, "CastLiteral",
"""line 482, column 30 of dart:collection/splay_tree.dart: """, __x64 is K, fal
se))(null); |
| 333 while (node.left != null) { | 335 while (node.left != null) { |
| 334 node = node.left; | 336 node = node.left; |
| 335 } | 337 } |
| 336 return node.key; | 338 return node.key; |
| 337 } | 339 } |
| 338 } | 340 } |
| 339 abstract class _SplayTreeIterator<T> implements Iterator<T> {final _SplayTree _
tree; | 341 abstract class _SplayTreeIterator<T> implements Iterator<T> {final _SplayTree _
tree; |
| 340 final List<_SplayTreeNode> _workList = <_SplayTreeNode> []; | 342 final List<_SplayTreeNode> _workList = <_SplayTreeNode> []; |
| 341 int _modificationCount; | 343 int _modificationCount; |
| 342 int _splayCount; | 344 int _splayCount; |
| 343 _SplayTreeNode _currentNode; | 345 _SplayTreeNode _currentNode; |
| 344 _SplayTreeIterator(_SplayTree tree) : _tree = tree, _modificationCount = tree._
modificationCount, _splayCount = tree._splayCount { | 346 _SplayTreeIterator(_SplayTree tree) : _tree = tree, _modificationCount = tree._
modificationCount, _splayCount = tree._splayCount { |
| 345 _findLeftMostDescendent(tree._root); | 347 _findLeftMostDescendent(tree._root); |
| 346 } | 348 } |
| 347 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) : _tree = tree, _modi
ficationCount = tree._modificationCount { | 349 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) : _tree = tree, _modi
ficationCount = tree._modificationCount { |
| 348 if (tree._root == null) return; int compare = tree._splay(startKey); | 350 if (tree._root == null) return; int compare = tree._splay(startKey); |
| 349 _splayCount = tree._splayCount; | 351 _splayCount = tree._splayCount; |
| 350 if (compare < 0) { | 352 if (compare < 0) { |
| 351 _findLeftMostDescendent(tree._root.right); | 353 _findLeftMostDescendent(tree._root.right); |
| 352 } | 354 } |
| 353 else { | 355 else { |
| 354 _workList.add(tree._root); | 356 _workList.add(tree._root); |
| 355 } | 357 } |
| 356 } | 358 } |
| 357 T get current { | 359 T get current { |
| 358 if (_currentNode == null) return ((__x58) => DDC$RT.cast(__x58, Null, T, "CastLi
teral", """line 547, column 38 of dart:collection/splay_tree.dart: """, __x58 is
T, false))(null); | 360 if (_currentNode == null) return ((__x65) => DDC$RT.cast(__x65, Null, T, "CastLi
teral", """line 547, column 38 of dart:collection/splay_tree.dart: """, __x65 is
T, false))(null); |
| 359 return _getValue(_currentNode); | 361 return _getValue(_currentNode); |
| 360 } | 362 } |
| 361 void _findLeftMostDescendent(_SplayTreeNode node) { | 363 void _findLeftMostDescendent(_SplayTreeNode node) { |
| 362 while (node != null) { | 364 while (node != null) { |
| 363 _workList.add(node); | 365 _workList.add(node); |
| 364 node = node.left; | 366 node = node.left; |
| 365 } | 367 } |
| 366 } | 368 } |
| 367 void _rebuildWorkList(_SplayTreeNode currentNode) { | 369 void _rebuildWorkList(_SplayTreeNode currentNode) { |
| 368 assert (!_workList.isEmpty); _workList.clear(); | 370 assert (!_workList.isEmpty); _workList.clear(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); | 421 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); |
| 420 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA
t(tree, startKey); | 422 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA
t(tree, startKey); |
| 421 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, DDC$RT.ty
pe((_SplayTreeNode<dynamic> _) { | 423 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, DDC$RT.ty
pe((_SplayTreeNode<dynamic> _) { |
| 422 } | 424 } |
| 423 ), DDC$RT.type((_SplayTreeNode<K> _) { | 425 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 424 } | 426 } |
| 425 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """
, node is _SplayTreeNode<K>, false); | 427 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """
, node is _SplayTreeNode<K>, false); |
| 426 } | 428 } |
| 427 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; | 429 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; |
| 428 _Predicate _validKey; | 430 _Predicate _validKey; |
| 429 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c
omparator = (compare == null) ? Comparable.compare : compare, _validKey = (isVal
idKey != null) ? isValidKey : ((v) => v is E); | 431 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x69) => DDC$RT.cast(__x69, dynamic, __t66, "CastGeneral", """lin
e 693, column 23 of dart:collection/splay_tree.dart: """, __x69 is __t66, false)
)((compare == null) ? Comparable.compare : compare), _validKey = ((__x70) => DDC
$RT.cast(__x70, dynamic, __t49, "CastGeneral", """line 694, column 21 of dart:co
llection/splay_tree.dart: """, __x70 is __t49, false))((isValidKey != null) ? is
ValidKey : ((v) => v is E)); |
| 430 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool
isValidKey(potentialKey)]) { | 432 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool
isValidKey(potentialKey)]) { |
| 431 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); | 433 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); |
| 432 for (final E element in elements) { | 434 for (final E element in elements) { |
| 433 result.add(element); | 435 result.add(element); |
| 434 } | 436 } |
| 435 return result; | 437 return result; |
| 436 } | 438 } |
| 437 int _compare(E e1, E e2) => _comparator(e1, e2); | 439 int _compare(E e1, E e2) => _comparator(e1, e2); |
| 438 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); | 440 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); |
| 439 int get length => _count; | 441 int get length => _count; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 451 if (_count == 0) throw IterableElementError.noElement(); | 453 if (_count == 0) throw IterableElementError.noElement(); |
| 452 if (_count > 1) throw IterableElementError.tooMany(); | 454 if (_count > 1) throw IterableElementError.tooMany(); |
| 453 return _root.key; | 455 return _root.key; |
| 454 } | 456 } |
| 455 bool contains(Object object) { | 457 bool contains(Object object) { |
| 456 return _validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral",
"""line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, fa
lse)) == 0; | 458 return _validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral",
"""line 741, column 40 of dart:collection/splay_tree.dart: """, object is E, fa
lse)) == 0; |
| 457 } | 459 } |
| 458 bool add(E element) { | 460 bool add(E element) { |
| 459 int compare = _splay(element); | 461 int compare = _splay(element); |
| 460 if (compare == 0) return false; | 462 if (compare == 0) return false; |
| 461 _addNewRoot(((__x59) => DDC$RT.cast(__x59, DDC$RT.type((_SplayTreeNode<dynamic>
_) { | 463 _addNewRoot(((__x71) => DDC$RT.cast(__x71, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 462 } | 464 } |
| 463 ), DDC$RT.type((_SplayTreeNode<E> _) { | 465 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 464 } | 466 } |
| 465 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """,
__x59 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); | 467 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """,
__x71 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 466 return true; | 468 return true; |
| 467 } | 469 } |
| 468 bool remove(Object object) { | 470 bool remove(Object object) { |
| 469 if (!_validKey(object)) return false; | 471 if (!_validKey(object)) return false; |
| 470 return _remove(DDC$RT.cast(object, Object, E, "CastGeneral", """line 753, colum
n 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; | 472 return _remove(DDC$RT.cast(object, Object, E, "CastGeneral", """line 753, colum
n 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; |
| 471 } | 473 } |
| 472 void addAll(Iterable<E> elements) { | 474 void addAll(Iterable<E> elements) { |
| 473 for (E element in elements) { | 475 for (E element in elements) { |
| 474 int compare = _splay(element); | 476 int compare = _splay(element); |
| 475 if (compare != 0) { | 477 if (compare != 0) { |
| 476 _addNewRoot(((__x60) => DDC$RT.cast(__x60, DDC$RT.type((_SplayTreeNode<dynamic>
_) { | 478 _addNewRoot(((__x72) => DDC$RT.cast(__x72, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 477 } | 479 } |
| 478 ), DDC$RT.type((_SplayTreeNode<E> _) { | 480 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 479 } | 481 } |
| 480 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """,
__x60 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); | 482 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """,
__x72 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 481 } | 483 } |
| 482 } | 484 } |
| 483 } | 485 } |
| 484 void removeAll(Iterable<Object> elements) { | 486 void removeAll(Iterable<Object> elements) { |
| 485 for (Object element in elements) { | 487 for (Object element in elements) { |
| 486 if (_validKey(element)) _remove(DDC$RT.cast(element, Object, E, "CastGeneral", "
""line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, fal
se)); | 488 if (_validKey(element)) _remove(DDC$RT.cast(element, Object, E, "CastGeneral", "
""line 767, column 39 of dart:collection/splay_tree.dart: """, element is E, fal
se)); |
| 487 } | 489 } |
| 488 } | 490 } |
| 489 void retainAll(Iterable<Object> elements) { | 491 void retainAll(Iterable<Object> elements) { |
| 490 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); | 492 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); |
| 491 int modificationCount = _modificationCount; | 493 int modificationCount = _modificationCount; |
| 492 for (Object object in elements) { | 494 for (Object object in elements) { |
| 493 if (modificationCount != _modificationCount) { | 495 if (modificationCount != _modificationCount) { |
| 494 throw new ConcurrentModificationError(this); | 496 throw new ConcurrentModificationError(this); |
| 495 } | 497 } |
| 496 if (_validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral", "
""line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, fals
e)) == 0) retainSet.add(_root.key); | 498 if (_validKey(object) && _splay(DDC$RT.cast(object, Object, E, "CastGeneral", "
""line 781, column 39 of dart:collection/splay_tree.dart: """, object is E, fals
e)) == 0) retainSet.add(_root.key); |
| 497 } | 499 } |
| 498 if (retainSet._count != _count) { | 500 if (retainSet._count != _count) { |
| 499 _root = retainSet._root; | 501 _root = retainSet._root; |
| 500 _count = retainSet._count; | 502 _count = retainSet._count; |
| 501 _modificationCount++; | 503 _modificationCount++; |
| 502 } | 504 } |
| 503 } | 505 } |
| 504 E lookup(Object object) { | 506 E lookup(Object object) { |
| 505 if (!_validKey(object)) return ((__x61) => DDC$RT.cast(__x61, Null, E, "CastLite
ral", """line 792, column 36 of dart:collection/splay_tree.dart: """, __x61 is E
, false))(null); | 507 if (!_validKey(object)) return ((__x73) => DDC$RT.cast(__x73, Null, E, "CastLite
ral", """line 792, column 36 of dart:collection/splay_tree.dart: """, __x73 is E
, false))(null); |
| 506 int comp = _splay(DDC$RT.cast(object, Object, E, "CastGeneral", """line 793, co
lumn 23 of dart:collection/splay_tree.dart: """, object is E, false)); | 508 int comp = _splay(DDC$RT.cast(object, Object, E, "CastGeneral", """line 793, co
lumn 23 of dart:collection/splay_tree.dart: """, object is E, false)); |
| 507 if (comp != 0) return ((__x62) => DDC$RT.cast(__x62, Null, E, "CastLiteral", ""
"line 794, column 27 of dart:collection/splay_tree.dart: """, __x62 is E, false)
)(null); | 509 if (comp != 0) return ((__x74) => DDC$RT.cast(__x74, Null, E, "CastLiteral", ""
"line 794, column 27 of dart:collection/splay_tree.dart: """, __x74 is E, false)
)(null); |
| 508 return _root.key; | 510 return _root.key; |
| 509 } | 511 } |
| 510 Set<E> intersection(Set<E> other) { | 512 Set<E> intersection(Set<E> other) { |
| 511 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); | 513 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); |
| 512 for (E element in this) { | 514 for (E element in this) { |
| 513 if (other.contains(element)) result.add(element); | 515 if (other.contains(element)) result.add(element); |
| 514 } | 516 } |
| 515 return result; | 517 return result; |
| 516 } | 518 } |
| 517 Set<E> difference(Set<E> other) { | 519 Set<E> difference(Set<E> other) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 533 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { | 535 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { |
| 534 if (node == null) return null; | 536 if (node == null) return null; |
| 535 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); | 537 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); |
| 536 } | 538 } |
| 537 void clear() { | 539 void clear() { |
| 538 _clear(); | 540 _clear(); |
| 539 } | 541 } |
| 540 Set<E> toSet() => _clone(); | 542 Set<E> toSet() => _clone(); |
| 541 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | 543 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
| 542 } | 544 } |
| 545 typedef int __t45<K>(K __u46, K __u47); |
| 546 typedef bool __t49(dynamic __u50); |
| 547 typedef int __t66(dynamic __u67, dynamic __u68); |
| OLD | NEW |