OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 */ | 7 */ |
8 WebInspector.Trie = function() | 8 WebInspector.Trie = function() |
9 { | 9 { |
10 this.clear(); | 10 this.clear(); |
11 } | 11 }; |
12 | 12 |
13 WebInspector.Trie.prototype = { | 13 WebInspector.Trie.prototype = { |
14 /** | 14 /** |
15 * @param {string} word | 15 * @param {string} word |
16 */ | 16 */ |
17 add: function(word) | 17 add: function(word) |
18 { | 18 { |
19 var node = this._root; | 19 var node = this._root; |
20 ++this._wordsInSubtree[this._root]; | 20 ++this._wordsInSubtree[this._root]; |
21 for (var i = 0; i < word.length; ++i) { | 21 for (var i = 0; i < word.length; ++i) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 this._root = 0; | 134 this._root = 0; |
135 /** @type {!Array<!Object<string, number>>} */ | 135 /** @type {!Array<!Object<string, number>>} */ |
136 this._edges = [{ __proto__: null }]; | 136 this._edges = [{ __proto__: null }]; |
137 /** @type {!Array<boolean>} */ | 137 /** @type {!Array<boolean>} */ |
138 this._isWord = [false]; | 138 this._isWord = [false]; |
139 /** @type {!Array<number>} */ | 139 /** @type {!Array<number>} */ |
140 this._wordsInSubtree = [0]; | 140 this._wordsInSubtree = [0]; |
141 /** @type {!Array<number>} */ | 141 /** @type {!Array<number>} */ |
142 this._freeNodes = []; | 142 this._freeNodes = []; |
143 } | 143 } |
144 } | 144 }; |
OLD | NEW |