Changeset 5167
- Timestamp:
- 01/16/08 08:30:18 (6 months ago)
- Files:
-
- WiredAdditions/trunk/NSArray-WIAdditions.h (modified) (1 diff)
- WiredAdditions/trunk/NSArray-WIAdditions.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredAdditions/trunk/NSArray-WIAdditions.h
r4972 r5167 52 52 @interface NSMutableArray(WIMutableArrayAdditions) 53 53 54 - ( void)moveObjectAtIndex:(NSUInteger)from toIndex:(NSUInteger)to;54 - (NSUInteger)moveObjectAtIndex:(NSUInteger)from toIndex:(NSUInteger)to; 55 55 - (void)reverse; 56 56 - (void)shuffle; WiredAdditions/trunk/NSArray-WIAdditions.m
r4972 r5167 250 250 @implementation NSMutableArray(WIMutableArrayAdditions) 251 251 252 - (void)moveObjectAtIndex:(NSUInteger)from toIndex:(NSUInteger)to { 253 id object; 254 255 if(from != to) { 256 object = [self objectAtIndex:from]; 257 258 [object retain]; 259 [self removeObjectAtIndex:from]; 260 [self insertObject:object atIndex:to <= from ? to : to - 1]; 261 [object release]; 262 } 252 - (NSUInteger)moveObjectAtIndex:(NSUInteger)from toIndex:(NSUInteger)to { 253 id object; 254 NSUInteger index; 255 256 if(from == to) 257 return from; 258 259 object = [self objectAtIndex:from]; 260 index = (to <= from) ? to : to - 1; 261 262 [object retain]; 263 [self removeObjectAtIndex:from]; 264 [self insertObject:object atIndex:index]; 265 [object release]; 266 267 return index; 263 268 } 264 269
