Fixing comments by fred

This commit is contained in:
Gregory John Casamento 2019-06-27 02:00:14 -04:00
parent ef438f7697
commit e2d3e67f16
2 changed files with 20 additions and 27 deletions

View file

@ -27,6 +27,8 @@
#ifndef _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE #ifndef _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE
#define _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE #define _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
#import <GNUstepBase/GSVersionMacros.h> #import <GNUstepBase/GSVersionMacros.h>
#import <GNUstepBase/GSBlocks.h> #import <GNUstepBase/GSBlocks.h>
@ -206,4 +208,6 @@ extern "C" {
} }
#endif #endif
#endif /* OS_API_VERSION check */
#endif /* _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE */ #endif /* _NSOrderedSet_h_GNUSTEP_BASE_INCLUDE */

View file

@ -481,10 +481,6 @@ static SEL rlSel;
id objs[] = {obj}; id objs[] = {obj};
self = [self initWithObjects: objs count: 1]; self = [self initWithObjects: objs count: 1];
if(self == nil)
{
NSLog(@"Problem initializing with one element");
}
return self; return self;
} }
@ -616,8 +612,7 @@ static SEL rlSel;
- (instancetype) init - (instancetype) init
{ {
[self subclassResponsibility: _cmd]; return [self initWithObjects: NULL count:0];
return nil;
} }
- (NSUInteger) count // required override - (NSUInteger) count // required override
@ -1151,9 +1146,11 @@ static SEL rlSel;
- (BOOL) isSubsetOfOrderedSet: (NSOrderedSet *)otherSet - (BOOL) isSubsetOfOrderedSet: (NSOrderedSet *)otherSet
{ {
id f = nil; id so = nil, oo = nil;
NSUInteger s = 0, l = [self count], i = 0; NSEnumerator *selfEnum = [self objectEnumerator];
NSEnumerator *otherEnum = [otherSet objectEnumerator];
NSUInteger l = [self count];
// -1. If this set is empty, this method should return YES. // -1. If this set is empty, this method should return YES.
if (l == 0) if (l == 0)
{ {
@ -1166,28 +1163,20 @@ static SEL rlSel;
return NO; return NO;
} }
// Find the first object's index in otherset, if not found so = [selfEnum nextObject]; // get first object in enum...
// it's not a subset... while((oo = [otherEnum nextObject]) != nil)
f = [self firstObject];
s = [otherSet indexOfObject: f];
if(s == NSNotFound)
{ {
return NO; if([oo isEqual: so]) // if object is equal advance
}
for(i = 0; i < l; i++)
{
NSUInteger j = s + i;
id oo = [otherSet objectAtIndex: j];
id o = [self objectAtIndex: i];
if([o isEqual: oo] == NO)
{ {
return NO; so = [selfEnum nextObject];
if(so == nil)
{
return YES; // if we are done with iterating self, then it's a subset.
}
} }
} }
return YES; // if all members are in set. return NO; // if all members are in set.
} }
- (BOOL) isSubsetOfSet:(NSSet *)otherSet - (BOOL) isSubsetOfSet:(NSSet *)otherSet