︙ | | | ︙ | |
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
|
[_array addItem: &object];
[object retain];
_mutations++;
}
- (void)insertObject: (id)object
atIndex: (size_t)index
{
if (object == nil)
@throw [OFInvalidArgumentException exception];
@try {
[_array insertItem: &object
atIndex: index];
} @catch (OFOutOfRangeException *e) {
@throw [OFOutOfRangeException exception];
}
[object retain];
_mutations++;
}
- (void)insertObjectsFromArray: (OFArray *)array
atIndex: (size_t)index
{
id const *objects = [array objects];
size_t count = [array count];
@try {
[_array insertItems: objects
atIndex: index
count: count];
} @catch (OFOutOfRangeException *e) {
@throw [OFOutOfRangeException exception];
}
for (size_t i = 0; i < count; i++)
[objects[i] retain];
|
|
|
|
|
|
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
|
[_array addItem: &object];
[object retain];
_mutations++;
}
- (void)insertObject: (id)object
atIndex: (size_t)idx
{
if (object == nil)
@throw [OFInvalidArgumentException exception];
@try {
[_array insertItem: &object
atIndex: idx];
} @catch (OFOutOfRangeException *e) {
@throw [OFOutOfRangeException exception];
}
[object retain];
_mutations++;
}
- (void)insertObjectsFromArray: (OFArray *)array
atIndex: (size_t)idx
{
id const *objects = [array objects];
size_t count = [array count];
@try {
[_array insertItems: objects
atIndex: idx
count: count];
} @catch (OFOutOfRangeException *e) {
@throw [OFOutOfRangeException exception];
}
for (size_t i = 0; i < count; i++)
[objects[i] retain];
|
︙ | | | ︙ | |
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
objects[i] = newObject;
return;
}
}
}
- (void)replaceObjectAtIndex: (size_t)index
withObject: (id)object
{
id *objects;
id oldObject;
if (object == nil)
@throw [OFInvalidArgumentException exception];
objects = [_array items];
if (index >= [_array count])
@throw [OFOutOfRangeException exception];
oldObject = objects[index];
objects[index] = [object retain];
[oldObject release];
}
- (void)replaceObjectIdenticalTo: (id)oldObject
withObject: (id)newObject
{
id *objects;
|
|
|
|
|
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
objects[i] = newObject;
return;
}
}
}
- (void)replaceObjectAtIndex: (size_t)idx
withObject: (id)object
{
id *objects;
id oldObject;
if (object == nil)
@throw [OFInvalidArgumentException exception];
objects = [_array items];
if (idx >= [_array count])
@throw [OFOutOfRangeException exception];
oldObject = objects[idx];
objects[idx] = [object retain];
[oldObject release];
}
- (void)replaceObjectIdenticalTo: (id)oldObject
withObject: (id)newObject
{
id *objects;
|
︙ | | | ︙ | |
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
[object release];
return;
}
}
}
- (void)removeObjectAtIndex: (size_t)index
{
id object = [self objectAtIndex: index];
[_array removeItemAtIndex: index];
[object release];
_mutations++;
}
- (void)removeAllObjects
{
|
|
|
|
|
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
[object release];
return;
}
}
}
- (void)removeObjectAtIndex: (size_t)idx
{
id object = [self objectAtIndex: idx];
[_array removeItemAtIndex: idx];
[object release];
_mutations++;
}
- (void)removeAllObjects
{
|
︙ | | | ︙ | |
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
object = [self objectAtIndex: count - 1];
[_array removeLastItem];
[object release];
_mutations++;
}
- (void)exchangeObjectAtIndex: (size_t)index1
withObjectAtIndex: (size_t)index2
{
id *objects = [_array items];
size_t count = [_array count];
id tmp;
if (index1 >= count || index2 >= count)
@throw [OFOutOfRangeException exception];
tmp = objects[index1];
objects[index1] = objects[index2];
objects[index2] = tmp;
}
- (void)reverse
{
id *objects = [_array items];
size_t i, j, count = [_array count];
|
|
|
|
|
|
|
|
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
object = [self objectAtIndex: count - 1];
[_array removeLastItem];
[object release];
_mutations++;
}
- (void)exchangeObjectAtIndex: (size_t)idx1
withObjectAtIndex: (size_t)idx2
{
id *objects = [_array items];
size_t count = [_array count];
id tmp;
if (idx1 >= count || idx2 >= count)
@throw [OFOutOfRangeException exception];
tmp = objects[idx1];
objects[idx1] = objects[idx2];
objects[idx2] = tmp;
}
- (void)reverse
{
id *objects = [_array items];
size_t i, j, count = [_array count];
|
︙ | | | ︙ | |