18 - (id)initWithCapacity:(
unsigned)aCapacity
27 + (id)setWithCapacity:(CPUInteger)aCapacity
29 return [[
self alloc] initWithCapacity:aCapacity];
31 - (void)filterUsingPredicate:(CPPredicate)aPredicate
38 objectEnumerator = [
self objectEnumerator];
40 while ((
object = [objectEnumerator nextObject]) !== nil)
41 if (![aPredicate evaluateWithObject:
object])
42 [
self removeObject:object];
49 - (void)removeObject:(
id)anObject
51 _CPRaiseInvalidAbstractInvocation(
self, _cmd);
58 - (void)removeObjectsInArray:(CPArray)anArray
61 count = [anArray count];
63 for (; index < count; ++index)
64 [
self removeObject:[anArray objectAtIndex:index]];
70 - (void)removeAllObjects
73 objectEnumerator = [
self objectEnumerator];
75 while ((
object = [objectEnumerator nextObject]) !== nil)
83 - (void)addObjectsFromArray:(CPArray)objects
85 var count = [objects count];
88 [
self addObject:objects[count]];
95 - (void)unionSet:(CPSet)aSet
98 objectEnumerator = [aSet objectEnumerator];
100 while ((
object = [objectEnumerator nextObject]) !== nil)
101 [
self addObject:object];
108 - (void)minusSet:(CPSet)aSet
111 objectEnumerator = [aSet objectEnumerator];
113 while ((
object = [objectEnumerator nextObject]) !== nil)
121 - (void)intersectSet:(CPSet)aSet
124 objectEnumerator = [
self objectEnumerator],
125 objectsToRemove = [];
127 while ((
object = [objectEnumerator nextObject]) !== nil)
128 if (![aSet containsObject:
object])
129 objectsToRemove.push(
object);
131 var count = [objectsToRemove count];
141 - (void)setSet:(CPSet)aSet