home *** CD-ROM | disk | FTP | other *** search
- intersect: aSet
- "Return the intersection of two sets"
-
-
- ^ self select: [: anObject |
- aSet includes: anObject
- ].
-
-
- isSubsetOf: aSet
- "Return true if self is a subset of aSet"
-
- ^ (self select: [: anObject |
- aSet includes: anObject
- ]) size = (self size).
-
-
- notIntersect: aSet
- "Return the set of everything but
- the intersection of self and aSet"
-
- ^ (self select: [: anObject |
- (aSet includes: anObject) not
- ]) union: (aSet select: [: anObject |
- (self includes: anObject) not
- ]).
-
-
- union: aSet
- "Return the union of two sets"
-
- | newSet |
-
- newSet := Set new.
- self do: [: anObject |
- newSet add: anObject
- ].
- aSet do: [: anObject |
- newSet add: anObject
- ].
- ^ newSet.