Samond Classes Library 1.2.3-RELEASE build 192
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 - 2017 by Samond Development Corporation. All rights reserved.
7 //
8 
23 #import <scl/SCCollection.h>
24 #import <scl/SCSorter.h>
25 
26 #pragma mark -
27 #pragma mark Class Constants
28 
37 #define SCArrayClass @"SCArray"
38 
39 
82  NSMutableArray *fArray; // Internal data storage
83 }
84 
110 @property (nonatomic, readonly, assign) SCArray *ascendingSortedArray;
111 
116 @property (nonatomic, readonly, assign) SCArray *descendingSortedArray;
117 
126 @property (nonatomic, readonly, assign) SCArray *sortedArray;
127 
145 @property (nonatomic, retain, readonly, getter=reversedArray) SCArray *reversedArray;
146 
158 @property (nonatomic, readonly, assign) id firstObject;
159 
164 @property (nonatomic, readonly, assign) id lastObject;
165 
177 @property (nonatomic, readonly, assign) SCIndex indexOfLastObject;
178 
181 #pragma mark -
182 #pragma mark Creating Arrays
183 + (instancetype)arrayWithCoder:(NSCoder *)coder;
184 + (instancetype)arrayWithContentsOfSerializedFile:(NSString *)path;
185 + (instancetype)arrayWithDataDictionary:(NSDictionary *)dictionary;
186 + (instancetype)arrayWithDataDictionaryFromFile:(NSString *)path;
187 + (instancetype)arrayWithStream:(SCStream *)stream;
188 + (instancetype)arrayWithFileStream:(NSString *)path;
189 + (instancetype)arrayWithData:(NSData *)data;
190 + (instancetype)arrayWithContentsOfFile:(NSString *)path;
191 + (instancetype)arrayWithContentsOfURL:(NSURL *)url;
192 + (instancetype)arrayWithContentsOfURLString:(NSString *)urlString;
193 
194 + (instancetype)arrayWithName:(NSString *)name;
195 + (instancetype)arrayWithObject:(id<SCCollectioning>)object;
196 + (instancetype)arrayWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
197 + (instancetype)arrayWithCollection:(id<SCCollection>)collection;
198 + (instancetype)arrayWithArray:(SCArray *)array;
199 + (instancetype)array;
200 
201 + (instancetype)arrayWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
202 + (instancetype)arrayWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
203 + (instancetype)arrayWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
204 + (instancetype)arrayWithAscendingSortedCollection:(id<SCCollection>)collection;
205 + (instancetype)arrayWithDescendingSortedCollection:(id<SCCollection>)collection;
206 + (instancetype)arrayWithSortedCollection:(id<SCCollection>)collection;
207 
208 #pragma mark -
209 #pragma mark Initializing Arrays
210 - (instancetype)initWithName:(NSString *)name;
211 - (instancetype)initWithObject:(id<SCCollectioning>)object;
212 - (instancetype)initWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
213 - (instancetype)initWithCollection:(id<SCCollection>)collection;
214 - (instancetype)initWithArray:(SCArray *)array;
215 - (instancetype)init;
216 
217 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
218 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
219 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
220 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection;
221 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection;
222 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection;
223 
224 #pragma mark -
225 #pragma mark Copying Arrays
226 - (void)setArray:(SCArray *)array;
227 - (void)setAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
228 - (void)setDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
229 - (void)setSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
230 - (void)setAscendingSortedCollection:(id<SCCollection>)collection;
231 - (void)setDescendingSortedCollection:(id<SCCollection>)collection;
232 - (void)setSortedCollection:(id<SCCollection>)collection;
233 
234 #pragma mark -
235 #pragma mark Comparing Arrays
236 - (BOOL)isEqualToArray:(SCArray *)array;
237 
238 #pragma mark -
239 #pragma mark Deriving New Arrays
240 - (SCArray *)arrayByAddingObject:(id<SCCollectioning>)object;
241 - (SCArray *)arrayByAddingObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
242 - (SCArray *)arrayByAddingCollection:(id<SCCollection>)collection;
243 - (SCArray *)arrayByAddingObjectsFromArray:(SCArray *)array;
244 - (SCArray *)arrayByAddingArray:(SCArray *)array;
245 - (SCArray *)subarrayWithRange:(NSRange)range;
246 
247 #pragma mark -
248 #pragma mark Sorting Arrays
249 - (void)sortAscendingWithSorter:(id<SCSorter>)sorter;
250 - (void)sortDescendingWithSorter:(id<SCSorter>)sorter;
251 - (void)sortWithSorter:(id<SCSorter>)sorter;
252 - (void)sortAscending;
253 - (void)sortDescending;
254 - (void)sort;
255 - (SCArray *)ascendingSortedArrayWithSorter:(id<SCSorter>)sorter;
256 - (SCArray *)descendingSortedArrayWithSorter:(id<SCSorter>)sorter;
257 - (SCArray *)sortedArrayWithSorter:(id<SCSorter>)sorter;
258 - (SCArray *)descendingSortedArray;
259 - (SCArray *)sortedArray;
260 
261 #pragma mark -
262 #pragma mark Adding Objects
263 - (void)insertObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
264 - (void)insertAtIndex:(SCIndex)index objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
265 - (void)insertCollection:(id<SCCollection>)collection atIndex:(SCIndex)index;
266 - (void)insertAtIndexes:(NSIndexSet *)indexes objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
267 - (void)insertCollection:(id<SCCollection>)collection atIndexes:(NSIndexSet *)indexes;
268 - (void)setObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
269 - (void)addObjectsFromArray:(SCArray *)array;
270 - (void)addArray:(SCArray *)array;
271 
272 #pragma mark -
273 #pragma mark Removing Objects
274 - (void)removeFirstObject;
275 - (void)removeLastObject;
276 - (void)removeObjectAtIndex:(SCIndex)index;
277 - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;
278 - (void)removeObjectsInRange:(NSRange)range;
279 
280 #pragma mark -
281 #pragma mark Replacing Objects
282 - (void)replaceObjectAtIndex:(SCIndex)index withObject:(id<SCCollectioning>)object;
283 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes
284  withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
285 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withCollection:(id<SCCollection>)collection;
286 - (void)replaceObjectsInRange:(NSRange)range withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
287 - (void)replaceObjectsInRange:(NSRange)range withCollection:(id<SCCollection>)collection;
288 
289 #pragma mark -
290 #pragma mark Copying and Moving Objects
291 - (void)exchangeObjectAtIndex:(SCIndex)index withObjectAtIndex:(SCIndex)destination;
292 - (void)duplicateObjectAtIndex:(SCIndex)index;
293 - (void)duplicateObjectsInRange:(NSRange)range;
294 - (void)duplicateAllObjects;
295 - (void)duplicate;
296 
297 - (void)copyObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
298 - (void)copyObjectsInRange:(NSRange)range toIndex:(SCIndex)destination;
299 - (void)moveObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
300 - (void)moveObjectsInRange:(NSRange)range toIndex:(SCIndex)destination;
301 
302 - (void)reverse;
303 - (SCArray *)reversedArray;
304 
305 #pragma mark -
306 #pragma mark Querying an Array
307 - (id)firstObject;
308 - (id)lastObject;
309 - (id)objectAtIndex:(SCIndex)index;
310 - (SCArray *)objectsAtIndexes:(NSIndexSet *)indexes;
311 - (SCArray *)objectsInRange:(NSRange)range;
312 
313 #pragma mark -
314 #pragma mark Finding Objects in an Array
315 - (SCIndex)indexOfObject:(id<SCCollectioning>)object;
316 - (SCIndex)indexOfObject:(id<SCCollectioning>)object inRange:(NSRange)range;
317 - (SCIndex)indexOfLastObject;
318 
319 @end
Mutable indexed collection protocol.
Definition: SCCollectionProtocols.h:850
Abstract implementation of the protocol SCSorter.
Definition: SCSorter.h:136
Indexed collections protocol.
Definition: SCCollectionProtocols.h:772
Protocol and class SCSorter header file.
Collections communications protocol.
Definition: SCCollectioning.h:78
Abstract collections class.
Definition: SCCollection.h:97
Class SCCollection header file.
SCArray * reversedArray
Definition: SCArray.h:145
Array class.
Definition: SCArray.h:81
NSUInteger SCIndex
Definition: SCCollectionProtocols.h:50
Abstract parent class of the stream classes hierarchy.
Definition: SCStream.h:238