Class: NSOrderedSet

Inherits:
NSObject show all

Overview

NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects.

Direct Known Subclasses

NSMutableOrderedSet

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (Object) orderedSet

Creates and returns an empty ordered set This method is declared primarily for the use of mutable subclasses of NSOrderedSet.

Returns:

  • (Object)

    A new empty ordered set.

+ (Object) orderedSetWithArray(array)

Creates and returns a set containing a uniqued collection of the objects contained in a given array.

Parameters:

  • array (Array)

    An array containing the objects to add to the new ordered set. If the same object appears more than once in array, it is added only once to the returned set.

Returns:

  • (Object)

    A new ordered set containing a uniqued collection of the objects contained in array.

+ (Object) orderedSetWithArray(array, range:range, copyItems:flag)

Creates and returns a new ordered set for a specified range of objects in an array.

Parameters:

  • array (Array)

    The array

  • range (NSRange)

    The range of the objects to add to the ordered set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    A new ordered set containing a uniqued collection of the objects contained in the specified range of the array.

+ (Object) orderedSetWithObject(object)

Creates and returns a ordered set that contains a single given object.

Parameters:

  • object (Object)

    The object to add to the new set.

Returns:

  • (Object)

    A new ordered set containing object.

+ (Object) orderedSetWithObjects(firstObj, ...)

Creates and returns a ordered set containing the objects in a given argument list.

Parameters:

  • firstObj,

    The first object to add to the new set.

  • ...

    A comma-separated list of objects, ending with nil, to add to the new set.If the same object appears more than once in the list of objects, it is added only once to the returned set. The objects are added to the ordered set in the order that they are listed.

Returns:

  • (Object)

    A new ordered set containing the objects in the argument list.

+ (Object) orderedSetWithObjects(objects, count:cnt)

Creates and returns a set containing a specified number of objects from a given C array of objects.

Parameters:

  • objects (Object)

    A C array of objects to add to the new ordered set.If the same object appears more than once in objects, it is added only once to the returned ordered set. Each object receives a retain message as it is added to the set.

  • cnt (Integer)

    The number of objects from objects to add to the new set.

Returns:

  • (Object)

    A new ordered set containing cnt objects from the list of objects specified by objects.

+ (Object) orderedSetWithOrderedSet(set)

Creates and returns an ordered set containing the objects from another ordered set.

Parameters:

  • set (NSOrderedSet)

    A set containing the objects to add to the new ordered set.The objects are not copied, simply referenced.

Returns:

  • (Object)

    A new ordered set containing the objects from set.

+ (Object) orderedSetWithOrderedSet(set, range:range, copyItems:flag)

Creates and returns a new ordered set for a specified range of objects in an ordered set.

Parameters:

  • set (NSOrderedSet)

    An ordered set.

  • range (NSRange)

    The range of objects in set to add to the ordered set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    A new ordered set containing a uniqued collection of the objects contained in the specified range of the the ordered set.

+ (Object) orderedSetWithSet(set)

Creates and returns an ordered set with the contents of a set.

Parameters:

Returns:

  • (Object)

    A new ordered set containing a uniqued collection of the objects contained in the set.

+ (Object) orderedSetWithSet(set, copyItems:flag)

Creates and returns an ordered set with the contents of a set, optionally copying the items.

Parameters:

  • set (NSSet)

    A set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    A new ordered set containing a uniqued collection of the objects contained in the specified range of the set.

Instance Method Details

- (Object) addObserver(observer, forKeyPath:keyPath, options:options, context:context)

Raises an exception. NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.

Parameters:

  • observer (NSObject)

    The object to register for KVO notifications.

  • keyPath (String)

    The key path, relative to the array, of the property to observe. This value must not be nil.

  • options (NSKeyValueObservingOptions)

    A combination of NSKeyValueObservingOptions values that specifies what is included in observation notifications.

  • context (Object)

    Arbitrary data that is passed to observer in observeValueForKeyPath:ofObject:change:context:.

Returns:

- (Array) array

Returns a representation of the ordered set as an array. This return a proxy object for the receiving ordered set, which acts like an immutable array. While you cannot mutate the ordered set through this proxy, mutations to the original ordered set will be reflected in the proxy and it will appear to change spontaneously, since a copy of the ordered set is not being made.

Returns:

  • (Array)

    An array containing the ordered set’s elements.

- (Boolean) containsObject(object)

Returns a Boolean value that indicates whether a given object is present in the ordered set.

