Samond Classes Library 1.2.6-STABLE build 219
SCArray.h
Go to the documentation of this file.
1 //
2 // SCArray.h
3 // scl
4 //
5 // Created by Viacheslav Smolensky on 13.04.12.
6 // Copyright (c) 2007 - 2018 by Samond Development Corporation. All rights reserved.
7 //
8 
23 #import <Foundation/Foundation.h>
24 #import <scl/NSArray+SCArray.h>
26 #import <scl/SCCollection.h>
27 #import <scl/SCSorter.h>
28 
29 #pragma mark -
30 #pragma mark Class Constants
31 
40 #define SCArrayClass @"SCArray"
41 
42 
85  NSMutableArray *_array; // Internal data storage
86 }
87 
113 @property (nonatomic, readonly, assign) SCArray *ascendingSortedArray;
114 
119 @property (nonatomic, readonly, assign) SCArray *descendingSortedArray;
120 
129 @property (nonatomic, readonly, assign) SCArray *sortedArray;
130 
148 @property (nonatomic, retain, readonly, getter=reversedArray) SCArray *reversedArray;
149 
161 @property (nonatomic, readonly, assign) id firstObject;
162 
167 @property (nonatomic, readonly, assign) id lastObject;
168 
180 @property (nonatomic, readonly, assign) SCIndex indexOfLastObject;
181 
184 #pragma mark -
185 #pragma mark Creating Arrays
186 + (instancetype)arrayWithCoder:(NSCoder *)coder;
187 + (instancetype)arrayWithContentsOfSerializedFile:(NSString *)path;
188 + (instancetype)arrayWithDataDictionary:(NSDictionary *)dictionary;
189 + (instancetype)arrayWithDataDictionaryFromFile:(NSString *)path;
190 + (instancetype)arrayWithStream:(SCStream *)stream;
191 + (instancetype)arrayWithFileStream:(NSString *)path;
192 + (instancetype)arrayWithData:(NSData *)data;
193 + (instancetype)arrayWithContentsOfFile:(NSString *)path;
194 + (instancetype)arrayWithContentsOfURL:(NSURL *)url;
195 + (instancetype)arrayWithContentsOfURLString:(NSString *)urlString;
196 
197 + (instancetype)arrayWithName:(NSString *)name;
198 + (instancetype)arrayWithObject:(id<SCCollectioning>)object;
199 + (instancetype)arrayWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
200 + (instancetype)arrayWithCollection:(id<SCCollection>)collection;
201 + (instancetype)arrayWithArray:(SCArray *)array;
202 + (instancetype)array;
203 
204 + (instancetype)arrayWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
205 + (instancetype)arrayWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
206 + (instancetype)arrayWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
207 + (instancetype)arrayWithAscendingSortedCollection:(id<SCCollection>)collection;
208 + (instancetype)arrayWithDescendingSortedCollection:(id<SCCollection>)collection;
209 + (instancetype)arrayWithSortedCollection:(id<SCCollection>)collection;
210 
211 #pragma mark -
212 #pragma mark Initializing Arrays
213 - (instancetype)initWithName:(NSString *)name;
214 - (instancetype)initWithObject:(id<SCCollectioning>)object;
215 - (instancetype)initWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
216 - (instancetype)initWithCollection:(id<SCCollection>)collection;
217 - (instancetype)initWithArray:(SCArray *)array;
218 - (instancetype)init;
219 
220 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
221 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
222 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
223 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection;
224 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection;
225 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection;
226 
227 #pragma mark -
228 #pragma mark Copying Arrays
229 - (void)setArray:(SCArray *)array;
230 - (void)setAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
231 - (void)setDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
232 - (void)setSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
233 - (void)setAscendingSortedCollection:(id<SCCollection>)collection;
234 - (void)setDescendingSortedCollection:(id<SCCollection>)collection;
235 - (void)setSortedCollection:(id<SCCollection>)collection;
236 
237 #pragma mark -
238 #pragma mark Comparing Arrays
239 - (BOOL)isEqualToArray:(SCArray *)array;
240 
241 #pragma mark -
242 #pragma mark Deriving New Arrays
243 - (SCArray *)arrayByAddingObject:(id<SCCollectioning>)object;
244 - (SCArray *)arrayByAddingObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
245 - (SCArray *)arrayByAddingCollection:(id<SCCollection>)collection;
246 - (SCArray *)arrayByAddingObjectsFromArray:(SCArray *)array;
247 - (SCArray *)arrayByAddingArray:(SCArray *)array;
248 - (SCArray *)subarrayWithRange:(NSRange)range;
249 
250 #pragma mark -
251 #pragma mark Sorting Arrays
252 - (void)sortAscendingWithSorter:(id<SCSorter>)sorter;
253 - (void)sortDescendingWithSorter:(id<SCSorter>)sorter;
254 - (void)sortWithSorter:(id<SCSorter>)sorter;
255 - (void)sortAscending;
256 - (void)sortDescending;
257 - (void)sort;
258 - (SCArray *)ascendingSortedArrayWithSorter:(id<SCSorter>)sorter;
259 - (SCArray *)descendingSortedArrayWithSorter:(id<SCSorter>)sorter;
260 - (SCArray *)sortedArrayWithSorter:(id<SCSorter>)sorter;
261 - (SCArray *)descendingSortedArray;
262 - (SCArray *)sortedArray;
263 
264 #pragma mark -
265 #pragma mark Adding Objects
266 - (void)insertObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
267 - (void)insertAtIndex:(SCIndex)index objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
268 - (void)insertCollection:(id<SCCollection>)collection atIndex:(SCIndex)index;
269 - (void)insertAtIndexes:(NSIndexSet *)indexes objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
270 - (void)insertCollection:(id<SCCollection>)collection atIndexes:(NSIndexSet *)indexes;
271 - (void)setObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
272 - (void)addObjectsFromArray:(SCArray *)array;
273 - (void)addArray:(SCArray *)array;
274 
275 #pragma mark -
276 #pragma mark Removing Objects
277 - (void)removeFirstObject;
278 - (void)removeLastObject;
279 - (void)removeObjectAtIndex:(SCIndex)index;
280 - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;
281 - (void)removeObjectsInRange:(NSRange)range;
282 
283 #pragma mark -
284 #pragma mark Replacing Objects
285 - (void)replaceObjectAtIndex:(SCIndex)index withObject:(id<SCCollectioning>)object;
286 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes
287  withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
288 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withCollection:(id<SCCollection>)collection;
289 - (void)replaceObjectsInRange:(NSRange)range withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
290 - (void)replaceObjectsInRange:(NSRange)range withCollection:(id<SCCollection>)collection;
291 - (void)setObject:(id<SCCollectioning>)object atIndexedSubscript:(SCIndex)index;
292 
293 #pragma mark -
294 #pragma mark Copying and Moving Objects
295 - (void)exchangeObjectAtIndex:(SCIndex)index withObjectAtIndex:(SCIndex)destination;
296 - (void)duplicateObjectAtIndex:(SCIndex)index;
297 - (void)duplicateObjectsInRange:(NSRange)range;
298 - (void)duplicateAllObjects;
299 - (void)duplicate;
300 
301 - (void)copyObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
302 - (void)copyObjectsInRange:(NSRange)range toIndex:(SCIndex)destination;
303 - (void)moveObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
304 - (void)moveObjectsInRange:(NSRange)range toIndex:(SCIndex)destination;
305 
306 - (void)reverse;
307 - (SCArray *)reversedArray;
308 
309 #pragma mark -
310 #pragma mark Querying an Array
311 - (id)firstObject;
312 - (id)lastObject;
313 - (id)objectAtIndex:(SCIndex)index;
314 - (SCArray *)objectsAtIndexes:(NSIndexSet *)indexes;
315 - (SCArray *)objectsInRange:(NSRange)range;
316 - (id)objectAtIndexedSubscript:(SCIndex)index;
317 
318 #pragma mark -
319 #pragma mark Finding Objects in an Array
320 - (SCIndex)indexOfObject:(id<SCCollectioning>)object;
321 - (SCIndex)indexOfObject:(id<SCCollectioning>)object inRange:(NSRange)range;
322 - (SCIndex)indexOfLastObject;
323 
324 @end
Mutable indexed collection protocol.
Definition: SCCollectionProtocols.h:887
Caregory NSArray(SCArray) header file.
Abstract implementation of the protocol SCSorter.
Definition: SCSorter.h:138
Indexed collections protocol.
Definition: SCCollectionProtocols.h:793
Protocol and class SCSorter header file.
Collections communications protocol.
Definition: SCCollectioning.h:79
Category NSDictionary(SCDictionary) header file.
Abstract collections class.
Definition: SCCollection.h:98
Class SCCollection header file.
SCArray * reversedArray
Definition: SCArray.h:148
Array class.
Definition: SCArray.h:84
NSUInteger SCIndex
Definition: SCCollectionProtocols.h:53
Abstract parent class of the stream classes hierarchy.
Definition: SCStream.h:224