Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: sdk/lib/collection/splay_tree.dart

Issue 274563008: Fix bug in SplayTreeSet when removeWhere removes all elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/corelib/splay_tree_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.collection; 5 part of dart.collection;
6 6
7 typedef bool _Predicate<T>(T value); 7 typedef bool _Predicate<T>(T value);
8 8
9 /** 9 /**
10 * A node in a splay tree. It holds the sorting key and the left 10 * A node in a splay tree. It holds the sorting key and the left
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 _SplayTreeIterator(_SplayTree tree) 516 _SplayTreeIterator(_SplayTree tree)
517 : _tree = tree, 517 : _tree = tree,
518 _modificationCount = tree._modificationCount, 518 _modificationCount = tree._modificationCount,
519 _splayCount = tree._splayCount { 519 _splayCount = tree._splayCount {
520 _findLeftMostDescendent(tree._root); 520 _findLeftMostDescendent(tree._root);
521 } 521 }
522 522
523 _SplayTreeIterator.startAt(_SplayTree tree, var startKey) 523 _SplayTreeIterator.startAt(_SplayTree tree, var startKey)
524 : _tree = tree, 524 : _tree = tree,
525 _modificationCount = tree._modificationCount { 525 _modificationCount = tree._modificationCount {
526 if (tree._root == null) return;
526 int compare = tree._splay(startKey); 527 int compare = tree._splay(startKey);
527 _splayCount = tree._splayCount; 528 _splayCount = tree._splayCount;
528 if (compare < 0) { 529 if (compare < 0) {
529 // Don't include the root, start at the next element after the root. 530 // Don't include the root, start at the next element after the root.
530 _findLeftMostDescendent(tree._root.right); 531 _findLeftMostDescendent(tree._root.right);
531 } else { 532 } else {
532 _workList.add(tree._root); 533 _workList.add(tree._root);
533 } 534 }
534 } 535 }
535 536
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 819
819 bool containsAll(Iterable<Object> other) { 820 bool containsAll(Iterable<Object> other) {
820 for (var element in other) { 821 for (var element in other) {
821 if (!this.contains(element)) return false; 822 if (!this.contains(element)) return false;
822 } 823 }
823 return true; 824 return true;
824 } 825 }
825 826
826 void clear() { _clear(); } 827 void clear() { _clear(); }
827 } 828 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/splay_tree_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698