| OLD | NEW |
| 1 part of dart.collection; | 1 part of dart.collection; |
| 2 | 2 typedef bool _Predicate<T>(T value); |
| 3 typedef bool _Predicate<T>(T value); | 3 class _SplayTreeNode<K> {final K key; |
| 4 class _SplayTreeNode<K> { | 4 _SplayTreeNode<K> left; |
| 5 final K key; | 5 _SplayTreeNode<K> right; |
| 6 _SplayTreeNode<K> left; | 6 _SplayTreeNode(K this.key); |
| 7 _SplayTreeNode<K> right; | 7 } |
| 8 _SplayTreeNode(K this.key); | 8 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> {V value; |
| 9 } | 9 _SplayTreeMapNode(K key, V this.value) : super(key); |
| 10 class _SplayTreeMapNode<K, V> extends _SplayTreeNode<K> { | 10 } |
| 11 V value; | 11 abstract class _SplayTree<K> {_SplayTreeNode<K> _root; |
| 12 _SplayTreeMapNode(K key, V this.value) : super(key); | 12 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(null); |
| 13 } | 13 int _count = 0; |
| 14 abstract class _SplayTree<K> { | 14 int _modificationCount = 0; |
| 15 _SplayTreeNode<K> _root; | 15 int _splayCount = 0; |
| 16 _SplayTreeNode<K> _dummy = new _SplayTreeNode<K>(null); | 16 int _compare(K key1, K key2); |
| 17 int _count = 0; | 17 int _splay(K key) { |
| 18 int _modificationCount = 0; | 18 if (_root == null) return -1; |
| 19 int _splayCount = 0; | 19 _SplayTreeNode<K> left = _dummy; |
| 20 int _compare(K key1, K key2); | 20 _SplayTreeNode<K> right = _dummy; |
| 21 int _splay(K key) { | 21 _SplayTreeNode<K> current = _root; |
| 22 if (_root == null) return -1; | 22 int comp; |
| 23 _SplayTreeNode<K> left = _dummy; | 23 while (true) { |
| 24 _SplayTreeNode<K> right = _dummy; | 24 comp = _compare(current.key, key); |
| 25 _SplayTreeNode<K> current = _root; | 25 if (comp > 0) { |
| 26 int comp; | 26 if (current.left == null) break; |
| 27 while (true) { | 27 comp = _compare(current.left.key, key); |
| 28 comp = _compare(current.key, key); | 28 if (comp > 0) { |
| 29 if (comp > 0) { | 29 _SplayTreeNode<K> tmp = current.left; |
| 30 if (current.left == null) break; | 30 current.left = tmp.right; |
| 31 comp = _compare(current.left.key, key); | 31 tmp.right = current; |
| 32 if (comp > 0) { | 32 current = tmp; |
| 33 _SplayTreeNode<K> tmp = current.left; | 33 if (current.left == null) break; |
| 34 current.left = tmp.right; | |
| 35 tmp.right = current; | |
| 36 current = tmp; | |
| 37 if (current.left == null) break; | |
| 38 } | |
| 39 right.left = current; | |
| 40 right = current; | |
| 41 current = current.left; | |
| 42 } else if (comp < 0) { | |
| 43 if (current.right == null) break; | |
| 44 comp = _compare(current.right.key, key); | |
| 45 if (comp < 0) { | |
| 46 _SplayTreeNode<K> tmp = current.right; | |
| 47 current.right = tmp.left; | |
| 48 tmp.left = current; | |
| 49 current = tmp; | |
| 50 if (current.right == null) break; | |
| 51 } | |
| 52 left.right = current; | |
| 53 left = current; | |
| 54 current = current.right; | |
| 55 } else { | |
| 56 break; | |
| 57 } | |
| 58 } | 34 } |
| 59 left.right = current.left; | 35 right.left = current; |
| 60 right.left = current.right; | 36 right = current; |
| 61 current.left = _dummy.right; | 37 current = current.left; |
| 62 current.right = _dummy.left; | |
| 63 _root = current; | |
| 64 _dummy.right = null; | |
| 65 _dummy.left = null; | |
| 66 _splayCount++; | |
| 67 return comp; | |
| 68 } | 38 } |
| 69 _SplayTreeNode<K> _splayMin(_SplayTreeNode<K> node) { | 39 else if (comp < 0) { |
| 70 _SplayTreeNode current = node; | 40 if (current.right == null) break; |
| 71 while (current.left != null) { | 41 comp = _compare(current.right.key, key); |
| 72 _SplayTreeNode left = current.left; | 42 if (comp < 0) { |
| 73 current.left = left.right; | 43 _SplayTreeNode<K> tmp = current.right; |
| 74 left.right = current; | 44 current.right = tmp.left; |
| 75 current = left; | 45 tmp.left = current; |
| 46 current = tmp; |
| 47 if (current.right == null) break; |
| 76 } | 48 } |
| 77 return DDC$RT.cast(current, DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 49 left.right = current; |
| 78 DDC$RT.type((_SplayTreeNode<K> _) {}), "CastDynamic", | 50 left = current; |
| 79 """line 151, column 12 of dart:collection/splay_tree.dart: """, | 51 current = current.right; |
| 80 current is _SplayTreeNode<K>, false); | |
| 81 } | 52 } |
| 82 _SplayTreeNode<K> _splayMax(_SplayTreeNode<K> node) { | 53 else { |
| 83 _SplayTreeNode current = node; | 54 break; |
| 84 while (current.right != null) { | |
| 85 _SplayTreeNode right = current.right; | |
| 86 current.right = right.left; | |
| 87 right.left = current; | |
| 88 current = right; | |
| 89 } | |
| 90 return DDC$RT.cast(current, DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | |
| 91 DDC$RT.type((_SplayTreeNode<K> _) {}), "CastDynamic", | |
| 92 """line 167, column 12 of dart:collection/splay_tree.dart: """, | |
| 93 current is _SplayTreeNode<K>, false); | |
| 94 } | 55 } |
| 95 _SplayTreeNode _remove(K key) { | 56 } |
| 96 if (_root == null) return null; | 57 left.right = current.left; |
| 97 int comp = _splay(key); | 58 right.left = current.right; |
| 98 if (comp != 0) return null; | 59 current.left = _dummy.right; |
| 99 _SplayTreeNode result = _root; | 60 current.right = _dummy.left; |
| 100 _count--; | 61 _root = current; |
| 101 if (_root.left == null) { | 62 _dummy.right = null; |
| 102 _root = _root.right; | 63 _dummy.left = null; |
| 103 } else { | 64 _splayCount++; |
| 104 _SplayTreeNode<K> right = _root.right; | 65 return comp; |
| 105 _root = _splayMax(_root.left); | 66 } |
| 106 _root.right = right; | 67 _SplayTreeNode<K> _splayMin(_SplayTreeNode<K> node) { |
| 107 } | 68 _SplayTreeNode current = node; |
| 108 _modificationCount++; | 69 while (current.left != null) { |
| 109 return result; | 70 _SplayTreeNode left = current.left; |
| 110 } | 71 current.left = left.right; |
| 111 void _addNewRoot(_SplayTreeNode<K> node, int comp) { | 72 left.right = current; |
| 112 _count++; | 73 current = left; |
| 113 _modificationCount++; | 74 } |
| 114 if (_root == null) { | 75 return DDC$RT.cast(current, DDC$RT.type((_SplayTreeNode<dynamic> _) { |
| 115 _root = node; | 76 } |
| 116 return; | 77 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 117 } | 78 } |
| 118 if (comp < 0) { | 79 ), "CastDynamic", """line 151, column 12 of dart:collection/splay_tree.dart: """
, current is _SplayTreeNode<K>, false); |
| 119 node.left = _root; | 80 } |
| 120 node.right = _root.right; | 81 _SplayTreeNode<K> _splayMax(_SplayTreeNode<K> node) { |
| 121 _root.right = null; | 82 _SplayTreeNode current = node; |
| 122 } else { | 83 while (current.right != null) { |
| 123 node.right = _root; | 84 _SplayTreeNode right = current.right; |
| 124 node.left = _root.left; | 85 current.right = right.left; |
| 125 _root.left = null; | 86 right.left = current; |
| 126 } | 87 current = right; |
| 127 _root = node; | 88 } |
| 128 } | 89 return DDC$RT.cast(current, DDC$RT.type((_SplayTreeNode<dynamic> _) { |
| 129 _SplayTreeNode get _first { | 90 } |
| 130 if (_root == null) return null; | 91 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 131 _root = _splayMin(_root); | 92 } |
| 132 return _root; | 93 ), "CastDynamic", """line 167, column 12 of dart:collection/splay_tree.dart: """
, current is _SplayTreeNode<K>, false); |
| 133 } | 94 } |
| 134 _SplayTreeNode get _last { | 95 _SplayTreeNode _remove(K key) { |
| 135 if (_root == null) return null; | 96 if (_root == null) return null; |
| 136 _root = _splayMax(_root); | 97 int comp = _splay(key); |
| 137 return _root; | 98 if (comp != 0) return null; |
| 138 } | 99 _SplayTreeNode result = _root; |
| 139 void _clear() { | 100 _count--; |
| 140 _root = null; | 101 if (_root.left == null) { |
| 141 _count = 0; | 102 _root = _root.right; |
| 142 _modificationCount++; | 103 } |
| 143 } | 104 else { |
| 144 } | 105 _SplayTreeNode<K> right = _root.right; |
| 145 class _TypeTest<T> { | 106 _root = _splayMax(_root.left); |
| 146 bool test(v) => v is T; | 107 _root.right = right; |
| 147 } | 108 } |
| 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> { | 109 _modificationCount++; |
| 149 Comparator<K> _comparator; | 110 return result; |
| 150 _Predicate _validKey; | 111 } |
| 151 SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) | 112 void _addNewRoot(_SplayTreeNode<K> node, int comp) { |
| 152 : _comparator = (compare == null) ? Comparable.compare : compare, | 113 _count++; |
| 153 _validKey = (isValidKey != null) ? isValidKey : ((v) => v is K); | 114 _modificationCount++; |
| 154 factory SplayTreeMap.from(Map other, | 115 if (_root == null) { |
| 155 [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { | 116 _root = node; |
| 156 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); | 117 return;} |
| 157 other.forEach((k, v) { | 118 if (comp < 0) { |
| 158 result[k] = DDC$RT.cast(v, dynamic, V, "CastGeneral", | 119 node.left = _root; |
| 159 """line 278, column 40 of dart:collection/splay_tree.dart: """, | 120 node.right = _root.right; |
| 160 v is V, false); | 121 _root.right = null; |
| 161 }); | 122 } |
| 162 return result; | 123 else { |
| 163 } | 124 node.right = _root; |
| 164 factory SplayTreeMap.fromIterable(Iterable iterable, {K key(element), | 125 node.left = _root.left; |
| 165 V value(element), int compare(K key1, K key2), | 126 _root.left = null; |
| 166 bool isValidKey(potentialKey)}) { | 127 } |
| 167 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 128 _root = node; |
| 168 Maps._fillMapWithMappedIterable(map, iterable, key, value); | 129 } |
| 169 return map; | 130 _SplayTreeNode get _first { |
| 170 } | 131 if (_root == null) return null; |
| 171 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, | 132 _root = _splayMin(_root); |
| 172 [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { | 133 return _root; |
| 173 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); | 134 } |
| 174 Maps._fillMapWithIterables(map, keys, values); | 135 _SplayTreeNode get _last { |
| 175 return map; | 136 if (_root == null) return null; |
| 176 } | 137 _root = _splayMax(_root); |
| 177 int _compare(K key1, K key2) => _comparator(key1, key2); | 138 return _root; |
| 178 SplayTreeMap._internal(); | 139 } |
| 179 V operator [](Object key) { | 140 void _clear() { |
| 180 if (key == null) throw new ArgumentError(key); | 141 _root = null; |
| 181 if (!_validKey(key)) return ((__x45) => DDC$RT.cast(__x45, Null, V, | 142 _count = 0; |
| 182 "CastLiteral", | 143 _modificationCount++; |
| 183 """line 329, column 33 of dart:collection/splay_tree.dart: """, | 144 } |
| 184 __x45 is V, false))(null); | 145 } |
| 185 if (_root != null) { | 146 class _TypeTest<T> {bool test(v) => v is T; |
| 186 int comp = _splay(DDC$RT.cast(key, Object, K, "CastGeneral", | 147 } |
| 187 """line 331, column 25 of dart:collection/splay_tree.dart: """, | 148 class SplayTreeMap<K, V> extends _SplayTree<K> implements Map<K, V> {Comparator
<K> _comparator; |
| 188 key is K, false)); | 149 _Predicate _validKey; |
| 189 if (comp == 0) { | 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); |
| 190 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, | 151 factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValid
Key(potentialKey)]) { |
| 191 DDC$RT.type((_SplayTreeNode<K> _) {}), | 152 SplayTreeMap<K, V> result = new SplayTreeMap<K, V>(); |
| 192 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 153 other.forEach((k, v) { |
| 193 "CastGeneral", | 154 result[k] = DDC$RT.cast(v, dynamic, V, "CastGeneral", """line 278, column 40 of
dart:collection/splay_tree.dart: """, v is V, false); |
| 194 """line 333, column 37 of dart:collection/splay_tree.dart: """, | 155 } |
| 195 _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 156 ); |
| 196 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", | 157 return result; |
| 197 """line 334, column 16 of dart:collection/splay_tree.dart: """, | 158 } |
| 198 mapRoot.value is V, false); | 159 factory SplayTreeMap.fromIterable(Iterable iterable, { |
| 199 } | 160 K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(p
otentialKey)} |
| 200 } | 161 ) { |
| 201 return ((__x46) => DDC$RT.cast(__x46, Null, V, "CastLiteral", | 162 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 202 """line 337, column 12 of dart:collection/splay_tree.dart: """, | 163 Maps._fillMapWithMappedIterable(map, iterable, key, value); |
| 203 __x46 is V, false))(null); | 164 return map; |
| 204 } | 165 } |
| 205 V remove(Object key) { | 166 factory SplayTreeMap.fromIterables(Iterable<K> keys, Iterable<V> values, [int c
ompare(K key1, K key2), bool isValidKey(potentialKey)]) { |
| 206 if (!_validKey(key)) return ((__x47) => DDC$RT.cast(__x47, Null, V, | 167 SplayTreeMap<K, V> map = new SplayTreeMap<K, V>(compare, isValidKey); |
| 207 "CastLiteral", | 168 Maps._fillMapWithIterables(map, keys, values); |
| 208 """line 341, column 33 of dart:collection/splay_tree.dart: """, | 169 return map; |
| 209 __x47 is V, false))(null); | 170 } |
| 210 _SplayTreeMapNode mapRoot = ((__x48) => DDC$RT.cast(__x48, | 171 int _compare(K key1, K key2) => _comparator(key1, key2); |
| 211 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 172 SplayTreeMap._internal(); |
| 212 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), "CastGeneral", | 173 V operator [](Object key) { |
| 213 """line 342, column 33 of dart:collection/splay_tree.dart: """, | 174 if (key == null) throw new ArgumentError(key); |
| 214 __x48 is _SplayTreeMapNode<dynamic, dynamic>, true))(_remove(DDC$RT | 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); |
| 215 .cast(key, Object, K, "CastGeneral", | 176 if (_root != null) { |
| 216 """line 342, column 41 of dart:collection/splay_tree.dart: """, | 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)); |
| 217 key is K, false))); | 178 if (comp == 0) { |
| 218 if (mapRoot != null) return DDC$RT.cast(mapRoot.value, dynamic, V, | 179 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 219 "CastGeneral", | 180 } |
| 220 """line 343, column 33 of dart:collection/splay_tree.dart: """, | 181 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 221 mapRoot.value is V, false); | 182 } |
| 222 return ((__x49) => DDC$RT.cast(__x49, Null, V, "CastLiteral", | 183 ), "CastGeneral", """line 333, column 37 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 223 """line 344, column 12 of dart:collection/splay_tree.dart: """, | 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); |
| 224 __x49 is V, false))(null); | 185 } |
| 225 } | 186 } |
| 226 void operator []=(K key, V value) { | 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); |
| 227 if (key == null) throw new ArgumentError(key); | 188 } |
| 228 int comp = _splay(key); | 189 V remove(Object key) { |
| 229 if (comp == 0) { | 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); |
| 230 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, | 191 _SplayTreeMapNode mapRoot = ((__x48) => DDC$RT.cast(__x48, DDC$RT.type((_SplayT
reeNode<dynamic> _) { |
| 231 DDC$RT.type((_SplayTreeNode<K> _) {}), | 192 } |
| 232 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 193 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 233 "CastGeneral", | 194 } |
| 234 """line 353, column 35 of dart:collection/splay_tree.dart: """, | 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))); |
| 235 _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 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); |
| 236 mapRoot.value = value; | 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); |
| 237 return; | 198 } |
| 238 } | 199 void operator []=(K key, V value) { |
| 239 _addNewRoot(((__x50) => DDC$RT.cast(__x50, | 200 if (key == null) throw new ArgumentError(key); |
| 240 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 201 int comp = _splay(key); |
| 241 DDC$RT.type((_SplayTreeNode<K> _) {}), "CastExact", | 202 if (comp == 0) { |
| 242 """line 357, column 17 of dart:collection/splay_tree.dart: """, | 203 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 243 __x50 is _SplayTreeNode<K>, | 204 } |
| 244 false))(new _SplayTreeMapNode(key, value)), comp); | 205 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 245 } | 206 } |
| 246 V putIfAbsent(K key, V ifAbsent()) { | 207 ), "CastGeneral", """line 353, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 247 if (key == null) throw new ArgumentError(key); | 208 mapRoot.value = value; |
| 248 int comp = _splay(key); | 209 return;} |
| 249 if (comp == 0) { | 210 _addNewRoot(((__x50) => DDC$RT.cast(__x50, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { |
| 250 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, | 211 } |
| 251 DDC$RT.type((_SplayTreeNode<K> _) {}), | 212 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 252 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 213 } |
| 253 "CastGeneral", | 214 ), "CastExact", """line 357, column 17 of dart:collection/splay_tree.dart: """,
__x50 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); |
| 254 """line 365, column 35 of dart:collection/splay_tree.dart: """, | 215 } |
| 255 _root is _SplayTreeMapNode<dynamic, dynamic>, true); | 216 V putIfAbsent(K key, V ifAbsent()) { |
| 256 return DDC$RT.cast(mapRoot.value, dynamic, V, "CastGeneral", | 217 if (key == null) throw new ArgumentError(key); |
| 257 """line 366, column 14 of dart:collection/splay_tree.dart: """, | 218 int comp = _splay(key); |
| 258 mapRoot.value is V, false); | 219 if (comp == 0) { |
| 259 } | 220 _SplayTreeMapNode mapRoot = DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _)
{ |
| 260 int modificationCount = _modificationCount; | 221 } |
| 261 int splayCount = _splayCount; | 222 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 262 V value = ifAbsent(); | 223 } |
| 263 if (modificationCount != _modificationCount) { | 224 ), "CastGeneral", """line 365, column 35 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 264 throw new ConcurrentModificationError(this); | 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); |
| 265 } | 226 } |
| 266 if (splayCount != _splayCount) { | 227 int modificationCount = _modificationCount; |
| 267 comp = _splay(key); | 228 int splayCount = _splayCount; |
| 268 assert(comp != 0); | 229 V value = ifAbsent(); |
| 269 } | 230 if (modificationCount != _modificationCount) { |
| 270 _addNewRoot(((__x51) => DDC$RT.cast(__x51, | 231 throw new ConcurrentModificationError(this); |
| 271 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 232 } |
| 272 DDC$RT.type((_SplayTreeNode<K> _) {}), "CastExact", | 233 if (splayCount != _splayCount) { |
| 273 """line 379, column 17 of dart:collection/splay_tree.dart: """, | 234 comp = _splay(key); |
| 274 __x51 is _SplayTreeNode<K>, | 235 assert (comp != 0);} |
| 275 false))(new _SplayTreeMapNode(key, value)), comp); | 236 _addNewRoot(((__x51) => DDC$RT.cast(__x51, DDC$RT.type((_SplayTreeMapNode<dynam
ic, dynamic> _) { |
| 276 return value; | 237 } |
| 277 } | 238 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 278 void addAll(Map<K, V> other) { | 239 } |
| 279 other.forEach((K key, V value) { | 240 ), "CastExact", """line 379, column 17 of dart:collection/splay_tree.dart: """,
__x51 is _SplayTreeNode<K>, false))(new _SplayTreeMapNode(key, value)), comp); |
| 280 this[key] = value; | 241 return value; |
| 281 }); | 242 } |
| 282 } | 243 void addAll(Map<K, V> other) { |
| 283 bool get isEmpty { | 244 other.forEach((K key, V value) { |
| 284 return (_root == null); | 245 this[key] = value; |
| 285 } | 246 } |
| 286 bool get isNotEmpty => !isEmpty; | 247 ); |
| 287 void forEach(void f(K key, V value)) { | 248 } |
| 288 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this); | 249 bool get isEmpty { |
| 289 while (nodes.moveNext()) { | 250 return (_root == null); |
| 290 _SplayTreeMapNode<K, V> node = DDC$RT.cast(nodes.current, | 251 } |
| 291 DDC$RT.type((_SplayTreeNode<K> _) {}), | 252 bool get isNotEmpty => !isEmpty; |
| 292 DDC$RT.type((_SplayTreeMapNode<K, V> _) {}), "CastGeneral", | 253 void forEach(void f(K key, V value)) { |
| 293 """line 397, column 38 of dart:collection/splay_tree.dart: """, | 254 Iterator<_SplayTreeNode<K>> nodes = new _SplayTreeNodeIterator<K>(this); |
| 294 nodes.current is _SplayTreeMapNode<K, V>, false); | 255 while (nodes.moveNext()) { |
| 295 f(node.key, node.value); | 256 _SplayTreeMapNode<K, V> node = DDC$RT.cast(nodes.current, DDC$RT.type((_SplayTre
eNode<K> _) { |
| 296 } | 257 } |
| 297 } | 258 ), DDC$RT.type((_SplayTreeMapNode<K, V> _) { |
| 298 int get length { | 259 } |
| 299 return _count; | 260 ), "CastGeneral", """line 397, column 38 of dart:collection/splay_tree.dart: """
, nodes.current is _SplayTreeMapNode<K, V>, false); |
| 300 } | 261 f(node.key, node.value); |
| 301 void clear() { | 262 } |
| 302 _clear(); | 263 } |
| 303 } | 264 int get length { |
| 304 bool containsKey(Object key) { | 265 return _count; |
| 305 return _validKey(key) && | 266 } |
| 306 _splay(DDC$RT.cast(key, Object, K, "CastGeneral", | 267 void clear() { |
| 307 """line 411, column 37 of dart:collection/splay_tree.dart: """, | 268 _clear(); |
| 308 key is K, false)) == | 269 } |
| 309 0; | 270 bool containsKey(Object key) { |
| 310 } | 271 return _validKey(key) && _splay(DDC$RT.cast(key, Object, K, "CastGeneral", """li
ne 411, column 37 of dart:collection/splay_tree.dart: """, key is K, false)) ==
0; |
| 311 bool containsValue(Object value) { | 272 } |
| 312 bool found = false; | 273 bool containsValue(Object value) { |
| 313 int initialSplayCount = _splayCount; | 274 bool found = false; |
| 314 bool visit(_SplayTreeMapNode node) { | 275 int initialSplayCount = _splayCount; |
| 315 while (node != null) { | 276 bool visit(_SplayTreeMapNode node) { |
| 316 if (node.value == value) return true; | 277 while (node != null) { |
| 317 if (initialSplayCount != _splayCount) { | 278 if (node.value == value) return true; |
| 318 throw new ConcurrentModificationError(this); | 279 if (initialSplayCount != _splayCount) { |
| 319 } | 280 throw new ConcurrentModificationError(this); |
| 320 if (node.right != null && | 281 } |
| 321 visit(DDC$RT.cast(node.right, | 282 if (node.right != null && visit(DDC$RT.cast(node.right, DDC$RT.type((_SplayTree
Node<dynamic> _) { |
| 322 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 283 } |
| 323 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 284 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 324 "CastGeneral", | 285 } |
| 325 """line 423, column 41 of dart:collection/splay_tree.dart: """, | 286 ), "CastGeneral", """line 423, column 41 of dart:collection/splay_tree.dart: """
, node.right is _SplayTreeMapNode<dynamic, dynamic>, true))) return true; |
| 326 node.right is _SplayTreeMapNode<dynamic, dynamic>, | 287 node = DDC$RT.cast(node.left, DDC$RT.type((_SplayTreeNode<dynamic> _) { |
| 327 true))) return true; | 288 } |
| 328 node = DDC$RT.cast(node.left, | 289 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 329 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 290 } |
| 330 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), | 291 ), "CastGeneral", """line 424, column 16 of dart:collection/splay_tree.dart: """
, node.left is _SplayTreeMapNode<dynamic, dynamic>, true); |
| 331 "CastGeneral", | 292 } |
| 332 """line 424, column 16 of dart:collection/splay_tree.dart: """, | 293 return false; |
| 333 node.left is _SplayTreeMapNode<dynamic, dynamic>, true); | 294 } |
| 334 } | 295 return visit(DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) { |
| 335 return false; | 296 } |
| 336 } | 297 ), DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) { |
| 337 return visit(DDC$RT.cast(_root, DDC$RT.type((_SplayTreeNode<K> _) {}), | 298 } |
| 338 DDC$RT.type((_SplayTreeMapNode<dynamic, dynamic> _) {}), "CastGeneral", | 299 ), "CastGeneral", """line 428, column 18 of dart:collection/splay_tree.dart: """
, _root is _SplayTreeMapNode<dynamic, dynamic>, true)); |
| 339 """line 428, column 18 of dart:collection/splay_tree.dart: """, | 300 } |
| 340 _root is _SplayTreeMapNode<dynamic, dynamic>, true)); | 301 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); |
| 341 } | 302 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); |
| 342 Iterable<K> get keys => new _SplayTreeKeyIterable<K>(this); | 303 String toString() { |
| 343 Iterable<V> get values => new _SplayTreeValueIterable<K, V>(this); | 304 return Maps.mapToString(this); |
| 344 String toString() { | 305 } |
| 345 return Maps.mapToString(this); | 306 K firstKey() { |
| 346 } | 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); |
| 347 K firstKey() { | 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); |
| 348 if (_root == null) return ((__x52) => DDC$RT.cast(__x52, Null, K, | 309 } |
| 349 "CastLiteral", | 310 K lastKey() { |
| 350 """line 443, column 31 of dart:collection/splay_tree.dart: """, | 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); |
| 351 __x52 is K, false))(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); |
| 352 return DDC$RT.cast(_first.key, dynamic, K, "CastGeneral", | 313 } |
| 353 """line 444, column 12 of dart:collection/splay_tree.dart: """, | 314 K lastKeyBefore(K key) { |
| 354 _first.key is K, false); | 315 if (key == null) throw new ArgumentError(key); |
| 355 } | 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); |
| 356 K lastKey() { | 317 int comp = _splay(key); |
| 357 if (_root == null) return ((__x53) => DDC$RT.cast(__x53, Null, K, | 318 if (comp < 0) return _root.key; |
| 358 "CastLiteral", | 319 _SplayTreeNode<K> node = _root.left; |
| 359 """line 451, column 31 of dart:collection/splay_tree.dart: """, | 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); |
| 360 __x53 is K, false))(null); | 321 while (node.right != null) { |
| 361 return DDC$RT.cast(_last.key, dynamic, K, "CastGeneral", | 322 node = node.right; |
| 362 """line 452, column 12 of dart:collection/splay_tree.dart: """, | 323 } |
| 363 _last.key is K, false); | 324 return node.key; |
| 364 } | 325 } |
| 365 K lastKeyBefore(K key) { | 326 K firstKeyAfter(K key) { |
| 366 if (key == null) throw new ArgumentError(key); | 327 if (key == null) throw new ArgumentError(key); |
| 367 if (_root == null) return ((__x54) => DDC$RT.cast(__x54, Null, K, | 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); |
| 368 "CastLiteral", | 329 int comp = _splay(key); |
| 369 """line 461, column 31 of dart:collection/splay_tree.dart: """, | 330 if (comp > 0) return _root.key; |
| 370 __x54 is K, false))(null); | 331 _SplayTreeNode<K> node = _root.right; |
| 371 int comp = _splay(key); | 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); |
| 372 if (comp < 0) return _root.key; | 333 while (node.left != null) { |
| 373 _SplayTreeNode<K> node = _root.left; | 334 node = node.left; |
| 374 if (node == null) return ((__x55) => DDC$RT.cast(__x55, Null, K, | 335 } |
| 375 "CastLiteral", | 336 return node.key; |
| 376 """line 465, column 30 of dart:collection/splay_tree.dart: """, | 337 } |
| 377 __x55 is K, false))(null); | 338 } |
| 378 while (node.right != null) { | 339 abstract class _SplayTreeIterator<T> implements Iterator<T> {final _SplayTree _
tree; |
| 379 node = node.right; | 340 final List<_SplayTreeNode> _workList = <_SplayTreeNode> []; |
| 380 } | 341 int _modificationCount; |
| 381 return node.key; | 342 int _splayCount; |
| 382 } | 343 _SplayTreeNode _currentNode; |
| 383 K firstKeyAfter(K key) { | 344 _SplayTreeIterator(_SplayTree tree) : _tree = tree, _modificationCount = tree._
modificationCount, _splayCount = tree._splayCount { |
| 384 if (key == null) throw new ArgumentError(key); | 345 _findLeftMostDescendent(tree._root); |
| 385 if (_root == null) return ((__x56) => DDC$RT.cast(__x56, Null, K, | 346 } |
| 386 "CastLiteral", | 347 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) : _tree = tree, _modi
ficationCount = tree._modificationCount { |
| 387 """line 478, column 31 of dart:collection/splay_tree.dart: """, | 348 if (tree._root == null) return; int compare = tree._splay(startKey); |
| 388 __x56 is K, false))(null); | 349 _splayCount = tree._splayCount; |
| 389 int comp = _splay(key); | 350 if (compare < 0) { |
| 390 if (comp > 0) return _root.key; | 351 _findLeftMostDescendent(tree._root.right); |
| 391 _SplayTreeNode<K> node = _root.right; | 352 } |
| 392 if (node == null) return ((__x57) => DDC$RT.cast(__x57, Null, K, | 353 else { |
| 393 "CastLiteral", | 354 _workList.add(tree._root); |
| 394 """line 482, column 30 of dart:collection/splay_tree.dart: """, | 355 } |
| 395 __x57 is K, false))(null); | 356 } |
| 396 while (node.left != null) { | 357 T get current { |
| 397 node = node.left; | 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); |
| 398 } | 359 return _getValue(_currentNode); |
| 399 return node.key; | 360 } |
| 400 } | 361 void _findLeftMostDescendent(_SplayTreeNode node) { |
| 401 } | 362 while (node != null) { |
| 402 abstract class _SplayTreeIterator<T> implements Iterator<T> { | 363 _workList.add(node); |
| 403 final _SplayTree _tree; | 364 node = node.left; |
| 404 final List<_SplayTreeNode> _workList = <_SplayTreeNode>[]; | 365 } |
| 405 int _modificationCount; | 366 } |
| 406 int _splayCount; | 367 void _rebuildWorkList(_SplayTreeNode currentNode) { |
| 407 _SplayTreeNode _currentNode; | 368 assert (!_workList.isEmpty); _workList.clear(); |
| 408 _SplayTreeIterator(_SplayTree tree) | 369 if (currentNode == null) { |
| 409 : _tree = tree, | 370 _findLeftMostDescendent(_tree._root); |
| 410 _modificationCount = tree._modificationCount, | 371 } |
| 411 _splayCount = tree._splayCount { | 372 else { |
| 412 _findLeftMostDescendent(tree._root); | 373 _tree._splay(currentNode.key); |
| 413 } | 374 _findLeftMostDescendent(_tree._root.right); |
| 414 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) | 375 assert (!_workList.isEmpty);} |
| 415 : _tree = tree, | 376 } |
| 416 _modificationCount = tree._modificationCount { | 377 bool moveNext() { |
| 417 if (tree._root == null) return; | 378 if (_modificationCount != _tree._modificationCount) { |
| 418 int compare = tree._splay(startKey); | 379 throw new ConcurrentModificationError(_tree); |
| 419 _splayCount = tree._splayCount; | 380 } |
| 420 if (compare < 0) { | 381 if (_workList.isEmpty) { |
| 421 _findLeftMostDescendent(tree._root.right); | 382 _currentNode = null; |
| 422 } else { | 383 return false; |
| 423 _workList.add(tree._root); | 384 } |
| 424 } | 385 if (_tree._splayCount != _splayCount && _currentNode != null) { |
| 425 } | 386 _rebuildWorkList(_currentNode); |
| 426 T get current { | 387 } |
| 427 if (_currentNode == null) return ((__x58) => DDC$RT.cast(__x58, Null, T, | 388 _currentNode = _workList.removeLast(); |
| 428 "CastLiteral", | 389 _findLeftMostDescendent(_currentNode.right); |
| 429 """line 547, column 38 of dart:collection/splay_tree.dart: """, | 390 return true; |
| 430 __x58 is T, false))(null); | 391 } |
| 431 return _getValue(_currentNode); | 392 T _getValue(_SplayTreeNode node); |
| 432 } | 393 } |
| 433 void _findLeftMostDescendent(_SplayTreeNode node) { | 394 class _SplayTreeKeyIterable<K> extends IterableBase<K> implements EfficientLeng
th {_SplayTree<K> _tree; |
| 434 while (node != null) { | 395 _SplayTreeKeyIterable(this._tree); |
| 435 _workList.add(node); | 396 int get length => _tree._count; |
| 436 node = node.left; | 397 bool get isEmpty => _tree._count == 0; |
| 437 } | 398 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); |
| 438 } | 399 Set<K> toSet() { |
| 439 void _rebuildWorkList(_SplayTreeNode currentNode) { | 400 var setOrMap = _tree; |
| 440 assert(!_workList.isEmpty); | 401 SplayTreeSet<K> set = new SplayTreeSet<K>(setOrMap._comparator, setOrMap._valid
Key); |
| 441 _workList.clear(); | 402 set._count = _tree._count; |
| 442 if (currentNode == null) { | 403 set._root = set._copyNode(_tree._root); |
| 443 _findLeftMostDescendent(_tree._root); | 404 return set; |
| 444 } else { | 405 } |
| 445 _tree._splay(currentNode.key); | 406 } |
| 446 _findLeftMostDescendent(_tree._root.right); | 407 class _SplayTreeValueIterable<K, V> extends IterableBase<V> implements Efficien
tLength {SplayTreeMap<K, V> _map; |
| 447 assert(!_workList.isEmpty); | 408 _SplayTreeValueIterable(this._map); |
| 448 } | 409 int get length => _map._count; |
| 449 } | 410 bool get isEmpty => _map._count == 0; |
| 450 bool moveNext() { | 411 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); |
| 451 if (_modificationCount != _tree._modificationCount) { | 412 } |
| 452 throw new ConcurrentModificationError(_tree); | 413 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> {_SplayTreeKeyIter
ator(_SplayTree<K> map) : super(map); |
| 453 } | 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); |
| 454 if (_workList.isEmpty) { | 415 } |
| 455 _currentNode = null; | 416 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> {_SplayTreeVa
lueIterator(SplayTreeMap<K, V> map) : super(map); |
| 456 return false; | 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); |
| 457 } | 418 } |
| 458 if (_tree._splayCount != _splayCount && _currentNode != null) { | 419 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> {
_SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); |
| 459 _rebuildWorkList(_currentNode); | 420 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) : super.startA
t(tree, startKey); |
| 460 } | 421 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, DDC$RT.ty
pe((_SplayTreeNode<dynamic> _) { |
| 461 _currentNode = _workList.removeLast(); | 422 } |
| 462 _findLeftMostDescendent(_currentNode.right); | 423 ), DDC$RT.type((_SplayTreeNode<K> _) { |
| 463 return true; | 424 } |
| 464 } | 425 ), "CastDynamic", """line 644, column 55 of dart:collection/splay_tree.dart: """
, node is _SplayTreeNode<K>, false); |
| 465 T _getValue(_SplayTreeNode node); | 426 } |
| 466 } | 427 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E>
{Comparator _comparator; |
| 467 class _SplayTreeKeyIterable<K> extends IterableBase<K> | 428 _Predicate _validKey; |
| 468 implements EfficientLength { | 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); |
| 469 _SplayTree<K> _tree; | 430 factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool
isValidKey(potentialKey)]) { |
| 470 _SplayTreeKeyIterable(this._tree); | 431 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); |
| 471 int get length => _tree._count; | 432 for (final E element in elements) { |
| 472 bool get isEmpty => _tree._count == 0; | 433 result.add(element); |
| 473 Iterator<K> get iterator => new _SplayTreeKeyIterator<K>(_tree); | 434 } |
| 474 Set<K> toSet() { | 435 return result; |
| 475 var setOrMap = _tree; | 436 } |
| 476 SplayTreeSet<K> set = | 437 int _compare(E e1, E e2) => _comparator(e1, e2); |
| 477 new SplayTreeSet<K>(setOrMap._comparator, setOrMap._validKey); | 438 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); |
| 478 set._count = _tree._count; | 439 int get length => _count; |
| 479 set._root = set._copyNode(_tree._root); | 440 bool get isEmpty => _root == null; |
| 480 return set; | 441 bool get isNotEmpty => _root != null; |
| 481 } | 442 E get first { |
| 482 } | 443 if (_count == 0) throw IterableElementError.noElement(); |
| 483 class _SplayTreeValueIterable<K, V> extends IterableBase<V> | 444 return DDC$RT.cast(_first.key, dynamic, E, "CastGeneral", """line 725, column 1
2 of dart:collection/splay_tree.dart: """, _first.key is E, false); |
| 484 implements EfficientLength { | 445 } |
| 485 SplayTreeMap<K, V> _map; | 446 E get last { |
| 486 _SplayTreeValueIterable(this._map); | 447 if (_count == 0) throw IterableElementError.noElement(); |
| 487 int get length => _map._count; | 448 return DDC$RT.cast(_last.key, dynamic, E, "CastGeneral", """line 730, column 12
of dart:collection/splay_tree.dart: """, _last.key is E, false); |
| 488 bool get isEmpty => _map._count == 0; | 449 } |
| 489 Iterator<V> get iterator => new _SplayTreeValueIterator<K, V>(_map); | 450 E get single { |
| 490 } | 451 if (_count == 0) throw IterableElementError.noElement(); |
| 491 class _SplayTreeKeyIterator<K> extends _SplayTreeIterator<K> { | 452 if (_count > 1) throw IterableElementError.tooMany(); |
| 492 _SplayTreeKeyIterator(_SplayTree<K> map) : super(map); | 453 return _root.key; |
| 493 K _getValue(_SplayTreeNode node) => DDC$RT.cast(node.key, dynamic, K, | 454 } |
| 494 "CastGeneral", | 455 bool contains(Object object) { |
| 495 """line 631, column 39 of dart:collection/splay_tree.dart: """, | 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; |
| 496 node.key is K, false); | 457 } |
| 497 } | 458 bool add(E element) { |
| 498 class _SplayTreeValueIterator<K, V> extends _SplayTreeIterator<V> { | 459 int compare = _splay(element); |
| 499 _SplayTreeValueIterator(SplayTreeMap<K, V> map) : super(map); | 460 if (compare == 0) return false; |
| 500 V _getValue(_SplayTreeMapNode node) => DDC$RT.cast(node.value, dynamic, V, | 461 _addNewRoot(((__x59) => DDC$RT.cast(__x59, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 501 "CastGeneral", | 462 } |
| 502 """line 636, column 42 of dart:collection/splay_tree.dart: """, | 463 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 503 node.value is V, false); | 464 } |
| 504 } | 465 ), "CastExact", """line 747, column 17 of dart:collection/splay_tree.dart: """,
__x59 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 505 class _SplayTreeNodeIterator<K> extends _SplayTreeIterator<_SplayTreeNode<K>> { | 466 return true; |
| 506 _SplayTreeNodeIterator(_SplayTree<K> tree) : super(tree); | 467 } |
| 507 _SplayTreeNodeIterator.startAt(_SplayTree<K> tree, var startKey) | 468 bool remove(Object object) { |
| 508 : super.startAt(tree, startKey); | 469 if (!_validKey(object)) return false; |
| 509 _SplayTreeNode<K> _getValue(_SplayTreeNode node) => DDC$RT.cast(node, | 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; |
| 510 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 471 } |
| 511 DDC$RT.type((_SplayTreeNode<K> _) {}), "CastDynamic", | 472 void addAll(Iterable<E> elements) { |
| 512 """line 644, column 55 of dart:collection/splay_tree.dart: """, | 473 for (E element in elements) { |
| 513 node is _SplayTreeNode<K>, false); | 474 int compare = _splay(element); |
| 514 } | 475 if (compare != 0) { |
| 515 class SplayTreeSet<E> extends _SplayTree<E> with IterableMixin<E>, SetMixin<E> { | 476 _addNewRoot(((__x60) => DDC$RT.cast(__x60, DDC$RT.type((_SplayTreeNode<dynamic>
_) { |
| 516 Comparator _comparator; | 477 } |
| 517 _Predicate _validKey; | 478 ), DDC$RT.type((_SplayTreeNode<E> _) { |
| 518 SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) | 479 } |
| 519 : _comparator = (compare == null) ? Comparable.compare : compare, | 480 ), "CastExact", """line 760, column 21 of dart:collection/splay_tree.dart: """,
__x60 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), compare); |
| 520 _validKey = (isValidKey != null) ? isValidKey : ((v) => v is E); | 481 } |
| 521 factory SplayTreeSet.from(Iterable elements, | 482 } |
| 522 [int compare(E key1, E key2), bool isValidKey(potentialKey)]) { | 483 } |
| 523 SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey); | 484 void removeAll(Iterable<Object> elements) { |
| 524 for (final E element in elements) { | 485 for (Object element in elements) { |
| 525 result.add(element); | 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)); |
| 526 } | 487 } |
| 527 return result; | 488 } |
| 528 } | 489 void retainAll(Iterable<Object> elements) { |
| 529 int _compare(E e1, E e2) => _comparator(e1, e2); | 490 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); |
| 530 Iterator<E> get iterator => new _SplayTreeKeyIterator<E>(this); | 491 int modificationCount = _modificationCount; |
| 531 int get length => _count; | 492 for (Object object in elements) { |
| 532 bool get isEmpty => _root == null; | 493 if (modificationCount != _modificationCount) { |
| 533 bool get isNotEmpty => _root != null; | 494 throw new ConcurrentModificationError(this); |
| 534 E get first { | 495 } |
| 535 if (_count == 0) throw IterableElementError.noElement(); | 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); |
| 536 return DDC$RT.cast(_first.key, dynamic, E, "CastGeneral", | 497 } |
| 537 """line 725, column 12 of dart:collection/splay_tree.dart: """, | 498 if (retainSet._count != _count) { |
| 538 _first.key is E, false); | 499 _root = retainSet._root; |
| 539 } | 500 _count = retainSet._count; |
| 540 E get last { | 501 _modificationCount++; |
| 541 if (_count == 0) throw IterableElementError.noElement(); | 502 } |
| 542 return DDC$RT.cast(_last.key, dynamic, E, "CastGeneral", | 503 } |
| 543 """line 730, column 12 of dart:collection/splay_tree.dart: """, | 504 E lookup(Object object) { |
| 544 _last.key is E, false); | 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); |
| 545 } | 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)); |
| 546 E get single { | 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); |
| 547 if (_count == 0) throw IterableElementError.noElement(); | 508 return _root.key; |
| 548 if (_count > 1) throw IterableElementError.tooMany(); | 509 } |
| 549 return _root.key; | 510 Set<E> intersection(Set<E> other) { |
| 550 } | 511 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); |
| 551 bool contains(Object object) { | 512 for (E element in this) { |
| 552 return _validKey(object) && | 513 if (other.contains(element)) result.add(element); |
| 553 _splay(DDC$RT.cast(object, Object, E, "CastGeneral", | 514 } |
| 554 """line 741, column 40 of dart:collection/splay_tree.dart: """, | 515 return result; |
| 555 object is E, false)) == | 516 } |
| 556 0; | 517 Set<E> difference(Set<E> other) { |
| 557 } | 518 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); |
| 558 bool add(E element) { | 519 for (E element in this) { |
| 559 int compare = _splay(element); | 520 if (!other.contains(element)) result.add(element); |
| 560 if (compare == 0) return false; | 521 } |
| 561 _addNewRoot(((__x59) => DDC$RT.cast(__x59, | 522 return result; |
| 562 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 523 } |
| 563 DDC$RT.type((_SplayTreeNode<E> _) {}), "CastExact", | 524 Set<E> union(Set<E> other) { |
| 564 """line 747, column 17 of dart:collection/splay_tree.dart: """, | 525 return _clone()..addAll(other); |
| 565 __x59 is _SplayTreeNode<E>, false))(new _SplayTreeNode(element)), | 526 } |
| 566 compare); | 527 SplayTreeSet<E> _clone() { |
| 567 return true; | 528 var set = new SplayTreeSet<E>(_comparator, _validKey); |
| 568 } | 529 set._count = _count; |
| 569 bool remove(Object object) { | 530 set._root = _copyNode(_root); |
| 570 if (!_validKey(object)) return false; | 531 return set; |
| 571 return _remove(DDC$RT.cast(object, Object, E, "CastGeneral", | 532 } |
| 572 """line 753, column 20 of dart:collection/splay_tree.dart: """, | 533 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { |
| 573 object is E, false)) != | 534 if (node == null) return null; |
| 574 null; | 535 return new _SplayTreeNode<E>(node.key)..left = _copyNode(node.left)..right = _c
opyNode(node.right); |
| 575 } | 536 } |
| 576 void addAll(Iterable<E> elements) { | 537 void clear() { |
| 577 for (E element in elements) { | 538 _clear(); |
| 578 int compare = _splay(element); | 539 } |
| 579 if (compare != 0) { | 540 Set<E> toSet() => _clone(); |
| 580 _addNewRoot(((__x60) => DDC$RT.cast(__x60, | 541 String toString() => IterableBase.iterableToFullString(this, '{', '}'); |
| 581 DDC$RT.type((_SplayTreeNode<dynamic> _) {}), | 542 } |
| 582 DDC$RT.type((_SplayTreeNode<E> _) {}), "CastExact", | |
| 583 """line 760, column 21 of dart:collection/splay_tree.dart: """, | |
| 584 __x60 is _SplayTreeNode<E>, | |
| 585 false))(new _SplayTreeNode(element)), compare); | |
| 586 } | |
| 587 } | |
| 588 } | |
| 589 void removeAll(Iterable<Object> elements) { | |
| 590 for (Object element in elements) { | |
| 591 if (_validKey(element)) _remove(DDC$RT.cast(element, Object, E, | |
| 592 "CastGeneral", | |
| 593 """line 767, column 39 of dart:collection/splay_tree.dart: """, | |
| 594 element is E, false)); | |
| 595 } | |
| 596 } | |
| 597 void retainAll(Iterable<Object> elements) { | |
| 598 SplayTreeSet<E> retainSet = new SplayTreeSet<E>(_comparator, _validKey); | |
| 599 int modificationCount = _modificationCount; | |
| 600 for (Object object in elements) { | |
| 601 if (modificationCount != _modificationCount) { | |
| 602 throw new ConcurrentModificationError(this); | |
| 603 } | |
| 604 if (_validKey(object) && | |
| 605 _splay(DDC$RT.cast(object, Object, E, "CastGeneral", | |
| 606 """line 781, column 39 of dart:collection/splay_tree.dart: """
, | |
| 607 object is E, false)) == | |
| 608 0) retainSet.add(_root.key); | |
| 609 } | |
| 610 if (retainSet._count != _count) { | |
| 611 _root = retainSet._root; | |
| 612 _count = retainSet._count; | |
| 613 _modificationCount++; | |
| 614 } | |
| 615 } | |
| 616 E lookup(Object object) { | |
| 617 if (!_validKey(object)) return ((__x61) => DDC$RT.cast(__x61, Null, E, | |
| 618 "CastLiteral", | |
| 619 """line 792, column 36 of dart:collection/splay_tree.dart: """, | |
| 620 __x61 is E, false))(null); | |
| 621 int comp = _splay(DDC$RT.cast(object, Object, E, "CastGeneral", | |
| 622 """line 793, column 23 of dart:collection/splay_tree.dart: """, | |
| 623 object is E, false)); | |
| 624 if (comp != 0) return ((__x62) => DDC$RT.cast(__x62, Null, E, "CastLiteral", | |
| 625 """line 794, column 27 of dart:collection/splay_tree.dart: """, | |
| 626 __x62 is E, false))(null); | |
| 627 return _root.key; | |
| 628 } | |
| 629 Set<E> intersection(Set<E> other) { | |
| 630 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); | |
| 631 for (E element in this) { | |
| 632 if (other.contains(element)) result.add(element); | |
| 633 } | |
| 634 return result; | |
| 635 } | |
| 636 Set<E> difference(Set<E> other) { | |
| 637 Set<E> result = new SplayTreeSet<E>(_comparator, _validKey); | |
| 638 for (E element in this) { | |
| 639 if (!other.contains(element)) result.add(element); | |
| 640 } | |
| 641 return result; | |
| 642 } | |
| 643 Set<E> union(Set<E> other) { | |
| 644 return _clone()..addAll(other); | |
| 645 } | |
| 646 SplayTreeSet<E> _clone() { | |
| 647 var set = new SplayTreeSet<E>(_comparator, _validKey); | |
| 648 set._count = _count; | |
| 649 set._root = _copyNode(_root); | |
| 650 return set; | |
| 651 } | |
| 652 _SplayTreeNode<E> _copyNode(_SplayTreeNode<E> node) { | |
| 653 if (node == null) return null; | |
| 654 return new _SplayTreeNode<E>(node.key) | |
| 655 ..left = _copyNode(node.left) | |
| 656 ..right = _copyNode(node.right); | |
| 657 } | |
| 658 void clear() { | |
| 659 _clear(); | |
| 660 } | |
| 661 Set<E> toSet() => _clone(); | |
| 662 String toString() => IterableBase.iterableToFullString(this, '{', '}'); | |
| 663 } | |
| OLD | NEW |