Class: NSOrderedSet
Overview
NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects.
Direct Known Subclasses
Class Method Summary (collapse)
-
+ orderedSet
Creates and returns an empty ordered set This method is declared primarily for the use of mutable subclasses of NSOrderedSet.
-
+ orderedSetWithArray:
Creates and returns a set containing a uniqued collection of the objects contained in a given array.
-
+ orderedSetWithArray:range:copyItems:
Creates and returns a new ordered set for a specified range of objects in an array.
-
+ orderedSetWithObject:
Creates and returns a ordered set that contains a single given object.
-
+ orderedSetWithObjects:
Creates and returns a ordered set containing the objects in a given argument list.
-
+ orderedSetWithObjects:count:
Creates and returns a set containing a specified number of objects from a given C array of objects.
-
+ orderedSetWithOrderedSet:
Creates and returns an ordered set containing the objects from another ordered set.
-
+ orderedSetWithOrderedSet:range:copyItems:
Creates and returns a new ordered set for a specified range of objects in an ordered set.
-
+ orderedSetWithSet:
Creates and returns an ordered set with the contents of a set.
-
+ orderedSetWithSet:copyItems:
Creates and returns an ordered set with the contents of a set, optionally copying the items.
Instance Method Summary (collapse)
-
- addObserver:forKeyPath:options:context:
Raises an exception.
-
- array
Returns a representation of the ordered set as an array.
-
- containsObject:
Returns a Boolean value that indicates whether a given object is present in the ordered set.
-
- count
Returns the number of members in the set.
-
- description
Returns a string that represents the contents of the ordered set, formatted as a property list.
-
- descriptionWithLocale:
Returns a string that represents the contents of the ordered set, formatted as a property list.
-
- descriptionWithLocale:indent:
Returns a string that represents the contents of the ordered set, formatted as a property list.
-
- enumerateObjectsAtIndexes:options:usingBlock:
Executes a given block using the objects in the ordered set at the specified indexes.
-
- enumerateObjectsUsingBlock:
Executes a given block using each object in the ordered set.
-
- enumerateObjectsWithOptions:usingBlock:
Executes a given block using each object in the set, using the specified enumeration options.
-
- firstObject
Returns the first object in the ordered set.
-
- getObjects:range:
Copies the objects contained in the ordered set that fall within the specified range to objects.
-
- indexesOfObjectsAtIndexes:options:passingTest:
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.
-
- indexesOfObjectsPassingTest:
Returns the index of the object in the ordered set that passes a test in a given block.
-
- indexesOfObjectsWithOptions:passingTest:
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.
-
- indexOfObject:
Returns the index of the specified object.
-
- indexOfObject:inSortedRange:options:usingComparator:
Returns the index, within a specified range, of an object compared with elements in the ordered set using a given NSComparator block.
-
- indexOfObjectAtIndexes:options:passingTest:
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.
-
- indexOfObjectPassingTest:
Returns the index of the object in the ordered set that passes a test in a given block.
-
- indexOfObjectWithOptions:passingTest:
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.
-
- initWithArray:
Initializes a newly allocated set with the objects that are contained in a given array.
-
- initWithArray:copyItems:
Initializes a newly allocated set with the objects that are contained in a given array, optionally copying the items.
-
- initWithArray:range:copyItems:
Initializes a newly allocated set with the objects that are contained in the specified range of an array, optionally copying the items.
-
- initWithObject:
Initializes a new ordered set with the object.
-
- initWithObjects:
Initializes a newly allocated set with members taken from the specified list of objects.
-
- initWithObjects:count:
Initializes a newly allocated set with a specified number of objects from a given C array of objects.
-
- initWithOrderedSet:
Initializes a new ordered set with the contents of a set.
-
- initWithOrderedSet:copyItems:
Initializes a new ordered set with the contents of a set, optionally copying the items.
-
- initWithOrderedSet:range:copyItems:
Initializes a new ordered set with the contents of an ordered set, optionally copying the items.
-
- initWithSet:
Initializes a new ordered set with the contents of a set.
-
- initWithSet:copyItems:
Initializes a new ordered set with the contents of a set, optionally copying the objects in the set.
-
- intersectsOrderedSet:
Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given ordered set.
-
- intersectsSet:
Returns a Boolean value that indicates whether at least one object in the receiving ordered set is also present in another given set.
-
- isEqualToOrderedSet:
Compares the receiving ordered set to another ordered set.
-
- isSubsetOfOrderedSet:
Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given ordered set.
-
- isSubsetOfSet:
Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given set.
-
- lastObject
Returns the last object in the ordered set.
-
- objectAtIndex:
Returns the object at the specified index of the set.
-
- objectAtIndexedSubscript:
Returns the object at the specified index of the set.
-
- objectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
-
- objectsAtIndexes:
Returns the objects in the ordered set at the specified indexes.
-
- removeObserver:forKeyPath:
Raises an exception.
-
- removeObserver:forKeyPath:context:
Raises an exception.
-
- reversedOrderedSet
Returns an ordered set in the reverse order.
-
- reverseObjectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
-
- set
Returns a representation of the set containing the contents of the ordered set.
-
- setValue:forKey:
Invokes setValue:forKey: on each of the receiver's members using the specified value and key.
-
- sortedArrayUsingComparator:
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.
-
- sortedArrayWithOptions:usingComparator:
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.
-
- valueForKey:
Returns an ordered set containing the results of invoking valueForKey: using key on each of the ordered set’s objects.
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.
+ (Object) orderedSetWithArray(array)
Creates and returns a set containing a uniqued collection of the objects contained in a given array.
+ (Object) orderedSetWithArray(array, range:range, copyItems:flag)
Creates and returns a new ordered set for a specified range of objects in an array.
+ (Object) orderedSetWithObject(object)
Creates and returns a ordered set that contains a single given object.
+ (Object) orderedSetWithObjects(firstObj, ...)
Creates and returns a ordered set containing the objects in a given 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.
+ (Object) orderedSetWithOrderedSet(set)
Creates and returns an ordered set containing the objects from another ordered 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.
+ (Object) orderedSetWithSet(set)
Creates and returns an ordered set with the contents of a set.
+ (Object) orderedSetWithSet(set, copyItems:flag)
Creates and returns an ordered set with the contents of a set, optionally copying the items.
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.
- (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.
- (Boolean) containsObject(object)
Returns a Boolean value that indicates whether a given object is present in the ordered set.
- (Integer) count
Returns 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.
- (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:.
- (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
- (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.
- (Object) enumerateObjectsUsingBlock(block)
Executes a given block using each object in the ordered set.
- (Object) enumerateObjectsWithOptions(opts, usingBlock:block)
Executes a given block using each object in the set, using the specified enumeration options.
- (Object) firstObject
Returns 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.
- (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.
- (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.
- (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.
- (Integer) indexOfObject(object)
Returns the index of the specified object.
- (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.
- (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.
- (Integer) indexOfObjectPassingTest(predicate)
Returns the index of the object in the ordered set that passes a test in a given block.
- (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.
- (Object) initWithArray(array)
Initializes a newly allocated set with the objects that are contained in a given array.
- (Object) initWithArray(array, copyItems:flag)
Initializes a newly allocated set with the objects that are contained in a given array, optionally copying the items.
- (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.
- (Object) initWithObject(object)
Initializes a new ordered set with the object.
- (Object) initWithObjects(firstObj, ...)
Initializes a newly allocated set with members taken from the specified list of objects.
- (Object) initWithObjects(objects, count:cnt)
Initializes a newly allocated set with a specified number of objects from a given C array of objects.
- (Object) initWithOrderedSet(set)
Initializes a new ordered set with the contents of a set.
- (Object) initWithOrderedSet(set, copyItems:flag)
Initializes a new ordered set with the contents of a set, optionally copying the items.
- (Object) initWithOrderedSet(orderedSet, range:range, copyItems:flag)
Initializes a new ordered set with the contents of an ordered set, optionally copying the items.
- (Object) initWithSet(set)
Initializes a new ordered set with the contents of a set.
- (Object) initWithSet(set, copyItems:flag)
Initializes a new ordered set with the contents of a set, optionally copying 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.
- (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.
- (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.
- (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.
- (Boolean) isSubsetOfSet(set)
Returns a Boolean value that indicates whether every object in the receiving ordered set is also present in another given set.
- (Object) lastObject
Returns the last object in the ordered set.
- (Object) objectAtIndex(index)
Returns the object at the specified index of the set.
- (Object) objectAtIndexedSubscript(index)
Returns the object at the specified index of the set. This method is the same as objectAtIndex:.
- (NSEnumerator) objectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
- (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.
- (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.
- (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.
- (NSOrderedSet) reversedOrderedSet
Returns an ordered set in the reverse order.
- (NSEnumerator) reverseObjectEnumerator
Returns an enumerator object that lets you access each object in the ordered set.
- (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.
- (Object) setValue(value, forKey:key)
Invokes setValue:forKey: on each of the receiver's members using the specified value and key
- (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
- (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.
- (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.