Code simplification

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8275 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-12-07 23:07:37 +00:00
parent 505a02bc00
commit 68bda2e25c
6 changed files with 20 additions and 59 deletions

View file

@ -3,8 +3,9 @@
* Source/NSGSet.m: renamed to GSSet.m for consistency, tidied. * Source/NSGSet.m: renamed to GSSet.m for consistency, tidied.
* Source/NSGCountedSet.m: renamed to GSCountedSet.m for consistency. * Source/NSGCountedSet.m: renamed to GSCountedSet.m for consistency.
* Headers/Foundation/NSGSet.h: removed - obsolete. * Headers/Foundation/NSGSet.h: removed - obsolete.
* Headers/Foundation/NSSet.h: si9mplified back to single class
* Source/NSSet.m: Updated and tidied. Fixed coding class for * Source/NSSet.m: Updated and tidied. Fixed coding class for
mutable sets. mutable sets. Removed non-core classes.
2000-12-05 Richard Frith-Macdonald <rfm@gnu.org> 2000-12-05 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -36,34 +36,29 @@
+ (id) setWithObjects: (id)anObject, ...; + (id) setWithObjects: (id)anObject, ...;
+ (id) setWithSet: (NSSet*)aSet; + (id) setWithSet: (NSSet*)aSet;
- (id) initWithObjects: (id*)objects
count: (unsigned)count;
- (unsigned) count;
- (id) member: (id)anObject;
- (NSEnumerator*) objectEnumerator;
@end
@interface NSSet (NonCore)
- (id) initWithArray: (NSArray*)array;
- (id) initWithObjects: (id)objects, ...;
- (id) initWithObjects: firstObject rest: (va_list)ap;
- (id) initWithSet: (NSSet*)otherSet;
- (id) initWithSet: (NSSet*)otherSet copyItems: (BOOL)flags;
- (NSArray*) allObjects; - (NSArray*) allObjects;
- (id) anyObject; - (id) anyObject;
- (BOOL) containsObject: (id)anObject; - (BOOL) containsObject: (id)anObject;
- (void) makeObjectsPerform: (SEL)aSelector; - (unsigned) count;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument; - (NSString*) descriptionWithLocale: (NSDictionary*)ld;
- (id) initWithArray: (NSArray*)array;
- (id) initWithObjects: (id)objects, ...;
- (id) initWithObjects: (id*)objects
count: (unsigned)count;
- (id) initWithObjects: firstObject
rest: (va_list)ap;
- (id) initWithSet: (NSSet*)otherSet;
- (id) initWithSet: (NSSet*)otherSet copyItems: (BOOL)flags;
- (BOOL) intersectsSet: (NSSet*)other; - (BOOL) intersectsSet: (NSSet*)other;
- (BOOL) isEqualToSet: (NSSet*)other; - (BOOL) isEqualToSet: (NSSet*)other;
- (BOOL) isSubsetOfSet: (NSSet*)other; - (BOOL) isSubsetOfSet: (NSSet*)other;
- (NSString*) descriptionWithLocale: (NSDictionary*)ld; - (void) makeObjectsPerform: (SEL)aSelector;
- (void) makeObjectsPerform: (SEL)aSelector withObject: (id)argument;
- (id) member: (id)anObject;
- (NSEnumerator*) objectEnumerator;
@end @end
@ -71,19 +66,14 @@
+ (id) setWithCapacity: (unsigned)numItems; + (id) setWithCapacity: (unsigned)numItems;
- (id) initWithCapacity: (unsigned)numItems;
- (void) addObject: (id)anObject; - (void) addObject: (id)anObject;
- (void) removeObject: (id)anObject;
@end
@interface NSMutableSet (NonCore)
- (void) addObjectsFromArray: (NSArray*)array; - (void) addObjectsFromArray: (NSArray*)array;
- (void) unionSet: (NSSet*)other; - (id) initWithCapacity: (unsigned)numItems;
- (void) intersectSet: (NSSet*)other; - (void) intersectSet: (NSSet*)other;
- (void) minusSet: (NSSet*)other; - (void) minusSet: (NSSet*)other;
- (void) removeAllObjects; - (void) removeAllObjects;
- (void) removeObject: (id)anObject;
- (void) unionSet: (NSSet*)other;
@end @end
@ -112,7 +102,7 @@
* GSUnique() returns an object that is equal to the one passed to it. * GSUnique() returns an object that is equal to the one passed to it.
* If the returned object is not the same object as the object passed in, * If the returned object is not the same object as the object passed in,
* the original object is released and the returned object is retained. * the original object is released and the returned object is retained.
* Thus, an -init metod that wants to implement uniquing simply needs * Thus, an -init method that wants to implement uniquing simply needs
* to end with 'return GSUnique(self);' * to end with 'return GSUnique(self);'
*/ */
void GSUniquing(BOOL flag); void GSUniquing(BOOL flag);

