X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Categories%2FNSMutableArray%2BMoveObject.h;fp=Categories%2FNSMutableArray%2BMoveObject.h;h=ce62234b524a5815faf117945314b375b83f1641;hp=c1c60d28a466b41615a84baf068405023645b5b1;hb=a7260fe79808efcad6a92cace15a1b3429f14787;hpb=f0ee56026ad07a45722350d091f632a52a506486 diff --git a/Categories/NSMutableArray+MoveObject.h b/Categories/NSMutableArray+MoveObject.h index c1c60d2..ce62234 100644 --- a/Categories/NSMutableArray+MoveObject.h +++ b/Categories/NSMutableArray+MoveObject.h @@ -11,5 +11,24 @@ @interface NSMutableArray (MoveObject) - (void)moveObjectAtIndex:(NSUInteger)src toIndex:(NSUInteger)dst; + // Move the object at index src to (pre-move) index dst. Other + // objects shift up or down as necessary to make room, as in + // insertObject:atIndex:. Because the object is also removed from + // the source index, its resulting index may be one less than dst. + +- (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