| 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 } |
| 11 abstract class _SplayTree<K> {_SplayTreeNode<K> _root; | 11 abstract class _SplayTree<K> {_SplayTreeNode<K> _root; |
| 12 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(null); | 12 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(((__x51) => DDC$RT.cast(__x51,
Null, K, "CastLiteral", """line 46, column 52 of dart:collection/splay_tree.dar
t: """, __x51 is K, false))(null)); |
| 13 int _count = 0; | 13 int _count = 0; |
| 14 int _modificationCount = 0; | 14 int _modificationCount = 0; |
| 15 int _splayCount = 0; | 15 int _splayCount = 0; |
| 16 int _compare(K key1, K key2); | 16 int _compare(K key1, K key2); |
| 17 int _splay(K key) { | 17 int _splay(K key) { |
| 18 if (_root == null) return -1; | 18 if (_root == null) return -1; |
| 19 _SplayTreeNode<K> left = _dummy; | 19 _SplayTreeNode<K> left = _dummy; |
| 20 _SplayTreeNode<K> right = _dummy; | 20 _SplayTreeNode<K> right = _dummy; |
| 21 _SplayTreeNode<K> current = _root; | 21 _SplayTreeNode<K> current = _root; |
| 22 int comp; | 22 int comp; |
| (...skipping 117 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 = ((__x55) => DDC$RT.cast(__x55, dynamic, DDC$RT.type((__t52<K> _) { |
| 151 } |
| 152 ), "CastGeneral", """line 268, column 23 of dart:collection/splay_tree.dart: """
, __x55 is __t52<K>, false))((compare == null) ? Comparable.compare : compare),
_validKey = ((__x58) => DDC$RT.cast(__x58, dynamic, __t56, "CastGeneral", """lin
e 269, column 21 of dart:collection/splay_tree.dart: """, __x58 is __t56, 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 ((__x59) => DDC$RT.cast(__x59, Null, V, "CastLitera
l", """line 329, column 33 of dart:collection/splay_tree.dart: """, __x59 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 ((__x60) => DDC$RT.cast(__x60, Null, V, "CastLiteral", """line 337, colu
mn 12 of dart:collection/splay_tree.dart: """, __x60 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 ((__x61) => DDC$RT.cast(__x61, Null, V, "CastLiteral
", """line 341, column 33 of dart:collection/splay_tree.dart: """, __x61 is V, f
alse))(null); |
| 191 _SplayTreeMapNode mapRoot = ((__x48) => DDC$RT.cast(__x48, DDC$RT.type((_SplayT
reeNode<dynamic> _) { | 193 _SplayTreeMapNode mapRoot = ((__x62) => DDC$RT.cast(__x62, 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: """
, __x62 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 ((__x63) => DDC$RT.cast(__x63, Null, V, "CastLiteral", """line 344, colu
mn 12 of dart:collection/splay_tree.dart: """, __x63 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(((__x64) => DDC$RT.cast(__x64, 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: """,
__x64 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(((__x65) => DDC$RT.cast(__x65, 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: """,
__x65 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 ((__x66) => DDC$RT.cast(__x66, Null, K, "CastLiteral",
"""line 443, column 31 of dart:collection/splay_tree.dart: """, __x66 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 ((__x67) => DDC$RT.cast(__x67, Null, K, "CastLiteral",
"""line 451, column 31 of dart:collection/splay_tree.dart: """, __x67 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 ((__x68) => DDC$RT.cast(__x68, Null, K, "CastLiteral"
, """line 461, column 31 of dart:collection/splay_tree.dart: """, __x68 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 ((__x69) => DDC$RT.cast(__x69, Null, K, "CastLiteral",
"""line 465, column 30 of dart:collection/splay_tree.dart: """, __x69 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 ((__x70) => DDC$RT.cast(__x70, Null, K, "CastLiteral"
, """line 478, column 31 of dart:collection/splay_tree.dart: """, __x70 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 ((__x71) => DDC$RT.cast(__x71, Null, K, "CastLiteral",
"""line 482, column 30 of dart:collection/splay_tree.dart: """, __x71 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 ((__x72) => DDC$RT.cast(__x72, Null, T, "CastLi
teral", """line 547, column 38 of dart:collection/splay_tree.dart: """, __x72 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 22 matching lines...) Expand all Loading... |
| 391 } | 393 } |
| 392 T _getValue(_SplayTreeNode node); | 394 T _getValue(_SplayTreeNode node); |
| 393 } | 395 } |
| 394 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng
th {_SplayTree<K> _tree; | 396 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng
th {_SplayTree<K> _tree; |
| 395 _SplayTreeKeyIterable(this._tree); | 397 _SplayTreeKeyIterable(this._tree); |
| 396 int get length => _tree._count; | 398 int get length => _tree._count; |
| 397 bool get isEmpty => _tree._count == 0; | 399 bool get isEmpty => _tree._count == 0; |
| 398 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); | 400 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); |
| 399 Set<K> toSet() { | 401 Set<K> toSet() { |
| 400 var setOrMap = _tree; | 402 var setOrMap = _tree; |
| 401 SplayTreeSet<K> set = new SplayTreeSet<K>(setOrMap._comparator, setOrMap._valid
Key); | 403 SplayTreeSet<K> set = new SplayTreeSet<K>(DDC$RT.cast(setOrMap._comparator, dyn
amic, DDC$RT.type((__t73<K> _) { |
| 404 } |
| 405 ), "CastGeneral", """line 613, column 29 of dart:collection/splay_tree.dart: """
, setOrMap._comparator is __t73<K>, false), DDC$RT.cast(setOrMap._validKey, dyna
mic, __t56, "CastGeneral", """line 613, column 51 of dart:collection/splay_tree.
dart: """, setOrMap._validKey is __t56, false)); |
| 402 set._count = _tree._count; | 406 set._count = _tree._count; |
| 403 set._root = set._copyNode(_tree._root); | 407 set._root = set._copyNode(_tree._root); |
| 404 return set; | 408 return set; |
| 405 } | 409 } |
| 406 } | 410 } |
| 407 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien
tLength {SplayTreeMap<K, V> _map; | 411 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien
tLength {SplayTreeMap<K, V> _map; |
| 408 _SplayTreeValueIterable(this._map); | 412 _SplayTreeValueIterable(this._map); |
| 409 int get length => _map._count; | 413 int get length => _map._count; |
| 410 bool get isEmpty => _map._count == 0; | 414 bool get isEmpty => _map._count == 0; |
| 411 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); | 415 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); |
| 412 } | 416 } |
| 413 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter
ator(_SplayTree<K> map) : super(map); | 417 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter
ator(_SplayTree<K> map) : super(map); |
| 414 K _getValue(_SplayTreeNode node) => DDC$RT.cast(node.key, dynamic, K, "CastGene
ral", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.key i
s K, false); | 418 K _getValue(_SplayTreeNode node) => DDC$RT.cast(node.key, dynamic, K, "CastGene
ral", """line 631, column 39 of dart:collection/splay_tree.dart: """, node.key i
s K, false); |
| 415 } | 419 } |
| 416 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa
lueIterator(SplayTreeMap<K, V> map) : super(map); | 420 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa
lueIterator(SplayTreeMap<K, V> map) : super(map); |
| 417 V _getValue(_SplayTreeMapNode node) => DDC$RT.cast(node.value, dynamic, V, "Cas
tGeneral", """line 636, column 42 of dart:collection/splay_tree.dart: """, node.
value is V, false); | 421 V _getValue(_SplayTreeMapNode node) => DDC$RT.cast(node.value, dynamic, V, "Cas
tGeneral", """line 636, column 42 of dart:collection/splay_tree.dart: """, node.
value is V, false); |
| 418 } | 422 } |
| 419 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); | 423 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); | 424 _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> _) { | 425 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, DDC$RT.ty
pe((_SplayTreeNode<dynamic> _) { |
| 422 } | 426 } |
| 423 ), DDC$RT.type((_SplayTreeNode<K> _) { | 427 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 424 } | 428 } |
| 425 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """
, node is _SplayTreeNode<K>, false); | 429 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """
, node is _SplayTreeNode<K>, false); |
| 426 } | 430 } |
| 427 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; | 431 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; |
| 428 _Predicate _validKey; | 432 _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); | 433 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _c
omparator = ((__x79) => DDC$RT.cast(__x79, dynamic, __t76, "CastGeneral", """lin
e 693, column 23 of dart:collection/splay_tree.dart: """, __x79 is __t76, false)
)((compare == null) ? Comparable.compare : compare), _validKey = ((__x80) => DDC
$RT.cast(__x80, dynamic, __t56, "CastGeneral", """line 694, column 21 of dart:co
llection/splay_tree.dart: """, __x80 is __t56, false))((isValidKey != null) ? is
ValidKey : ((v) => v is E)); |
| 430 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)]) { |
| 431 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); | 435 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); |
| 432 for (final E element in elements) { | 436 for (final E element in elements) { |
| 433 result.add(element); | 437 result.add(element); |
| 434 } | 438 } |
| 435 return result; | 439 return result; |
| 436 } | 440 } |
| 437 int _compare(E e1, E e2) => _comparator(e1, e2); | 441 int _compare(E e1, E e2) => _comparator(e1, e2); |
| 438 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); | 442 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); |
| 439 int get length => _count; | 443 int get length => _count; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 451 if (_count == 0) throw IterableElementError.noElement(); | 455 if (_count == 0) throw IterableElementError.noElement(); |
| 452 if (_count > 1) throw IterableElementError.tooMany(); | 456 if (_count > 1) throw IterableElementError.tooMany(); |
| 453 return _root.key; | 457 return _root.key; |
| 454 } | 458 } |
| 455 bool contains(Object object) { | 459 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; | 460 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 } | 461 } |
| 458 bool add(E element) { | 462 bool add(E element) { |
| 459 int compare = _splay(element); | 463 int compare = _splay(element); |
| 460 if (compare == 0) return false; | 464 if (compare == 0) return false; |
| 461 _addNewRoot(((__x59) => DDC$RT.cast(__x59, DDC$RT.type((_SplayTreeNode<dynamic>
_) { | 465 _addNewRoot(((__x81) => DDC$RT.cast(__x81, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 462 } | 466 } |
| 463 ), DDC$RT.type((_SplayTreeNode<E> _) { | 467 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 464 } | 468 } |
| 465 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """,
__x59 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); | 469 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """,
__x81 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 466 return true; | 470 return true; |
| 467 } | 471 } |
| 468 bool remove(Object object) { | 472 bool remove(Object object) { |
| 469 if (!_validKey(object)) return false; | 473 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; | 474 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 } | 475 } |
| 472 void addAll(Iterable<E> elements) { | 476 void addAll(Iterable<E> elements) { |
| 473 for (E element in elements) { | 477 for (E element in elements) { |
| 474 int compare = _splay(element); | 478 int compare = _splay(element); |
| 475 if (compare != 0) { | 479 if (compare != 0) { |
| 476 _addNewRoot(((__x60) => DDC$RT.cast(__x60, DDC$RT.type((_SplayTreeNode<dynamic>
_) { | 480 _addNewRoot(((__x82) => DDC$RT.cast(__x82, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 477 } | 481 } |
| 478 ), DDC$RT.type((_SplayTreeNode<E> _) { | 482 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 479 } | 483 } |
| 480 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """,
__x60 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); | 484 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """,
__x82 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 481 } | 485 } |
| 482 } | 486 } |
| 483 } | 487 } |
| 484 void removeAll(Iterable<Object> elements) { | 488 void removeAll(Iterable<Object> elements) { |
| 485 for (Object element in elements) { | 489 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)); | 490 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 } | 491 } |
| 488 } | 492 } |
| 489 void retainAll(Iterable<Object> elements) { | 493 void retainAll(Iterable<Object> elements) { |
| 490 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); | 494 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); |
| 491 int modificationCount = _modificationCount; | 495 int modificationCount = _modificationCount; |
| 492 for (Object object in elements) { | 496 for (Object object in elements) { |
| 493 if (modificationCount != _modificationCount) { | 497 if (modificationCount != _modificationCount) { |
| 494 throw new ConcurrentModificationError(this); | 498 throw new ConcurrentModificationError(this); |
| 495 } | 499 } |
| 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); | 500 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 } | 501 } |
| 498 if (retainSet._count != _count) { | 502 if (retainSet._count != _count) { |
| 499 _root = retainSet._root; | 503 _root = retainSet._root; |
| 500 _count = retainSet._count; | 504 _count = retainSet._count; |
| 501 _modificationCount++; | 505 _modificationCount++; |
| 502 } | 506 } |
| 503 } | 507 } |
| 504 E lookup(Object object) { | 508 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); | 509 if (!_validKey(object)) return ((__x83) => DDC$RT.cast(__x83, Null, E, "CastLite
ral", """line 792, column 36 of dart:collection/splay_tree.dart: """, __x83 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)); | 510 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); | 511 if (comp != 0) return ((__x84) => DDC$RT.cast(__x84, Null, E, "CastLiteral", ""
"line 794, column 27 of dart:collection/splay_tree.dart: """, __x84 is E, false)
)(null); |
| 508 return _root.key; | 512 return _root.key; |
| 509 } | 513 } |
| 510 Set<E> intersection(Set<E> other) { | 514 Set<E> intersection(Set<E> other) { |
| 511 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); | 515 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); |
| 512 for (E element in this) { | 516 for (E element in this) { |
| 513 if (other.contains(element)) result.add(element); | 517 if (other.contains(element)) result.add(element); |
| 514 } | 518 } |
| 515 return result; | 519 return result; |
| 516 } | 520 } |
| 517 Set<E> difference(Set<E> other) { | 521 Set<E> difference(Set<E> other) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 533 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { | 537 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { |
| 534 if (node == null) return null; | 538 if (node == null) return null; |
| 535 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); | 539 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); |
| 536 } | 540 } |
| 537 void clear() { | 541 void clear() { |
| 538 _clear(); | 542 _clear(); |
| 539 } | 543 } |
| 540 Set<E> toSet() => _clone(); | 544 Set<E> toSet() => _clone(); |
| 541 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | 545 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
| 542 } | 546 } |
| 547 typedef int __t52<K>(K __u53, K __u54); |
| 548 typedef bool __t56(dynamic __u57); |
| 549 typedef int __t73<K>(K __u74, K __u75); |
| 550 typedef int __t76(dynamic __u77, dynamic __u78); |
| OLD | NEW |