ce62234b524a5815faf117945314b375b83f1641
[enjoyable.git] / NSMutableArray+MoveObject.h
1 //
2 // NSMutableArray+MoveObject.h
3 // Enjoyable
4 //
5 // Created by Joe Wreschnig on 3/7/13.
6 //
7 //
8
9 #import <Foundation/Foundation.h>
10
11 @interface NSMutableArray (MoveObject)
12
13 - (void)moveObjectAtIndex:(NSUInteger)src toIndex:(NSUInteger)dst;
14 // Move the object at index src to (pre-move) index dst. Other
15 // objects shift up or down as necessary to make room, as in
16 // insertObject:atIndex:. Because the object is also removed from
17 // the source index, its resulting index may be one less than dst.
18
19 - (BOOL)moveFirstwards:(id)object upTo:(NSUInteger)minIndex;
20 - (BOOL)moveLastwards:(id)object upTo:(NSUInteger)maxIndex;
21 // Move an object one step towards the first or last position in
22 // the array, up to a minimum or maximum index. Returns YES if the
23 // array changed; NO if the object was not in the array or was
24 // already at the minimum/maximum index.
25
26 - (BOOL)moveFirstwards:(id)object;
27 - (BOOL)moveLastwards:(id)object;
28 // Move an object towards the first or last position in the array.
29 // Returns YES if the array changed; NO if the object was not in
30 // the array or if the object was already in the first/last
31 // position.
32
33
34 @end