291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
size_t count;
if (oldObject == nil || newObject == nil)
@throw [OFInvalidArgumentException exception];
count = self.count;
for (size_t i = 0; i < count; i++) {
if ([[self objectAtIndex: i] isEqual: oldObject]) {
[self replaceObjectAtIndex: i withObject: newObject];
return;
}
}
}
- (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject
{
size_t count;
if (oldObject == nil || newObject == nil)
|
|
|
<
<
<
|
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
size_t count;
if (oldObject == nil || newObject == nil)
@throw [OFInvalidArgumentException exception];
count = self.count;
for (size_t i = 0; i < count; i++)
if ([[self objectAtIndex: i] isEqual: oldObject])
[self replaceObjectAtIndex: i withObject: newObject];
}
- (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject
{
size_t count;
if (oldObject == nil || newObject == nil)
|
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
count = self.count;
for (size_t i = 0; i < count; i++) {
if ([[self objectAtIndex: i] isEqual: object]) {
[self removeObjectAtIndex: i];
return;
}
}
}
- (void)removeObjectIdenticalTo: (id)object
{
size_t count;
if (object == nil)
@throw [OFInvalidArgumentException exception];
count = self.count;
for (size_t i = 0; i < count; i++) {
if ([self objectAtIndex: i] == object) {
[self removeObjectAtIndex: i];
return;
}
}
}
- (void)removeObjectsInRange: (OFRange)range
{
for (size_t i = 0; i < range.length; i++)
|
>
|
>
>
|
>
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
count = self.count;
for (size_t i = 0; i < count; i++) {
if ([[self objectAtIndex: i] isEqual: object]) {
[self removeObjectAtIndex: i];
i--;
count--;
continue;
}
}
}
- (void)removeObjectIdenticalTo: (id)object
{
size_t count;
if (object == nil)
@throw [OFInvalidArgumentException exception];
count = self.count;
for (size_t i = 0; i < count; i++) {
if ([self objectAtIndex: i] == object) {
[self removeObjectAtIndex: i];
i--;
count--;
continue;
}
}
}
- (void)removeObjectsInRange: (OFRange)range
{
for (size_t i = 0; i < range.length; i++)
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
return;
[self removeObjectAtIndex: count - 1];
}
- (void)removeAllObjects
{
[self removeObjectsInRange: OFRangeMake(0, self.count)];
}
#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (OFArrayReplaceBlock)block
{
[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
bool *stop) {
|
|
|
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
return;
[self removeObjectAtIndex: count - 1];
}
- (void)removeAllObjects
{
[self removeObjectsInRange: OFMakeRange(0, self.count)];
}
#ifdef OF_HAVE_BLOCKS
- (void)replaceObjectsUsingBlock: (OFArrayReplaceBlock)block
{
[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
bool *stop) {
|