X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Categories%2FNSMutableArray%2BMoveObject.h;h=e8ac0b0cfa51b411b2e1b17f4b011064629bc330;hp=c1c60d28a466b41615a84baf068405023645b5b1;hb=b14d8429658dd6f3f7b4904301031addb502b22c;hpb=0064c1fbff36795885a9724081af2a17d83c20a3 diff --git a/Categories/NSMutableArray+MoveObject.h b/Categories/NSMutableArray+MoveObject.h index c1c60d2..e8ac0b0 100644 --- a/Categories/NSMutableArray+MoveObject.h +++ b/Categories/NSMutableArray+MoveObject.h @@ -11,5 +11,23 @@ @interface NSMutableArray (MoveObject) - (void)moveObjectAtIndex:(NSUInteger)src toIndex:(NSUInteger)dst; + // Move the object at index src to (post-move) index dst. Other + // objects shift up or down as necessary to make room, as in + // insertObject:atIndex:. + +- (BOOL)moveFirstwards:(id)object upTo:(NSUInteger)minIndex; +- (BOOL)moveLastwards:(id)object upTo:(NSUInteger)maxIndex; + // Move an object one step towards the first or last position in + // the array, up to a minimum or maximum index. Returns YES if the + // array changed; NO if the object was not in the array or was + // already at the minimum/maximum index. + +- (BOOL)moveFirstwards:(id)object; +- (BOOL)moveLastwards:(id)object; + // Move an object towards the first or last position in the array. + // Returns YES if the array changed; NO if the object was not in + // the array or if the object was already in the first/last + // position. + @end