46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
return self;
}
- initWithSet: (OFSet*)set
{
self = [self init];
@try {
void *pool = objc_autoreleasePoolPush();
OFNumber *one = [OFNumber numberWithSize: 1];
OFEnumerator *enumerator = [set objectEnumerator];
id object;
/*
* We can't just copy the dictionary as the specified set might
* be a counted set, but we're just a normal set.
*/
while ((object = [enumerator nextObject]) != nil)
[dictionary OF_setObject: one
forKey: object
copyKey: NO];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithArray: (OFArray*)array
{
self = [self init];
@try {
void *pool = objc_autoreleasePoolPush();
OFNumber *one = [OFNumber numberWithSize: 1];
id *objects = [array objects];
size_t i, count = [array count];
for (i = 0; i < count; i++)
[dictionary OF_setObject: one
forKey: objects[i]
copyKey: NO];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
>
>
>
|
|
>
>
>
>
>
>
>
|
<
|
>
|
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
return self;
}
- initWithSet: (OFSet*)set
{
self = [self init];
if (set == nil)
return self;
@try {
void *pool = objc_autoreleasePoolPush();
OFNumber *one;
OFEnumerator *enumerator;
id object;
one = [OFNumber numberWithSize: 1];
/*
* We can't just copy the dictionary as the specified set might
* be a counted set, but we're just a normal set.
*/
enumerator = [set objectEnumerator];
while ((object = [enumerator nextObject]) != nil)
[dictionary OF_setObject: one
forKey: object
copyKey: NO];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- initWithArray: (OFArray*)array
{
self = [self init];
if (array == nil)
return self;
@try {
void *pool = objc_autoreleasePoolPush();
OFNumber *one = [OFNumber numberWithSize: 1];
OFEnumerator *enumerator;
id object;
enumerator = [array objectEnumerator];
while ((object = [enumerator nextObject]) != nil)
[dictionary OF_setObject: one
forKey: object
copyKey: NO];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
- (size_t)count
{
return [dictionary count];
}
- (BOOL)containsObject: (id)object
{
return ([dictionary objectForKey: object] != nil);
}
- (BOOL)isEqual: (id)object
{
OFSet_hashtable *otherSet;
|
>
>
>
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
- (size_t)count
{
return [dictionary count];
}
- (BOOL)containsObject: (id)object
{
if (object == nil)
return NO;
return ([dictionary objectForKey: object] != nil);
}
- (BOOL)isEqual: (id)object
{
OFSet_hashtable *otherSet;
|