Parameters:

  • object (Object)

    The object for which to test membership of the ordered set.

Returns:

  • (Boolean)

    YES if object is present in the set, otherwise NO.

- (Integer) count

Returns the number of members in the set.

Returns:

  • (Integer)

    The number of members in the set.

- (String) description

Returns a string that represents the contents of the ordered set, formatted as a property list.

Returns:

  • (String)

    A string that represents the contents of the ordered set, formatted as a property list.

- (String) descriptionWithLocale(locale)

Returns a string that represents the contents of the ordered set, formatted as a property list. For a description of how locale is applied to each element in the receiving ordered set, see descriptionWithLocale:indent:.

Parameters:

  • locale (Object)

    An NSLocale object or an NSDictionary object that specifies options used for formatting each of the ordered set’s elements (where recognized). Specify nil if you don’t want the elements formatted.

Returns:

  • (String)

    A string that represents the contents of the ordered set, formatted as a property list.

- (String) descriptionWithLocale(locale, indent:level)

Returns a string that represents the contents of the ordered set, formatted as a property list. The returned NSString object contains the string representations of each of the ordered set’s elements, in order, from first to last. To obtain the string representation of a given element, descriptionWithLocale:indent: proceeds as follows:If the element is an NSString object, it is used as is.If the element responds to descriptionWithLocale:indent:, that method is invoked to obtain the element’s string representation.If the element responds to descriptionWithLocale:, that method is invoked to obtain the element’s string representation.If none of the above conditions is met, the element’s string representation is obtained by invoking its description method

Parameters:

  • locale (Object)

    An NSLocale object or an NSDictionary object that specifies options used for formatting each of the array’s elements (where recognized). Specify nil if you don’t want the elements formatted.

  • level (Integer)

    Specifies a level of indentation, to make the output more readable: the indentation is (4 spaces) * level.

Returns:

  • (String)

    A string that represents the contents of the ordered set, formatted as a property list.

- (Object) enumerateObjectsAtIndexes(indexSet, options:opts, usingBlock:block)

Executes a given block using the objects in the ordered set at the specified indexes. By default, the enumeration starts with the first object and continues serially through the ordered set to the last element specified by indexSet. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important: If the block parameter or the indexSet is nil, this method raises an exception.

Parameters:

  • indexSet

    The indexes of the objects over which to enumerate.

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • block

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.idxThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the block.

  • obj

    The element in the ordered set.

  • idx

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the block.

Returns:

- (Object) enumerateObjectsUsingBlock(block)

Executes a given block using each object in the ordered set.

Parameters:

  • block

    The block to apply to elements in the ordered set.The block takes three arguments:idxThe element in the set.idxThe index of the item in the set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.The block returns a Boolean value that indicates whether obj passed the test.

  • idx

    The element in the set.

  • idx

    The index of the item in the set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

- (Object) enumerateObjectsWithOptions(opts, usingBlock:block)

Executes a given block using each object in the set, using the specified enumeration options.

Parameters:

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • block

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the set.idxThe index of the item in the set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.The block returns a Boolean value that indicates whether obj passed the test.

  • obj

    The element in the set.

  • idx

    The index of the item in the set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

- (Object) firstObject

Returns the first object in the ordered set.

Returns:

  • (Object)

    The first object in the ordered set.

- (Object) getObjects(objects, range:range)

Copies the objects contained in the ordered set that fall within the specified range to objects.

Parameters:

  • objects (Object)

    A C array of objects of size at least the length of the range specified by aRange.

  • range (NSRange)

    A range within the bounds of the array.If the location plus the length of the range is greater than the count of the array, this method raises an NSRangeException.

Returns:

- (NSIndexSet) indexesOfObjectsAtIndexes(indexSet, options:opts, passingTest:predicate)

Returns the index, from a given set of indexes, of the object in the ordered set that passes a test in a given block for a given set of enumeration options. By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important:  If the block parameter or indexSet is nil this method will raise an exception.

Parameters:

  • indexSet

    The indexes of the objects over which to enumerate.

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.idxThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.The block returns a Boolean value that indicates whether obj passed the test.

  • obj

    The element in the ordered set.

  • idx

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (NSIndexSet)

    The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.

- (NSIndexSet) indexesOfObjectsPassingTest(predicate)

Returns the index of the object in the ordered set that passes a test in a given block. If the block parameter is nil, this method raises an exception.

Parameters:

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.TermThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

  • obj

    The element in the ordered set.

  • Term

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (NSIndexSet)

    The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound..

- (NSIndexSet) indexesOfObjectsWithOptions(opts, passingTest:predicate)

Returns the index of an object in the ordered set that passes a test in a given block for a given set of enumeration options. By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important:  If the block parameter or s is nil, this method raises an exception.

Parameters:

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.TermThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

  • obj

    The element in the ordered set.

  • Term

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (NSIndexSet)

    The index whose corresponding value in the ordered set passes the test specified by predicate and opts. If the opts bitmask specifies reverse order, then the last item that matches is returned. Otherwise, the index of the first matching object is returned. If no objects in the ordered set pass the test, returns NSNotFound.

- (Integer) indexOfObject(object)

Returns the index of the specified object.

Parameters:

  • object (Object)

    The object.

Returns:

  • (Integer)

    The index whose corresponding ordered set value is equal to object. If none of the objects in the ordered set is equal to object, returns NSNotFound.

- (Integer) indexOfObject(object, inSortedRange:range, options:opts, usingComparator:cmp)

Returns the index, within a specified range, of an object compared with elements in the ordered set using a given NSComparator block. The elements in the ordered set must have already been sorted using the comparator cmp. If the ordered set is not sorted, the result is undefined.

Parameters:

  • object (Object)

    An object for which to search in the ordered set.If this value is nil, throws an NSInvalidArgumentException.

  • range (NSRange)

    The range within the array to search for object.If r exceeds the bounds of the ordered set (if the location plus length of the range is greater than the count of the ordered set), throws an NSRangeException.

  • opts (NSBinarySearchingOptions)

    Options for the search. For possible values, see NSBinarySearchingOptions.

  • cmp (NSComparator)

    A comparator block used to compare the object obj with elements in the ordered set.If this value is NULL, throws an NSInvalidArgumentException.

Returns:

  • (Integer)

    If the NSBinarySearchingInsertionIndex option is not specified:If the NSBinarySearchingInsertionIndex option is specified, returns the index at which you should insert obj in order to maintain a sorted array:

- (Integer) indexOfObjectAtIndexes(indexSet, options:opts, passingTest:predicate)

Returns the index, from a given set of indexes, of the object in the ordered set that passes a test in a given block for a given set of enumeration options. By default, the enumeration starts with the first object and continues serially through the ordered set to the last element specified by indexSet. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important: If the block parameter or indexSet is nil, this method raises an exception.

Parameters:

  • indexSet

    The indexes of the objects over which to enumerate.

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.idxThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.The block returns a Boolean value that indicates whether obj passed the test.

  • obj

    The element in the ordered set.

  • idx

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (Integer)

    The index of the corresponding value in the ordered set passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.

- (Integer) indexOfObjectPassingTest(predicate)

Returns the index of the object in the ordered set that passes a test in a given block.

Parameters:

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the ordered set.TermThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

  • obj

    The element in the ordered set.

  • Term

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (Integer)

    The index of the corresponding value in the ordered set that passes the test specified by predicate. If no objects in the ordered set pass the test, returns NSNotFound.

- (Integer) indexOfObjectWithOptions(opts, passingTest:predicate)

Returns the index of an object in the ordered set that passes a test in a given block for a given set of enumeration options. By default, the enumeration starts with the first object and continues serially through the ordered set to the last object. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.

Parameters:

  • opts

    A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

  • predicate

    The block to apply to elements in the ordered set.The block takes three arguments:objThe element in the array.idxThe index of the element in the ordered set.stopA reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.The block returns a Boolean value that indicates whether obj passed the test.

  • obj

    The element in the array.

  • idx

    The index of the element in the ordered set.

  • stop

    A reference to a Boolean value. The block can set the value to YES to stop further processing of the set. The stop argument is an out-only argument. You should only ever set this value to YES within the block.

Returns:

  • (Integer)

    The index whose corresponding value in the ordered set passes the test specified by predicate and opts. If no objects in the ordered set pass the test, returns NSNotFound.

- (Object) initWithArray(array)

Initializes a newly allocated set with the objects that are contained in a given array.

Parameters:

  • array (Array)

    An array of objects to add to the new set.If the same object appears more than once in array, it is represented only once in the returned ordered set.

Returns:

  • (Object)

    An initialized ordered set with the contents of array. The returned ordered set might be different than the original receiver.

- (Object) initWithArray(array, copyItems:flag)

Initializes a newly allocated set with the objects that are contained in a given array, optionally copying the items.

Parameters:

  • array (Array)

    An array of objects to add to the new set.If the same object appears more than once in array, it is represented only once in the returned ordered set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    An initialized ordered set containing a uniqued collection of the objects contained in the array.

- (Object) initWithArray(array, range:range, copyItems:flag)

Initializes a newly allocated set with the objects that are contained in the specified range of an array, optionally copying the items.

Parameters:

  • array (Array)

    An array of objects to add to the new set.If the same object appears more than once in array, it is represented only once in the returned ordered set.

  • range (NSRange)

    The range of objects in array to add to the ordered set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    An initialized ordered set containing a uniqued collection of the objects contained in specified range of the the array.

- (Object) initWithObject(object)

Initializes a new ordered set with the object.

Parameters:

  • object (Object)

    The object to add to the new ordered set

Returns:

  • (Object)

    A new ordered set that contains a single member, object.

- (Object) initWithObjects(firstObj, ...)

Initializes a newly allocated set with members taken from the specified list of objects.

Parameters:

  • firstObj,

    The first object to add to the new set.

  • ...

    A comma-separated list of objects, ending with nil, to add to the new ordered set.If the same object appears more than once in the list, it is represented only once in the returned ordered set.

Returns:

  • (Object)

    An initialized ordered set containing the objects specified in the parameter list. The returned set might be different than the original receiver.

- (Object) initWithObjects(objects, count:cnt)

Initializes a newly allocated set with a specified number of objects from a given C array of objects.

Parameters:

  • objects (Object)

    A C array of objects to add to the new set.If the same object appears more than once in objects, it is added only once to the returned ordered set.

  • cnt (Integer)

    The number of objects from objects to add to the new ordered set.

Returns:

  • (Object)

    An initialized ordered set containing cnt objects from the list of objects specified by objects. The returned set might be different than the original receiver.

- (Object) initWithOrderedSet(set)

Initializes a new ordered set with the contents of a set.

Parameters:

Returns:

  • (Object)

    An initialized ordered set containing references to the objects in the set.

- (Object) initWithOrderedSet(set, copyItems:flag)

Initializes a new ordered set with the contents of a set, optionally copying the items.

Parameters:

  • set (NSOrderedSet)

    A set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    An initialized ordered set containing the objects in the set.

- (Object) initWithOrderedSet(orderedSet, range:range, copyItems:flag)

Initializes a new ordered set with the contents of an ordered set, optionally copying the items.

Parameters:

  • orderedSet (NSOrderedSet)

    An ordered set.

  • range (NSRange)

    The range of objects in orderedSet to add to the ordered set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    An initialized ordered set containing the objects in the ordered set.

- (Object) initWithSet(set)

Initializes a new ordered set with the contents of a set.

Parameters:

  • set (NSSet)

    The set.

Returns:

  • (Object)

    An initialized ordered set containing the objects in the set.

- (Object) initWithSet(set, copyItems:flag)

Initializes a new ordered set with the contents of a set, optionally copying the objects in the set.

Parameters:

  • set (NSSet)

    The set.

  • flag (Boolean)

    If YES the objects are copied to the ordered set; otherwise NO.

Returns:

  • (Object)

    An initialized ordered set containing the objects in the set.

- (Boolean) intersectsOrderedSet(other)

Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given ordered set.

Parameters:

Returns:

  • (Boolean)

    YES if at least one object in the receiving ordered set is also present in other, otherwise NO.

- (Boolean) intersectsSet(set)

Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given set.

Parameters:

  • set (NSSet)

    The set.

Returns:

  • (Boolean)

    YES if at least one object in the receiving ordered set is also present in other, otherwise NO.

- (Boolean) isEqualToOrderedSet(other)

Compares the receiving ordered set to another ordered set. Two ordered sets have equal contents if they each have the same number of members, if each member of one ordered set is present in the other, and the members are in the same order.

Parameters:

  • other (NSOrderedSet)

    The ordered set with which to compare the receiving ordered set.

Returns:

  • (Boolean)

    YES if the contents of other are equal to the contents of the receiving ordered set, otherwise NO.

- (Boolean) isSubsetOfOrderedSet(other)

Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given ordered set.

Parameters:

  • other (NSOrderedSet)

    The ordered set with which to compare the receiving ordered set.

Returns:

  • (Boolean)

    YES if every object in the receiving set is also present in other, otherwise NO.

- (Boolean) isSubsetOfSet(set)

Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given set.

Parameters:

  • set (NSSet)

    The set with which to compare the receiving ordered set.

Returns:

  • (Boolean)

    YES if every object in the receiving ordered set is also present in set, otherwise NO.

- (Object) lastObject

Returns the last object in the ordered set.

Returns:

  • (Object)

    The last object in the ordered set.

- (Object) objectAtIndex(index)

Returns the object at the specified index of the set.

Parameters:

  • index (Integer)

    The object located at index.

Returns:

  • (Object)

    If index is beyond the end of the ordered set (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.

- (Object) objectAtIndexedSubscript(index)

Returns the object at the specified index of the set. This method is the same as objectAtIndex:.

Parameters:

  • index (Integer)

    The object located at index.

Returns:

  • (Object)

    If index is beyond the end of the ordered set (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.

- (NSEnumerator) objectEnumerator

Returns an enumerator object that lets you access each object in the ordered set.

Returns:

  • (NSEnumerator)

    An enumerator object that lets you access each object in the ordered set, in order, from the element at the lowest index upwards.

- (Array) objectsAtIndexes(indexes)

Returns the objects in the ordered set at the specified indexes. Raises an NSRangeException if any location in indexes exceeds the bounds of the array, of if indexes is nil.

Parameters:

Returns:

  • (Array)

    The returned objects are in the ascending order of their indexes in indexes, so that object in returned ordered set with higher index in indexes will follow the object with smaller index in indexes.

- (Object) removeObserver(observer, forKeyPath:keyPath)

Raises an exception. NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.

Parameters:

  • observer (NSObject)

    The object to remove as an observer.

  • keyPath (String)

    A key-path, relative to the set, for which observer is registered to receive KVO change notifications. This value must not be nil.

Returns:

- (Object) removeObserver(observer, forKeyPath:keyPath, context:context)

Raises an exception. NSOrderedSet objects are not observable, so this method raises an exception when invoked on an NSOrderedSet object. Instead of observing an ordered set, observe the to-many relationship for which the ordered set is the collection of related objects.

Parameters:

  • observer (NSObject)

    The object to remove as an observer.

  • keyPath (String)

    A key-path, relative to the set, for which observer is registered to receive KVO change notifications. This value must not be nil.

  • context (Object)

    The context passed to the notifications.

Returns:

- (NSOrderedSet) reversedOrderedSet

Returns an ordered set in the reverse order.

Returns:

  • (NSOrderedSet)

    Returns an ordered set in the reversed order of the receiver.

- (NSEnumerator) reverseObjectEnumerator

Returns an enumerator object that lets you access each object in the ordered set.

Returns:

  • (NSEnumerator)

    An enumerator object that lets you access each object in the ordered set, in order, from the element at the highest index downwards.

- (NSSet) set

Returns a representation of the set containing the contents of the ordered set. This return a proxy object for the receiving ordered set, which acts like an immutable set. While you cannot mutate the ordered set through this proxy, mutations to the original ordered set will be reflected in the proxy and it will appear to change spontaneously, since a copy of the ordered set is not being made.

Returns:

  • (NSSet)

    A set containing the ordered set’s elements.

- (Object) setValue(value, forKey:key)

Invokes setValue:forKey: on each of the receiver's members using the specified value and key

Parameters:

  • value (Object)

    The object value.

  • key (String)

    The key to store the value.

Returns:

- (Array) sortedArrayUsingComparator(cmptr)

Returns an array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block

Parameters:

  • cmptr (NSComparator)

    A comparator block.

Returns:

  • (Array)

    An array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified cmptr.

- (Array) sortedArrayWithOptions(opts, usingComparator:cmptr)

Returns an array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified by a given NSComparator block.

Parameters:

  • opts (NSSortOptions)

    A bitmask that specifies the options for the sort (whether it should be performed concurrently and whether it should be performed stably).

  • cmptr (NSComparator)

    A comparator block.

Returns:

  • (Array)

    An array that lists the receiving ordered set’s elements in ascending order, as determined by the comparison method specified cmptr.

- (Object) valueForKey(key)

Returns an ordered set containing the results of invoking valueForKey: using key on each of the ordered set’s objects. The returned ordered set will not contain any elements corresponding to instances of valueForKey: returning nil, nor will it contain duplicates.

Parameters:

  • key (String)

    The key to retrieve.

Returns:

  • (Object)

    The ordered set of the values for the retrieved key. The returned ordered set might not have the same number of members as the receiver.