Set

Set

new Set()

Creates a Set instance.
Source:

Methods

add(elem)

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

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.
Parameters:
Name Type Description
elem elem A graphics object to be checked.
Source:
Returns:
Whether or not the set contains the elem.
Type
boolean

containsKey() → {boolean}

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

elems() → {dictionary}

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

find(elem) → {elem|undefined}

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

getKey(elem) → {string}

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

intersect(otherSet)

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

isEmpty() → {boolean}

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

remove(elem)

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

size() → {number}

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

toString() → {string}

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

union(otherSet)

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