OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 this.root_.right = null; | 87 this.root_.right = null; |
88 } else { | 88 } else { |
89 node.right = this.root_; | 89 node.right = this.root_; |
90 node.left = this.root_.left; | 90 node.left = this.root_.left; |
91 this.root_.left = null; | 91 this.root_.left = null; |
92 } | 92 } |
93 this.root_ = node; | 93 this.root_ = node; |
94 }; | 94 }; |
95 | 95 |
96 | 96 |
97 | |
98 /** | 97 /** |
99 * Removes a node with the specified key from the tree if the tree | 98 * Removes a node with the specified key from the tree if the tree |
100 * contains a node with this key. The removed node is returned. If the | 99 * contains a node with this key. The removed node is returned. If the |
101 * key is not found, an exception is thrown. | 100 * key is not found, an exception is thrown. |
102 * | 101 * |
103 * @param {number} key Key to find and remove from the tree. | 102 * @param {number} key Key to find and remove from the tree. |
104 * @return {goog.structs.SplayTree.Node} The removed node. | 103 * @return {goog.structs.SplayTree.Node} The removed node. |
105 */ | 104 */ |
106 goog.structs.SplayTree.prototype.remove = function(key) { | 105 goog.structs.SplayTree.prototype.remove = function(key) { |
107 if (this.isEmpty()) { | 106 if (this.isEmpty()) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 /** | 312 /** |
314 * @type {goog.structs.SplayTree.Node} | 313 * @type {goog.structs.SplayTree.Node} |
315 */ | 314 */ |
316 goog.structs.SplayTree.Node.prototype.left = null; | 315 goog.structs.SplayTree.Node.prototype.left = null; |
317 | 316 |
318 | 317 |
319 /** | 318 /** |
320 * @type {goog.structs.SplayTree.Node} | 319 * @type {goog.structs.SplayTree.Node} |
321 */ | 320 */ |
322 goog.structs.SplayTree.Node.prototype.right = null; | 321 goog.structs.SplayTree.Node.prototype.right = null; |
OLD | NEW |