View file

@ -39,9 +39,6 @@
#include <base/GSIMap.h> #include <base/GSIMap.h>
@class NSSetNonCore;
@class NSMutableSetNonCore;
@interface GSCountedSet : NSCountedSet @interface GSCountedSet : NSCountedSet
{ {
@public @public
@ -96,8 +93,6 @@
{ {
if (self == [GSCountedSet class]) if (self == [GSCountedSet class])
{ {
class_add_behavior(self, [NSSetNonCore class]);
class_add_behavior(self, [NSMutableSetNonCore class]);
} }
} }

View file

@ -39,9 +39,6 @@
#include <base/GSIMap.h> #include <base/GSIMap.h>
@class NSSetNonCore;
@class NSMutableSetNonCore;
@interface GSSet : NSSet @interface GSSet : NSSet
{ {
@public @public
@ -107,7 +104,6 @@ static Class mutableSetClass;
{ {
if (self == [GSSet class]) if (self == [GSSet class])
{ {
class_add_behavior(self, [NSSetNonCore class]);
arrayClass = [NSArray class]; arrayClass = [NSArray class];
setClass = [GSSet class]; setClass = [GSSet class];
mutableSetClass = [GSMutableSet class]; mutableSetClass = [GSMutableSet class];
@ -424,7 +420,6 @@ static Class mutableSetClass;
{ {
if (self == [GSMutableSet class]) if (self == [GSMutableSet class])
{ {
class_add_behavior(self, [NSMutableSetNonCore class]);
class_add_behavior(self, [GSSet class]); class_add_behavior(self, [GSSet class]);
} }
} }

View file

@ -33,8 +33,6 @@
#include <Foundation/NSThread.h> #include <Foundation/NSThread.h>
#include <Foundation/NSObjCRuntime.h> #include <Foundation/NSObjCRuntime.h>
@class NSSetNonCore;
@class NSMutableSetNonCore;
@class GSCountedSet; @class GSCountedSet;
/* /*
@ -62,8 +60,6 @@ static Class NSCountedSet_concrete_class;
{ {
NSCountedSet_abstract_class = self; NSCountedSet_abstract_class = self;
NSCountedSet_concrete_class = [GSCountedSet class]; NSCountedSet_concrete_class = [GSCountedSet class];
behavior_class_add_class(self, [NSMutableSetNonCore class]);
behavior_class_add_class(self, [NSSetNonCore class]);
if ([NSThread isMultiThreaded]) if ([NSThread isMultiThreaded])
{ {
[self _becomeThreaded: nil]; [self _becomeThreaded: nil];

View file

@ -34,11 +34,6 @@
@class GSSet; @class GSSet;
@class GSMutableSet; @class GSMutableSet;
@interface NSSetNonCore : NSSet
@end
@interface NSMutableSetNonCore: NSMutableSet
@end
@implementation NSSet @implementation NSSet
static Class NSSet_abstract_class; static Class NSSet_abstract_class;
@ -66,7 +61,6 @@ static Class NSMutableSet_concrete_class;
NSMutableSet_abstract_class = [NSMutableSet class]; NSMutableSet_abstract_class = [NSMutableSet class];
NSSet_concrete_class = [GSSet class]; NSSet_concrete_class = [GSSet class];
NSMutableSet_concrete_class = [GSMutableSet class]; NSMutableSet_concrete_class = [GSMutableSet class];
behavior_class_add_class(self, [NSSetNonCore class]);
} }
} }
@ -195,10 +189,6 @@ static Class NSMutableSet_concrete_class;
return [self subclassResponsibility: _cmd]; return [self subclassResponsibility: _cmd];
} }
@end
@implementation NSSetNonCore
/* Same as NSArray */ /* Same as NSArray */
- (id) initWithObjects: firstObject rest: (va_list)ap - (id) initWithObjects: firstObject rest: (va_list)ap
{ {
@ -462,8 +452,6 @@ static Class NSMutableSet_concrete_class;
{ {
if (self == [NSMutableSet class]) if (self == [NSMutableSet class])
{ {
behavior_class_add_class(self, [NSMutableSetNonCore class]);
behavior_class_add_class(self, [NSSetNonCore class]);
} }
} }
@ -511,10 +499,6 @@ static Class NSMutableSet_concrete_class;
[self subclassResponsibility: _cmd]; [self subclassResponsibility: _cmd];
} }
@end
@implementation NSMutableSetNonCore
- (id) initWithObjects: (id*)objects - (id) initWithObjects: (id*)objects
count: (unsigned)count count: (unsigned)count
{ {