Méthode |
Description |
|
__construct ( array $members = [] ) |
Constructor - Initialize set members |
|
__toString ( ) : string |
Return the set as a string
Set{a, b, c, . |
|
add ( mixed $x ) : Set |
Add an element to the set
Does nothing if element already exists in the set. |
|
addMulti ( array $members ) : Set |
Add an array of elements to the set
Does nothing if element already exists in the set. |
|
asArray ( ) : array |
Get the set as an array |
|
cartesianProduct ( Set $B ) : Set |
Cartesian product (A×B)
Produces a new set by associating every element of the set with every
element of the other set. |
|
clear ( ) : Set |
Clear the set. Removes all members. |
|
copy ( ) : Set |
Copy
Produces a new set with the same elements as the set. |
|
count ( ) : integer |
Countable interface
Computes cardinality of a set S, |S| |
|
current ( ) |
Current (Iterator interface) |
|
difference ( variadic $Bs ) : Set |
Difference (relative complement) (A ∖ B) or (A - B)
Produces a new set with elements that are not in the other sets. |
|
intersect ( variadic $Bs ) : Set |
Intersect (A ∩ B)
Produces a new set with all the elements common to all sets. |
|
isDisjoint ( Set $other ) : boolean |
Disjoint
Does the set have no elements in common with the other set? |
|
isEmpty ( ) : boolean |
************************************************************************
SET PROPERTIES
- Empty set
************************************************************************ |
|
isMember ( mixed $x ) : boolean |
Set membership (x ∈ A)
Is x a member of the set? |
|
isNotMember ( mixed $x ) : boolean |
Set non-membership (x ∉ A)
Is x not a member of the set? |
|
isProperSubset ( Set $B ) : boolean |
Proper subset (A ⊆ B & A ≠ B)
Is the set a proper subset of the other set?
In other words, does the other set contain all the elements of the set,
and the set is not the same set as the other set? |
|
isProperSuperset ( Set $B ) : boolean |
Superset (A ⊇ B & A ≠ B)
Is the set a superset of the other set?
In other words, does the the set contain all the elements of the other set,
and the set is not the same set as the other set? |
|
isSubset ( Set $B ) : boolean |
Subset (A ⊆ B)
Is the set a subset of the other set?
In other words, does the other set contain all the elements of the set? |
|
isSuperset ( Set $B ) : boolean |
Superset (A ⊇ B)
Is the set a superset of the other set?
In other words, does the the set contain all the elements of the other set? |
|
key ( ) |
Key (Iterator interface) |
|
length ( ) : integer |
Get length of set (number of members in set) |
|
next ( ) |
Next (Iterator interface) |
|
powerSet ( ) : Set |
Power set P(S)
The set of all subsets of S, including the empty set and S itself. |
|
remove ( mixed $x ) : Set |
Remove an element from the set
Does nothing if the element does not exist in the set. |
|
removeMulti ( array $x ) : Set |
Remove elements from the set
Does nothing if the element does not exist in the set. |
|
rewind ( ) |
Rewind (Iterator interface) |
|
symmetricDifference ( Set $B ) : Set |
Symmetric Difference (A Δ B) = (A ∖ B) ∪ (B ∖ A)
Produces a new set with elements that are in the set or the other,
but not both. |
|
union ( variadic $Bs ) : Set |
Union (A ∪ B)
Produces a new set with all elements from all sets. |
|
valid ( ) : boolean |
Valid (Iterator interface) |
|