Set

Set

new Set()

Creates a Set instance.
Source:

Methods

add(elem)

Add an object to a set.
Source:
Parameters:
Name Type Description
elem elem A graphics object to be added.

clear()

Clears the elements in the set. Results in a set equal to a newly constructed instance.
Source:

contains(elem) → {boolean}

Check if a set contains an elem.
Source:
Parameters:
Name Type Description
elem elem A graphics object to be checked.
Returns:
Type:
boolean
Whether or not the set contains the elem.

containsKey() → {boolean}

Check if a set contains a key.
Source:
Returns:
Type:
boolean
Whether or not the set contains the key.

elems() → {dictionary}

Get the items in the set.
Source:
Returns:
Type:
dictionary
Dictionary of all items in the set

find(elem) → {elem|undefined}

Finds an elem in the set.
Source:
Parameters:
Name Type Description
elem elem An element to look for.
Returns:
Type:
elem | undefined
Either the element (if found) or undefined.

getKey(elem) → {string}

Extract a key from an object for the set dictionary.
Source:
Parameters:
Name Type Description
elem elem A graphics object to get a key for.
Returns:
Type:
string
A string representing the elen.

intersect(otherSet)

Remove items from the set if they are not contained in otherSet.
Source:
Parameters:
Name Type Description
otherSet Set A set with which an intersection should be created.

isEmpty() → {boolean}

Returns whether the set is empty.
Source:
Returns:
Type:
boolean
Whether or not the set is empty.

remove(elem)

Remove an object from a set.
Source:
Parameters:
Name Type Description
elem elem A graphics object to be removed.

size() → {number}

Get the number of elements in the set.
Source:
Returns:
Type:
number
Number of elements in the set.

toString() → {string}

Create a string representation of the set.
Source:
Returns:
Type:
string
String representation of the set Follows the syntax 'Set: {elem, elem, elem}'

union(otherSet)

Creates a union between two sets.
Source:
Parameters:
Name Type Description
otherSet Set A set with which a union should be created.