This is NSSet.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s8 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSSet pard s18 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s11 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying, NSMutableCopying fi0 NSObject (NSObject) fs20 fs28 s12 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSSet.h fs20 fs28 pard s32 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s2 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 The NSSet class declares the programmatic interface to an object that manages an immutable set of objects. NSSet provides support for the mathematical concept of a i seti0 . A set, both in its mathematical sense and in the OpenStep implementation of NSSet, is an i unorderedi0 collection of distinct elements. OpenStep provides the NSMutableSet class for sets whose contents may be altered, and also provides the NSCountedSet class for sets that can contain multiple instances of the same element. fs16 fs28 Use set objects as an alternative to array objects when the order of elements is not important, but performance in testing whether an object is contained in the set i isi0 a consideration'd0while arrays are ordered, testing for membership is slower than with sets. For example, the NSSet method b containsObject:b0 operates in O(1) time when applied to a set, while b containsObject:b0 operates in O(N) time when applied to an array. fs16 fs28 Objects in a set must respond to b hashb0 and b isEqual:b0 methods. See the NSObject protocol for details on b hashb0 and b isEqual:b0 . fs16 fs28 Generally, you instantiate an NSSet object by sending one of the b set'bcb0 methods to the NSSet class object. These methods return an NSSet object containing the elements (if any) you pass in as arguments. The b setb0 method is a 'aaconvenience'ba method to create an empty set. Newly created instances of NSSet created by invoking the b setb0 method can be populated with objects using any of the b init'bcb0 methods. b initWithObjects::b0 is the designated initializer for the NSSet class. Objects added to the set are not copied; rather, each object receives a b retainb0 message before it'27s added to the set. fs16 fs28 NSSet provides methods for querying the elements of the set. b allObjectsb0 returns an array containing all objects in the set.b anyObjectb0 returns some object in the set.b countb0 returns the number of objects currently in the set.b member:b0 returns the object in the set that is equal to a specified object. Additionally, the b intersectsSet:b0 tests for set intersection, b isEqualToSet:b0 tests for set equality, and b isSubsetOfSet:b0 tests for one set being a subset of the specified set object. fs16 fs28 The b objectEnumeratorb0 method provides for traversing elements of the set one by one. fs16 fs28 NSSet'27s b makeObjectsPerform:b0 and b makeObjectsPerform:withObject:b0 methods provides for sending messages to individual objects in the set. fs16 fs28 pard s32 li100 fi0 ri1007 ql f0 b fs24 fs28 Exceptions fs14 fs28 pard s2 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 NSSet implements the b encodeWithCoder:b0 method, which raises NSInternalInconsistencyException if the number of objects enumerated for encoding turns out to be unequal to the number of objects in the set. fs16 fs28 pard s32 li100 fi0 ri1007 ql f0 b fs24 fs28 Allocating and Initializing a Set fs14 fs28 pard s13 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (id)b allocWithZone:b0 (NSZone *)i zonei0 tab Creates and returns an uninitialized set object in i zonei0 . fi-6552 fs16 fs28 fi-6552 + (id)b setb0 tab Creates and returns an empty set object. fi-6552 fs16 fs28 fi-6552 + (id)b setWithArray:b0 (NSArray *)i arrayi0 tab Creates and returns a set object containing the objects in i arrayi0 . fi-6552 fs16 fs28 fi-6552 + (id)b setWithObject:b0 (id)i anObjecti0 tab Creates and returns a set object containing the single element i anObject. fi-6552 i0 fs16 fs28 fi-6552 + (id)b setWithObjects:b0 (id)i firstObj,...i0 tab Creates and returns a set object containing the objects in the argument list. The object list is comma-separated and ends with b nilb0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithArray:b0 (NSArray *)i arrayi0 tab Initializes a newly allocated set object by placing in it the objects contained in i array. fi-6552 i0 fs16 fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (id)i firstObj,...i0 tab Initializes a newly allocated set object by placing in it the objects in the argument list. The object list is comma-separated and ends with b nilb0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (id *)i objectsi0 tab Initializes a newly allocated set object by placing in s14 li7030 fi-6553 fi-5796 b count:b0 (unsigned int)i counti0 tab tab it i counti0 objects from the i objectsi0 array. s13 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithSet:b0 (NSSet *)i anotherSeti0 tab Initializes a newly allocated set object by placing in it the objects contained in i anotherSet. fi-6552 i0 fs16 fs28 fi-6552 {f3 -} (id)b initWithSet:b0 (NSSet *)i seti0 tab Initializes a newly allocated set object by placing in it the s14 li7030 fi-6553 fi-5796 b copyItems:b0 (BOOL)i flagi0 tab tab objects contained in i anotherSeti0 (or immutable copies of them, if i flag i0 is YES). pard s32 li100 fi0 ri1007 ql f0 b fs48 fs28 Querying the Set fs14 fs28 pard s13 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSArray *)b allObjectsb0 tab Returns an array containing all the objects in the set. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b anyObjectb0 tab Returns some object in the set, or b nilb0 if the set is empty. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b containsObject:b0 (id)i anObjecti0 tab Returns YES if i anObjecti0 is present in the set. fi-6552 fs16 fs28 fi-6552 {f3 -} (unsigned int)b countb0 tab Returns the number of objects currently in the set. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b member:b0 (id)i anObjecti0 tab Return the object in the set that is equal to i anObjecti0 , or b nilb0 if none is equal. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSEnumerator *)b objectEnumeratorb0 tab Returns an enumerator object that lets you access each object in the set. pard s32 li100 fi0 ri1007 ql f0 b fs48 fs28 Sending Messages to Elements of the Set fs14 fs28 pard s13 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (void)b makeObjectsPerform:b0 (SEL)i aSelectori0 tab Sends an i aSelectori0 message to each object in the set. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b makeObjectsPerform:b0 (SEL)i aSelectori0 tab Sends an i aSelectori0 message to each object in the s14 li7030 fi-6553 fi-5796 b withObject:b0 (id)i anObjecti0 tab tab set, with i anObjecti0 as an argument. pard s32 li100 fi0 ri1007 ql f0 b fs48 fs28 Comparing Sets fs14 fs28 pard s13 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (BOOL)b intersectsSet:b0 (NSSet *)i otherSeti0 tab Returns YES if there'27s any object in the receiving set that'27s equal to an object in i otherSeti0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b isEqualToSet:b0 (NSSet *)i otherSeti0 tab Returns YES if every object in the receiving set is equal to an object in i otherSeti0 , and the two sets contain the same number of objects. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b isSubsetOfSet:b0 (NSSet *)i otherSeti0 tab Returns YES if every object in the receiving set is equal to an object in i otherSeti0 , and the receiving set contains no more objects than i otherSeti0 does. pard s32 li100 fi0 ri1007 ql f0 b fs48 fs28 Creating a String Description of the Set fs14 fs28 pard s13 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns a string object that describes the contents of the receiver. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary s14 li7030 fi-6553 fi-5796 i0 tab Returns a string representation of the NSSet object, including the keys and values that represent the locale data from i localeDictionaryi0 . }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.