| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |