Class Set
Defined in: DataStructures.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Set()
Class for managing a set.
|
Field Attributes | Field Name and Description |
---|---|
The elements stored.
|
|
The parents of the set.
|
|
The subsets of this set.
|
|
The size of the set.
|
Method Attributes | Method Name and Description |
---|---|
addSubset(set)
Adds the subset.
|
|
addSubsets(sets)
Adds the subsets.
|
|
cartesianProduct(set)
Returns the set that represents the cartesian product of two sets.
|
|
clone()
Clones the set into a new set.
|
|
difference(set)
Returns the set that represents the difference of two sets.
|
|
Returns the cardinality of the set.
|
|
getItems()
Returns the items that are stored in the set.
|
|
insert(element)
Adds the element to the set.
|
|
intersect(set)
Returns the set that represents the intersection of two sets.
|
|
isEmpty()
Checks if the set is empty.
|
|
multiInsert(elements)
Adds the elements to the set.
|
|
union(set)
Returns the set that represents the union of two sets.
|
Field Detail
elements
The elements stored.
parents
The parents of the set.
sets
The subsets of this set.
size
The size of the set. It's equal to his cardinality.
Method Detail
addSubset(set)
Adds the subset.
- Parameters:
- set
- {Set} The subset.
addSubsets(sets)
Adds the subsets.
- Parameters:
- sets
- {Array
} The subsets.
{Set}
cartesianProduct(set)
Returns the set that represents the cartesian product of two sets.
- Parameters:
- set
- {Set} The set to make the cartesian product with this.
- Returns:
- {Set} The set that represents the cartesian product .
{Set}
clone()
Clones the set into a new set.
- Returns:
- {Set} The set cloned from this set.
{Set}
difference(set)
Returns the set that represents the difference of two sets.
- Parameters:
- set
- {Set} The set to difference with this.
- Returns:
- {Set} The set that represents the difference.
{number}
getCardinality()
Returns the cardinality of the set.
- Returns:
- {number} The cardinality of the set.
{Array}
getItems()
Returns the items that are stored in the set.
- Returns:
- {Array} The items stored.
{void}
insert(element)
Adds the element to the set.
- Parameters:
- element
- {Element} The element to add.
- Returns:
- {void}
{Set}
intersect(set)
Returns the set that represents the intersection of two sets.
- Parameters:
- set
- {Set} The set to intersect with this.
- Returns:
- {Set} The set that represents the intersection.
{boolean}
isEmpty()
Checks if the set is empty.
- Returns:
- {boolean} True if the set is empty, false otherwise.
{void}
multiInsert(elements)
Adds the elements to the set.
- Parameters:
- elements
- {Array
} The elements to add.
- Returns:
- {void}
{Set}
union(set)
Returns the set that represents the union of two sets.
- Parameters:
- set
- {Set} The set with make the union.
- Returns:
- {Set} The set that represents the union.