OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 */ | 33 */ |
34 WebInspector.TextDictionary = function() | 34 WebInspector.TextDictionary = function() |
35 { | 35 { |
36 /** @type {!Map<string, number>} */ | 36 /** @type {!Map<string, number>} */ |
37 this._words = new Map(); | 37 this._words = new Map(); |
38 this._index = new WebInspector.Trie(); | 38 this._index = new WebInspector.Trie(); |
39 } | 39 }; |
40 | 40 |
41 WebInspector.TextDictionary.prototype = { | 41 WebInspector.TextDictionary.prototype = { |
42 /** | 42 /** |
43 * @param {string} word | 43 * @param {string} word |
44 */ | 44 */ |
45 addWord: function(word) | 45 addWord: function(word) |
46 { | 46 { |
47 var count = this._words.get(word) || 0; | 47 var count = this._words.get(word) || 0; |
48 ++count; | 48 ++count; |
49 this._words.set(word, count); | 49 this._words.set(word, count); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 wordCount: function(word) | 92 wordCount: function(word) |
93 { | 93 { |
94 return this._words.get(word) || 0; | 94 return this._words.get(word) || 0; |
95 }, | 95 }, |
96 | 96 |
97 reset: function() | 97 reset: function() |
98 { | 98 { |
99 this._words.clear(); | 99 this._words.clear(); |
100 this._index.clear(); | 100 this._index.clear(); |
101 } | 101 } |
102 } | 102 }; |
OLD | NEW |