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; | |
6 | |
7 /** | 5 /** |
8 * A node in a splay tree. It holds the key, the value and the left | 6 * A node in a splay tree. It holds the key, the value and the left |
9 * and right children in the tree. | 7 * and right children in the tree. |
10 */ | 8 */ |
11 class SplayTreeNode<K, V> { | 9 class SplayTreeNode<K, V> { |
12 SplayTreeNode(K this.key, V this.value); | 10 SplayTreeNode(K this.key, V this.value); |
13 | 11 |
14 K key; | 12 K key; |
15 V value; | 13 V value; |
16 SplayTreeNode<K, V> left; | 14 SplayTreeNode<K, V> left; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (node.key.compareTo(key) > 0) { | 297 if (node.key.compareTo(key) > 0) { |
300 return visit(node.left, node.key); | 298 return visit(node.left, node.key); |
301 } | 299 } |
302 if (node.key.compareTo(key) <= 0) { | 300 if (node.key.compareTo(key) <= 0) { |
303 return visit(node.right, ifEmpty); | 301 return visit(node.right, ifEmpty); |
304 } | 302 } |
305 } | 303 } |
306 return visit(_root, null); | 304 return visit(_root, null); |
307 } | 305 } |
308 } | 306 } |
OLD | NEW |