NSSet additions, better NSDebugLog, added defs

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2854 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1998-07-15 16:33:33 +00:00
parent f0ed2cd3b8
commit 99692ecb51
11 changed files with 183 additions and 18 deletions

View file

@ -249,14 +249,46 @@ static Class NSMutableSet_concrete_class;
- (BOOL) intersectsSet: (NSSet*) otherSet
{
[self notImplemented:_cmd];
id o = nil, e = nil;
// -1. If this set is empty, this method should return NO.
if ([self count] == 0) return NO;
// 0. Loop for all members in otherSet
e = [otherSet objectEnumerator];
while ((o = [e nextObject])) // 1. pick a member from otherSet.
{
if ([self member: o]) // 2. check the member is in this set(self).
return YES;
}
return NO;
}
- (BOOL) isSubsetOfSet: (NSSet*) otherSet
{
[self notImplemented:_cmd];
return NO;
id o = nil, e = nil;
// -1. members of this set(self) <= that of otherSet
if ([self count] > [otherSet count]) return NO;
// 0. Loop for all members in this set(self).
e = [self objectEnumerator];
while ((o = [e nextObject]))
{
// 1. check the member is in the otherSet.
if ([otherSet member: o])
{
// 1.1 if true -> continue, try to check the next member.
continue ;
}
else
{
// 1.2 if false -> return NO;
return NO;
}
}
// 2. return YES; all members in this set are also in the otherSet.
return YES;
}
- (BOOL) isEqual: other