OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1391 |
1392 /** | 1392 /** |
1393 * @constructor | 1393 * @constructor |
1394 */ | 1394 */ |
1395 var StringSet = function() | 1395 var StringSet = function() |
1396 { | 1396 { |
1397 /** @type {!StringMap.<boolean>} */ | 1397 /** @type {!StringMap.<boolean>} */ |
1398 this._map = new StringMap(); | 1398 this._map = new StringMap(); |
1399 } | 1399 } |
1400 | 1400 |
| 1401 /** |
| 1402 * @param {!Array.<string>} array |
| 1403 */ |
| 1404 StringSet.fromArray = function(array) |
| 1405 { |
| 1406 var result = new StringSet(); |
| 1407 array.forEach(function(item) { result.add(item); }); |
| 1408 return result; |
| 1409 } |
| 1410 |
1401 StringSet.prototype = { | 1411 StringSet.prototype = { |
1402 /** | 1412 /** |
1403 * @param {string} value | 1413 * @param {string} value |
1404 */ | 1414 */ |
1405 put: function(value) | 1415 add: function(value) |
1406 { | 1416 { |
1407 this._map.put(value, true); | 1417 this._map.put(value, true); |
1408 }, | 1418 }, |
1409 | 1419 |
1410 /** | 1420 /** |
1411 * @param {string} value | 1421 * @param {string} value |
1412 * @return {boolean} | 1422 * @return {boolean} |
1413 */ | 1423 */ |
1414 remove: function(value) | 1424 remove: function(value) |
1415 { | 1425 { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 this._outgoingCallback(); | 1570 this._outgoingCallback(); |
1561 } | 1571 } |
1562 } | 1572 } |
1563 | 1573 |
1564 /** | 1574 /** |
1565 * @param {*} value | 1575 * @param {*} value |
1566 */ | 1576 */ |
1567 function suppressUnused(value) | 1577 function suppressUnused(value) |
1568 { | 1578 { |
1569 } | 1579 } |
OLD | NEW |