Samond Classes Library 1.2.2-RELEASE build 188
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 
106 @property (nonatomic, readonly, assign) SCOrderedSet *ascendingSortedOrderedSet;
107 
112 @property (nonatomic, readonly, assign) SCOrderedSet *descendingSortedOrderedSet;
113 
121 @property (nonatomic, readonly, assign) SCOrderedSet *sortedOrderedSet;
122 
142 @property (nonatomic, readonly, assign) SCArray *allObjects;
143 
148 @property (nonatomic, readonly, assign) id firstObject;
149 
154 @property (nonatomic, readonly, assign) id lastObject;
155 
160 @property (nonatomic, readonly, assign) SCOrderedSet *reversedOrderedSet;
161 
173 @property (nonatomic, readonly, assign) SCIndex indexOfLastObject;
174 
177 #pragma mark -
178 #pragma mark Creating Ordered Sets
179 + (instancetype)orderedSetWithCoder:(NSCoder *)coder;
180 + (instancetype)orderedSetWithContentsOfSerializedFile:(NSString *)path;
181 + (instancetype)orderedSetWithDataDictionary:(NSDictionary *)dictionary;
182 + (instancetype)orderedSetWithDataDictionaryFromFile:(NSString *)path;
183 + (instancetype)orderedSetWithStream:(SCStream *)stream;
184 + (instancetype)orderedSetWithFileStream:(NSString *)path;
185 
186 + (instancetype)orderedSetWithName:(NSString *)name;
187 + (instancetype)orderedSetWithObject:(id<SCCollectioning>)object;
188 + (instancetype)orderedSetWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
189 + (instancetype)orderedSetWithCollection:(id<SCCollection>)collection;
190 + (instancetype)orderedSetWithArray:(SCArray *)array;
191 + (instancetype)orderedSetWithSet:(SCSet *)set;
192 + (instancetype)orderedSetWithOrderedSet:(SCOrderedSet *)orderedSet;
193 + (instancetype)orderedSet;
194 
195 + (instancetype)orderedSetWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
196 + (instancetype)orderedSetWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
197 + (instancetype)orderedSetWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
198 + (instancetype)orderedSetWithAscendingSortedCollection:(id<SCCollection>)collection;
199 + (instancetype)orderedSetWithDescendingSortedCollection:(id<SCCollection>)collection;
200 + (instancetype)orderedSetWithSortedCollection:(id<SCCollection>)collection;
201 
202 #pragma mark -
203 #pragma mark Initializing Ordered Sets
204 - (instancetype)initWithName:(NSString *)name;
205 - (instancetype)initWithObject:(id<SCCollectioning>)object;
206 - (instancetype)initWithObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
207 - (instancetype)initWithCollection:(id<SCCollection>)collection;
208 - (instancetype)initWithArray:(SCArray *)array;
209 - (instancetype)initWithSet:(SCSet *)set;
210 - (instancetype)initWithOrderedSet:(SCOrderedSet *)orderedSet;
211 - (instancetype)init;
212 
213 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
214 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
215 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
216 - (instancetype)initWithAscendingSortedCollection:(id<SCCollection>)collection;
217 - (instancetype)initWithDescendingSortedCollection:(id<SCCollection>)collection;
218 - (instancetype)initWithSortedCollection:(id<SCCollection>)collection;
219 
220 #pragma mark -
221 #pragma mark Copying Ordered Sets
222 - (void)setSet:(SCSet *)set;
223 - (void)setOrderedSet:(SCOrderedSet *)orderedSet;
224 - (void)setArray:(SCArray *)array;
225 - (void)setAscendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
226 - (void)setDescendingSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
227 - (void)setSortedCollection:(id<SCCollection>)collection sorter:(id<SCSorter>)sorter;
228 - (void)setAscendingSortedCollection:(id<SCCollection>)collection;
229 - (void)setDescendingSortedCollection:(id<SCCollection>)collection;
230 - (void)setSortedCollection:(id<SCCollection>)collection;
231 
232 #pragma mark -
233 #pragma mark Comparing Ordered Sets
234 - (BOOL)isSubsetOfOrderedSet:(id<SCCollection>)orderedSet;
235 - (BOOL)isSubsetOfSet:(id<SCCollection>)set;
236 - (BOOL)intersectsOrderedSet:(id<SCCollection>)orderedSet;
237 - (BOOL)intersectsSet:(id<SCCollection>)set;
238 - (BOOL)isEqualToOrderedSet:(SCOrderedSet *)orderedSet;
239 - (BOOL)isEqualToSet:(SCSet *)set;
240 - (BOOL)isEqualToArray:(SCArray *)array;
241 
242 #pragma mark -
243 #pragma mark Sorting Ordered Sets
244 - (void)sortAscendingWithSorter:(id<SCSorter>)sorter;
245 - (void)sortDescendingWithSorter:(id<SCSorter>)sorter;
246 - (void)sortWithSorter:(id<SCSorter>)sorter;
247 - (void)sortAscending;
248 - (void)sortDescending;
249 - (void)sort;
250 - (SCOrderedSet *)ascendingSortedOrderedSetWithSorter:(id<SCSorter>)sorter;
251 - (SCOrderedSet *)descendingSortedOrderedSetWithSorter:(id<SCSorter>)sorter;
252 - (SCOrderedSet *)sortedOrderedSetWithSorter:(id<SCSorter>)sorter;
253 
254 #pragma mark -
255 #pragma mark Adding Objects
256 - (void)insertObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
257 - (void)insertAtIndex:(SCIndex)index objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
258 - (void)insertCollection:(id<SCCollection>)collection atIndex:(SCIndex)index;
259 - (void)insertAtIndexes:(NSIndexSet *)indexes objects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
260 - (void)insertCollection:(id<SCCollection>)collection atIndexes:(NSIndexSet *)indexes;
261 - (void)setObject:(id<SCCollectioning>)object atIndex:(SCIndex)index;
262 
263 #pragma mark -
264 #pragma mark Removing Objects
265 - (void)removeFirstObject;
266 - (void)removeLastObject;
267 - (void)removeObjectAtIndex:(SCIndex)index;
268 - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes;
269 - (void)removeObjectsInRange:(NSRange)range;
270 
271 #pragma mark -
272 #pragma mark Replacing Objects
273 - (void)replaceObjectAtIndex:(SCIndex)index withObject:(id<SCCollectioning>)object;
274 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes
275  withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
276 - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withCollection:(id<SCCollection>)collection;
277 - (void)replaceObjectsInRange:(NSRange)range withObjects:(id<SCCollectioning>)object, ... NS_REQUIRES_NIL_TERMINATION;
278 - (void)replaceObjectsInRange:(NSRange)range withCollection:(id<SCCollection>)collection;
279 
280 #pragma mark -
281 #pragma mark Moving Objects
282 - (void)exchangeObjectAtIndex:(SCIndex)index withObjectAtIndex:(SCIndex)destination;
283 - (void)moveObjectAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
284 - (void)reverse;
285 
286 #pragma mark -
287 #pragma mark Querying an Ordered Set
288 - (id)objectAtIndex:(SCIndex)index;
289 - (SCArray *)objectsAtIndexes:(NSIndexSet *)indexes;
290 
291 #pragma mark -
292 #pragma mark Finding Objects in an Ordered Set
293 - (SCIndex)indexOfObject:(id<SCCollectioning>)object;
294 
295 #pragma mark -
296 #pragma mark Combining and Recombining Ordered Sets
297 - (void)unionOrderedSet:(id<SCCollection>)orderedSet;
298 - (void)unionSet:(id<SCCollection>)set;
299 - (void)minusOrderedSet:(id<SCCollection>)set;
300 - (void)minusSet:(id<SCCollection>)set;
301 - (void)intersectOrderedSet:(id<SCCollection>)orderedSet;
302 - (void)intersectSet:(id<SCCollection>)set;
303 
304 @end
305 
306 #endif
Unordered set class.
Definition: SCSet.h:71
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:101
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:226