|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Set
Defined in Set.js
Field Summary | |
Integer |
cardinality
the cardinality ("dimension") of the set |
Array |
elements
the elements of the set |
<static> <final> Set |
empty
the empty set {} |
Constructor Summary | |
Set(<Object> elements)
Constructor function for a new set. |
Method Summary | |
void
|
addElement(<Object> el)
Adds a new element to the set and updates the cardinality. |
Set
|
cartesianProduct(<Set> set)
Calculates the Cartesian product of two sets (the set of all ordered pairs, which are here treated as subsets. |
Set
|
complement(<Set> set)
Creates a new set that is the relative complement of two sets. |
Boolean
|
equalTo(<Set> set)
Tests whether or not two sets (including subsets, which must be defined as sets and not simply arrays) are equal. |
Number
|
indexOf(<Object> el)
Finds the index of the first occurence of the specified element. |
Boolean
|
inSet(el)
Determines if a specified element is in the set of this group. |
Set
|
intersection(<Set> set)
Creates a new set out of the intersection (shared elements) of two sets. |
Boolean
|
properSubsetOf(<Set> set)
Tests if this set is a proper subset of a given set (i.e. |
Boolean
|
properSupersetOf(<Set> set)
Tests whether or not this set is a proper superset of a given set. |
void
|
removeElement(<Object> el)
Removes ALL OCCURENCES of an element from the set and updates the cardinality. |
Boolean
|
subsetOf(<Set> set)
Tests to see if a set is a subset (not necessarily a proper subset; i.e. |
Boolean
|
supersetOf(<Set> set)
Tests if the set is a superset of a given set. |
String
|
toString()
Returns a string representation of the set (and subsets). |
Set
|
union(<Set> set)
Creates a new set that is the union of two sets. |
<static> Set
|
zero(<Integer> n)
Creates a set with n zero elements |
Field Detail |
Integer cardinality
Array elements
<static> <final> Set empty
Constructor Detail |
Set(<Object> elements)
elements
- Array to become the elements of the set; if a set, will construct a new clone of the set; if not provided, constructs an empty set
Method Detail |
void addElement(<Object> el)
el
- the element to be added
Set cartesianProduct(<Set> set)
set
- the set with which to compute the product
Set complement(<Set> set)
set
- the set to which to find the complement
Boolean equalTo(<Set> set)
set
- the set to compare to
Number indexOf(<Object> el)
el
- the element for which to find the index
Boolean inSet(el)
Set intersection(<Set> set)
set
- the set with which to find the intersection
Boolean properSubsetOf(<Set> set)
set
- the set which may or may not be a strict superset
Boolean properSupersetOf(<Set> set)
set
- the set which may or may not be a proper subset
void removeElement(<Object> el)
el
- the element to be removed
Boolean subsetOf(<Set> set)
set
- the set that may or may not be a superset of the original
Boolean supersetOf(<Set> set)
set
- the set which may or may not be a subset of the original
String toString()
Set union(<Set> set)
set
- the set to join with the current set
<static> Set zero(<Integer> n)
n
- the number of elements in the zero set
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |