| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library index.b_plus_tree; | 5 library index.b_plus_tree; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 } else if (compare > 0) { | 663 } else if (compare > 0) { |
| 664 lo = mid + 1; | 664 lo = mid + 1; |
| 665 } else { | 665 } else { |
| 666 return mid; | 666 return mid; |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 return lo; | 669 return lo; |
| 670 } | 670 } |
| 671 | 671 |
| 672 void _insertNotFull(K key, V value, int index) { | 672 void _insertNotFull(K key, V value, int index) { |
| 673 if (index < keys.length && keys[index] == key) { | 673 if (index < keys.length && comparator(keys[index], key) == 0) { |
| 674 values[index] = value; | 674 values[index] = value; |
| 675 } else { | 675 } else { |
| 676 keys.insert(index, key); | 676 keys.insert(index, key); |
| 677 values.insert(index, value); | 677 values.insert(index, value); |
| 678 } | 678 } |
| 679 tree._writeLeafNode(this); | 679 tree._writeLeafNode(this); |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 | 682 |
| 683 | 683 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 765 |
| 766 /** | 766 /** |
| 767 * A container with information about split during insert. | 767 * A container with information about split during insert. |
| 768 */ | 768 */ |
| 769 class _Split<K, N> { | 769 class _Split<K, N> { |
| 770 final K key; | 770 final K key; |
| 771 final N left; | 771 final N left; |
| 772 final N right; | 772 final N right; |
| 773 _Split(this.key, this.left, this.right); | 773 _Split(this.key, this.left, this.right); |
| 774 } | 774 } |
| OLD | NEW |