# Set

#### new Set()

Creates a Set instance.

Source:
  - datastructures/set.js, line 7

### Methods

#### add(elem)

Add an object to a set.

##### Parameters:

Name | Type | Description
--- | --- | ---
`elem` | elem | A graphics object to be added.

Source:
  - datastructures/set.js, line 53

#### clear()

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

Source:
  - datastructures/set.js, line 32

#### contains(elem) → {boolean}

Check if a set contains an elem.

##### Parameters:

Name | Type | Description
--- | --- | ---
`elem` | elem | A graphics object to be checked.

Source:
  - datastructures/set.js, line 94

##### Returns:

Whether or not the set contains the elem.

Type
  boolean

#### containsKey() → {boolean}

Check if a set contains a key.

Source:
  - datastructures/set.js, line 85

##### Returns:

Whether or not the set contains the key.

Type
  boolean

#### elems() → {dictionary}

Get the items in the set.

Source:
  - datastructures/set.js, line 102

##### 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:
  - datastructures/set.js, line 111

##### 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:
  - datastructures/set.js, line 42

##### 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:
  - datastructures/set.js, line 130

#### isEmpty() → {boolean}

Returns whether the set is empty.

Source:
  - datastructures/set.js, line 24

##### 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:
  - datastructures/set.js, line 68

#### size() → {number}

Get the number of elements in the set.

Source:
  - datastructures/set.js, line 16

##### Returns:

Number of elements in the set.

Type
  number

#### toString() → {string}

Create a string representation of the set.

Source:
  - datastructures/set.js, line 150

##### 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:
  - datastructures/set.js, line 120