Class: NSHashTable
Overview
NSHashTable is modeled after NSSet but provides different options, in particular to support weak relationships.
Class Method Summary (collapse)
-
+ hashTableWithOptions:
Returns a hash table with given pointer functions options.
-
+ weakObjectsHashTable
Returns a new hash table for storing weak references to its contents.
Instance Method Summary (collapse)
-
- addObject:
Adds a given object to the hash table.
-
- allObjects
Returns an array that contains the hash table’s members.
-
- anyObject
Returns one of the objects in the hash table.
-
- containsObject:
Returns a Boolean value that indicates whether the hash table contains a given object.
-
- count
Returns the number of elements in the hash table.
-
- initWithOptions:capacity:
Returns a hash table initialized with the given attributes.
-
- initWithPointerFunctions:capacity:
Returns a hash table initialized with the given functions and capacity.
-
- intersectHashTable:
Removes from the receiving hash table each element that isn’t a member of another given hash table.
-
- intersectsHashTable:
Returns a Boolean value that indicates whether a given hash table intersects with the receiving hash table.
-
- isEqualToHashTable:
Returns a Boolean value that indicates whether a given hash table is equal to the receiving hash table.
-
- isSubsetOfHashTable:
Returns a Boolean value that indicates whether every element in the receiving hash table is also present in another given hash table.
-
- member:
Determines whether the hash table contains a given object, and returns that object if it is present The equality test used depends on the personality option selected.
-
- minusHashTable:
Removes each element in another given hash table from the receiving hash table, if present.
-
- objectEnumerator
Returns an enumerator object that lets you access each object in the hash table.
-
- pointerFunctions
Returns the pointer functions for the hash table.
-
- removeAllObjects
Removes all objects from the hash table.
-
- removeObject:
Removes a given object from the hash table.
-
- setRepresentation
Returns a set that contains the hash table’s members.
-
- unionHashTable:
Adds each element in another given hash table to the receiving hash table, if not present.
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) hashTableWithOptions(options)
Returns a hash table with given pointer functions options.
+ (Object) weakObjectsHashTable
Returns a new hash table for storing weak references to its contents.
Instance Method Details
- (Object) addObject(object)
Adds a given object to the hash table.
- (Array) allObjects
Returns an array that contains the hash table’s members.
- (Object) anyObject
Returns one of the objects in the hash table. The object returned is chosen at the hash table’s convenience—the selection is not guaranteed to be random.
- (Boolean) containsObject(anObject)
Returns a Boolean value that indicates whether the hash table contains a given object. The equality test used depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Integer) count
Returns the number of elements in the hash table.
- (Object) initWithOptions(options, capacity:capacity)
Returns a hash table initialized with the given attributes.
- (Object) initWithPointerFunctions(functions, capacity:initialCapacity)
Returns a hash table initialized with the given functions and capacity. Hash tables allocate additional memory as needed, so initialCapacity simply establishes the object’s initial capacity.
- (Object) intersectHashTable(other)
Removes from the receiving hash table each element that isn’t a member of another given hash table. The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Boolean) intersectsHashTable(other)
Returns a Boolean value that indicates whether a given hash table intersects with the receiving hash table. The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Boolean) isEqualToHashTable(other)
Returns a Boolean value that indicates whether a given hash table is equal to the receiving hash table. Two hash tables have equal contents if they each have the same number of members and if each member of one hash table is present in the other.The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Boolean) isSubsetOfHashTable(other)
Returns a Boolean value that indicates whether every element in the receiving hash table is also present in another given hash table. The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Object) member(object)
Determines whether the hash table contains a given object, and returns that object if it is present The equality test used depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (Object) minusHashTable(other)
Removes each element in another given hash table from the receiving hash table, if present. The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.
- (NSEnumerator) objectEnumerator
Returns an enumerator object that lets you access each object in the hash table. The following code fragment illustrates how you can use this method.
- (NSPointerFunctions) pointerFunctions
Returns the pointer functions for the hash table.
- (Object) removeAllObjects
Removes all objects from the hash table.
- (Object) removeObject(object)
Removes a given object from the hash table.
- (NSSet) setRepresentation
Returns a set that contains the hash table’s members.
- (Object) unionHashTable(other)
Adds each element in another given hash table to the receiving hash table, if not present. The equality test used for members depends on the personality option selected. For instance, choosing the NSPointerFunctionsObjectPersonality option will use isEqual: to determine equality. See NSPointerFunctionsOptions for more information on personality options and their corresponding equality tests.