Implemented many methods.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@646 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1995-10-30 01:00:20 +00:00
parent 35034a52a6
commit ef8eaa1d08

View file

@ -81,55 +81,25 @@
} }
} }
#if 0
/* This is the designated initializer */ /* This is the designated initializer */
- initWithObjects: (id*)objects - initWithObjects: (id*)objects
forKeys: (NSString**)keys
count: (unsigned)count count: (unsigned)count
{ {
char * content_encoding = @encode(id); return [self initWithType:@encode(id)
char * key_encoding = @encode(id); capacity:count];
CALL_METHOD_IN_CLASS([KeyedCollection class], initWithType:keyType:,
content_encoding, key_encoding);
_contents_hash =
coll_hash_new(POWER_OF_TWO(count),
elt_get_hash_function(key_encoding),
elt_get_comparison_function(key_encoding));
_comparison_function = elt_get_comparison_function(content_encoding);
while (count--)
{
[keys[count] retain];
[objects[count] retain];
coll_hash_add(&_contents_hash, keys[count], objects[count]);
}
return self;
} }
/* - member: anObject
Comes from Set.m
- (unsigned) count
*/
- objectForKey: (NSString*)aKey
{ {
elt ret_nil(arglist_t a) return coll_hash_value_for_key(_contents_hash, anObject).id_u;
{
return nil;
}
return [self elementAtKey:aKey ifAbsentCall:ret_nil].id_u;
}
- (NSEnumerator*) keyEnumerator
{
return [[NSGSetKeyEnumerator alloc] initWithSet:self];
} }
- (NSEnumerator*) objectEnumerator - (NSEnumerator*) objectEnumerator
{ {
return [[NSGSetObjectEnumerator alloc] initWithSet:self]; return [[[NSGSetEnumerator alloc] initWithSet:self]
autorelease];
} }
#endif
@end @end
@ -149,27 +119,26 @@
} }
} }
#if 0
/* This is the designated initializer */ /* This is the designated initializer */
/* Comes from Set.m - initWithCapacity: (unsigned)numItems
- initWithCapacity: (unsigned)numItems
*/
- (void) setObject:anObject forKey:(NSString *)aKey
{ {
[self putElement:anObject atKey:aKey]; return [self initWithType:@encode(id)
capacity:numItems];
} }
- (void) removeObjectForKey:(NSString *)aKey - (void) addObject: anObject
{ {
elt do_nothing (arglist_t a) [self addElement:anObject];
{
return 0;
}
[self removeElementAtKey:aKey ifAbsentCall:do_nothing];
} }
#endif - (void) removeAllObjects
{
[self empty];
}
- (void) removeObject: anObject
{
[self removeElement:anObject];
}
@end @end