Class StringSet
An object that holds a set of strings, with basic set operations.
Defined in: <global\utilities.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
StringSet(initialString1, initialString2, etc)
Constructor for an object that holds a set of strings, with basic
set operations.
|
| Method Attributes | Method Name and Description |
|---|---|
|
add(x)
Adds the given string to the set if it is not already in it.
|
|
|
contains(x)
Returns whether this set contains the given string.
|
|
|
forEach(f)
Iterators over the strings in the set, calling the provided
function on each element.
|
|
|
remove(x)
Removes the given string from the set if it is contained in it.
|
Class Detail
StringSet(initialString1, initialString2, etc)
Constructor for an object that holds a set of strings, with basic
set operations. This is better for keeping track of a set than
using an associative arrays, because it avoids key collisions with
javascript built-ins like 'toString', 'class', etc.
- Parameters:
- {string} initialString1
- {string} initialString2
- {string} etc
- ...
Method Detail
add(x)
Adds the given string to the set if it is not already in it.
- Parameters:
- {string} x
{boolean}
contains(x)
Returns whether this set contains the given string.
- Parameters:
- {string} x
- Returns:
- {boolean} Whether x exits in this set.
forEach(f)
Iterators over the strings in the set, calling the provided
function on each element.
- Parameters:
- {function} f
- The function to call on each string in the set.
remove(x)
Removes the given string from the set if it is contained in it.
- Parameters:
- {string} x
- The string to remove from the set.