Samond Classes Library 1.2.3-RELEASE build 192
SCOrderedSet.h
Go to the documentation of this file.
1 //
2 // SCOrderedSet.h
3 // scl
4 //
5 // Created by Viacheslav Smolensky on 04.02.16.
6 // Copyright (c) 2007 - 2017 by Samond Development Corporation. All rights reserved.
7 //
8 
22 #import <scl/SCCollection.h>
23 #import <scl/SCSorter.h>
24 
25 #pragma mark -
26 #pragma mark Class Constants
27 
36 #define SCOrderedSetClass @"SCOrderedSet"
37 
38 
39 #ifndef GNUSTEP
40 
80  NSMutableOrderedSet *fOrderedSet; // Internal data storage
81 }
82 
108 @property (nonatomic, readonly, assign) SCOrderedSet *ascendingSortedOrderedSet;
109 
114 @property (nonatomic, readonly, assign) SCOrderedSet *descendingSortedOrderedSet;
115 
123 @property (nonatomic, readonly, assign) SCOrderedSet *sortedOrderedSet;
124 
144 @property (nonatomic, readonly, assign) SCArray *allObjects;
145 
150 @property (nonatomic, readonly, assign) id firstObject;
151 
156 @property (nonatomic, readonly, assign) id lastObject;
157 
162 @property (nonatomic, readonly, assign) SCOrderedSet *reversedOrderedSet;
163 
175 @property (nonatomic, readonly, assign) SCIndex indexOfLastObject;
176 
179 #pragma mark -
180 #pragma mark Creating Ordered Sets
181 + (instancetype)orderedSetWithCoder:(NSCoder *)coder;
182 + (instancetype)orderedSetWithContentsOfSerializedFile:(NSString *)path;
183 + (instancetype)orderedSetWithDataDictionary:(NSDictionary *)dictionary;
184 + (instancetype)orderedSetWithDataDictionaryFromFile:(NSString *)path;
185 + (instancetype)orderedSetWithStream:(SCStream *)stream;
186 + (instancetype)orderedSetWithFileStream:(NSString *)path;
187 + (instancetype)orderedSetWithData:(NSData *)data;
188 + (instancetype)orderedSetWithContentsOfFile:(NSString *)path;
189 + (instancetype)orderedSetWithContentsOfURL:(NSURL *)url;
190 + (instancetype)orderedSetWithContentsOfURLString:(NSString *)urlString;
191 
192 + (instancetype)orderedSetWithName:(NSString *)name;
193 + (instancetype)orderedSetWithObject:(id<SCCollectioning>)object;
194 + (instancetype)orderedSetWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
195 + (instancetype)orderedSetWithCollection:(id<SCCollection>)collection;
196 + (instancetype)orderedSetWithArray:(SCArray *)array;
197 + (instancetype)orderedSetWithSet:(SCSet *)set;
198 + (instancetype)orderedSetWithOrderedSet:(SCOrderedSet *)orderedSet;
199 + (instancetype)orderedSet;
200 
201 + (instancetype)orderedSetWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
202 + (instancetype)orderedSetWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
203 + (instancetype)orderedSetWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
204 + (instancetype)orderedSetWithAscendingSortedCollection:(id<SCCollection>)collection;
205 + (instancetype)orderedSetWithDescendingSortedCollection:(id<SCCollection>)collection;
206 + (instancetype)orderedSetWithSortedCollection:(id<SCCollection>)collection;
207 
208 #pragma mark -
209 #pragma mark Initializing Ordered Sets
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)initWithSet:(SCSet *)set;
216 - (instancetype)initWithOrderedSet:(SCOrderedSet *)orderedSet;
217 - (instancetype)init;
218 
219 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
220 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
221 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
222 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection;
223 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection;
224 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection;
225 
226 #pragma mark -
227 #pragma mark Copying Ordered Sets
228 - (void)setSet:(SCSet *)set;
229 - (void)setOrderedSet:(SCOrderedSet *)orderedSet;
230 - (void)setArray:(SCArray *)array;
231 - (void)setAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
232 - (void)setDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
233 - (void)setSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
234 - (void)setAscendingSortedCollection:(id<SCCollection>)collection;
235 - (void)setDescendingSortedCollection:(id<SCCollection>)collection;
236 - (void)setSortedCollection:(id<SCCollection>)collection;
237 
238 #pragma mark -
239 #pragma mark Comparing Ordered Sets
240 - (BOOL)isSubsetOfOrderedSet:(id<SCCollection>)orderedSet;
241 - (BOOL)isSubsetOfSet:(id<SCCollection>)set;
242 - (BOOL)intersectsOrderedSet:(id<SCCollection>)orderedSet;
243 - (BOOL)intersectsSet:(id<SCCollection>)set;
244 - (BOOL)isEqualToOrderedSet:(SCOrderedSet *)orderedSet;
245 - (BOOL)isEqualToSet:(SCSet *)set;
246 - (BOOL)isEqualToArray:(SCArray *)array;
247 
248 #pragma mark -
249 #pragma mark Deriving New Ordered Sets
250 - (SCOrderedSet *)orderedSetByAddingObject:(id<SCCollectioning>)object;
251 - (SCOrderedSet *)orderedSetByAddingObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
252 - (SCOrderedSet *)orderedSetByAddingCollection:(id<SCCollection>)collection;
253 - (SCOrderedSet *)orderedSetByAddingObjectsFromArray:(SCArray *)array;
254 - (SCOrderedSet *)orderedSetByAddingArray:(SCArray *)array;
255 - (SCOrderedSet *)orderedSetByAddingObjectsFromSet:(SCSet *)set;
256 - (SCOrderedSet *)orderedSetByAddingSet:(SCSet *)set;
257 - (SCOrderedSet *)orderedSetByAddingObjectsFromOrderedSet:(SCOrderedSet *)orderedSet;
258 - (SCOrderedSet *)orderedSetByAddingOrderedSet:(SCOrderedSet *)orderedSet;
259 
260 #pragma mark -
261 #pragma mark Sorting Ordered Sets
262 - (void)sortAscendingWithSorter:(id<SCSorter>)sorter;
263 - (void)sortDescendingWithSorter:(id<SCSorter>)sorter;
264 - (void)sortWithSorter:(id<SCSorter>)sorter;
265 - (void)sortAscending;
266 - (void)sortDescending;
267 - (void)sort;
268 - (SCOrderedSet *)ascendingSortedOrderedSetWithSorter:(id<SCSorter>)sorter;
269 - (SCOrderedSet *)descendingSortedOrderedSetWithSorter:(id<SCSorter>)sorter;
270 - (SCOrderedSet *)sortedOrderedSetWithSorter:(id<SCSorter>)sorter;
271 
272 #pragma mark -
273 #pragma mark Adding Objects
274 - (void)insertObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
275 - (void)insertAtIndex:(SCIndex)index objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
276 - (void)insertCollection:(id<SCCollection>)collection atIndex:(SCIndex)index;
277 - (void)insertAtIndexes:(NSIndexSet *)indexes objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
278 - (void)insertCollection:(id<SCCollection>)collection atIndexes:(NSIndexSet *)indexes;
279 - (void)setObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
280 - (void)addObjectsFromArray:(SCArray *)array;
281 - (void)addArray:(SCArray *)array;
282 - (void)addObjectsFromSet:(SCSet *)set;
283 - (void)addSet:(SCSet *)set;
284 - (void)addObjectsFromOrderedSet:(SCOrderedSet *)orderedSet;
285 - (void)addOrderedSet:(SCOrderedSet *)orderedSet;
286 
287 #pragma mark -
288 #pragma mark Removing Objects
289 - (void)removeFirstObject;
290 - (void)removeLastObject;
291 - (void)removeObjectAtIndex:(SCIndex)index;
292 - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;
293 - (void)removeObjectsInRange:(NSRange)range;
294 
295 #pragma mark -
296 #pragma mark Replacing Objects
297 - (void)replaceObjectAtIndex:(SCIndex)index withObject:(id<SCCollectioning>)object;
298 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes
299  withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
300 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withCollection:(id<SCCollection>)collection;
301 - (void)replaceObjectsInRange:(NSRange)range withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
302 - (void)replaceObjectsInRange:(NSRange)range withCollection:(id<SCCollection>)collection;
303 
304 #pragma mark -
305 #pragma mark Moving Objects
306 - (void)exchangeObjectAtIndex:(SCIndex)index withObjectAtIndex:(SCIndex)destination;
307 - (void)moveObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
308 - (void)reverse;
309 
310 #pragma mark -
311 #pragma mark Querying an Ordered Set
312 - (id)objectAtIndex:(SCIndex)index;
313 - (SCArray *)objectsAtIndexes:(NSIndexSet *)indexes;
314 
315 #pragma mark -
316 #pragma mark Finding Objects in an Ordered Set
317 - (SCIndex)indexOfObject:(id<SCCollectioning>)object;
318 
319 #pragma mark -
320 #pragma mark Combining and Recombining Ordered Sets
321 - (void)unionOrderedSet:(id<SCCollection>)orderedSet;
322 - (void)unionSet:(id<SCCollection>)set;
323 - (void)minusOrderedSet:(id<SCCollection>)set;
324 - (void)minusSet:(id<SCCollection>)set;
325 - (void)intersectOrderedSet:(id<SCCollection>)orderedSet;
326 - (void)intersectSet:(id<SCCollection>)set;
327 
328 @end
329 
330 #endif
Unordered set class.
Definition: SCSet.h:69
Mutable indexed collection protocol.
Definition: SCCollectionProtocols.h:850
Ordered set class.
Definition: SCOrderedSet.h:79
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.
Array class.
Definition: SCArray.h:81
NSUInteger SCIndex
Definition: SCCollectionProtocols.h:50
Abstract parent class of the stream classes hierarchy.
Definition: SCStream.h:238