| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * @param {string} word | 54 * @param {string} word |
| 55 */ | 55 */ |
| 56 removeWord: function(word) | 56 removeWord: function(word) |
| 57 { | 57 { |
| 58 var count = this._words.get(word) || 0; | 58 var count = this._words.get(word) || 0; |
| 59 if (!count) | 59 if (!count) |
| 60 return; | 60 return; |
| 61 this._index.remove(word); | |
| 62 if (count === 1) { | 61 if (count === 1) { |
| 63 this._words.delete(word); | 62 this._words.delete(word); |
| 63 this._index.remove(word); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 --count; | 66 --count; |
| 67 this._words.set(word, count); | 67 this._words.set(word, count); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * @param {string} prefix | 71 * @param {string} prefix |
| 72 * @return {!Array.<string>} | 72 * @return {!Array.<string>} |
| 73 */ | 73 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 |