Class: NSIndexSet
Overview
The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as an index set.
Direct Known Subclasses
Class Method Summary (collapse)
-
+ indexSet
Creates an empty index set.
-
+ indexSetWithIndex:
Creates an index set with an index.
-
+ indexSetWithIndexesInRange:
Creates an index set with an index range.
Instance Method Summary (collapse)
-
- containsIndex:
Indicates whether the index set contains a specific index.
-
- containsIndexes:
Indicates whether the receiving index set contains a superset of the indexes in another index set.
-
- containsIndexesInRange:
Indicates whether the index set contains the indexes represented by an index range.
-
- count
Returns the number of indexes in the index set.
-
- countOfIndexesInRange:
Returns the number of indexes in the index set that are members of a given range.
-
- enumerateIndexesInRange:options:usingBlock:
Executes a given Block using the indexes in the specified range, using the specified enumeration options.
-
- enumerateIndexesUsingBlock:
Executes a given Block using each object in the index set.
-
- enumerateIndexesWithOptions:usingBlock:
Executes a given Block over the index set’s indexes, using the specified enumeration options.
-
- enumerateRangesInRange:options:usingBlock:
Enumerates over the ranges in the range of objects using the block By default, the enumeration starts with the first object and continues serially through the indexed set range to the last object in the range.
-
- enumerateRangesUsingBlock:
Executes a given block using each object in the index set, in the specified ranges.
-
- enumerateRangesWithOptions:usingBlock:
Executes a given block using each object in the index set, in the specified ranges.
-
- firstIndex
Returns either the first index in the index set or the not-found indicator.
-
- getIndexes:maxCount:inIndexRange:
The index set fills an index buffer with the indexes contained both in the index set and in an index range, returning the number of indexes copied.
-
- indexesInRange:options:passingTest:
Returns an NSIndexSet containing the receiving index set’s objects in the specified range that pass the Block test.
-
- indexesPassingTest:
Returns an NSIndexSet containing the receiving index set’s objects that pass the Block test.
-
- indexesWithOptions:passingTest:
Returns an NSIndexSet containing the receiving index set’s objects that pass the Block test using the specified enumeration options.
-
- indexGreaterThanIndex:
Returns either the closest index in the index set that is greater than a specific index or the not-found indicator.
-
- indexGreaterThanOrEqualToIndex:
Returns either the closest index in the index set that is greater than or equal to a specific index or the not-found indicator.
-
- indexInRange:options:passingTest:
Returns the index of the first object in the specified range that passes the predicate Block test.
-
- indexLessThanIndex:
Returns either the closest index in the index set that is less than a specific index or the not-found indicator.
-
- indexLessThanOrEqualToIndex:
Returns either the closest index in the index set that is less than or equal to a specific index or the not-found indicator.
-
- indexPassingTest:
Returns the index of the first object that passes the predicate Block test.
-
- indexWithOptions:passingTest:
Returns the index of the first object that passes the predicate Block test using the specified enumeration options.
-
- init
Initializes an allocated NSIndexSet object.
-
- initWithIndex:
Initializes an allocated NSIndexSet object with an index.
-
- initWithIndexesInRange:
Initializes an allocated NSIndexSet object with an index range.
-
- initWithIndexSet:
Initializes an allocated NSIndexSet object with an index set.
-
- intersectsIndexesInRange:
Indicates whether the index set contains any of the indexes in a range.
-
- isEqualToIndexSet:
Indicates whether the indexes in the receiving index set are the same indexes contained in another index set.
-
- lastIndex
Returns either the last index in the index set or the not-found indicator.
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, 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) indexSet
Creates an empty index set.
+ (Object) indexSetWithIndex(index)
Creates an index set with an index.
+ (Object) indexSetWithIndexesInRange(indexRange)
Creates an index set with an index range.
Instance Method Details
- (Boolean) containsIndex(index)
Indicates whether the index set contains a specific index.
- (Boolean) containsIndexes(indexSet)
Indicates whether the receiving index set contains a superset of the indexes in another index set.
- (Boolean) containsIndexesInRange(indexRange)
Indicates whether the index set contains the indexes represented by an index range.
- (Integer) count
Returns the number of indexes in the index set.
- (Integer) countOfIndexesInRange(indexRange)
Returns the number of indexes in the index set that are members of a given range.
- (Object) enumerateIndexesInRange(range, options:opts, usingBlock:block)
Executes a given Block using the indexes in the specified range, using the specified enumeration options.
- (Object) enumerateIndexesUsingBlock(block)
Executes a given Block using each object in the index set.
- (Object) enumerateIndexesWithOptions(opts, usingBlock:block)
Executes a given Block over the index set’s indexes, using the specified enumeration options.
- (Object) enumerateRangesInRange(range, options:opts, usingBlock:block)
Enumerates over the ranges in the range of objects using the block By default, the enumeration starts with the first object and continues serially through the indexed set range to the last object in the range. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important: If the Block parameter is nil this method will raise an exception.
- (Object) enumerateRangesUsingBlock(block)
Executes a given block using each object in the index set, in the specified ranges. If the Block parameter is nil this method will raise an exception.
- (Object) enumerateRangesWithOptions(opts, usingBlock:block)
Executes a given block using each object in the index set, in the specified ranges. By default, the enumeration starts with the first object and continues serially through the indexed set range to the last object in the range. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.Important: If the Block parameter is nil this method will raise an exception.
- (Integer) firstIndex
Returns either the first index in the index set or the not-found indicator.
- (Integer) getIndexes(indexBuffer, maxCount:bufferSize, inIndexRange:indexRangePointer)
The index set fills an index buffer with the indexes contained both in the index set and in an index range, returning the number of indexes copied. You are responsible for allocating the memory required for indexBuffer and for releasing it later.Suppose you have an index set with contiguous indexes from 1 to 100. If you use this method to request a range of (1, 100)—which represents the set of indexes 1 through 100—and specify a buffer size of 20, this method returns 20 indexes—1 through 20—in indexBuffer and sets indexRange to (21, 80)—which represents the indexes 21 through 100.Use this method to retrieve entries quickly and efficiently from an index set. You can call this method repeatedly to retrieve blocks of index values and then process them. When doing so, use the return value and indexRange to determine when you have finished processing the desired indexes. When the return value is less than bufferSize, you have reached the end of the range.
- (NSIndexSet) indexesInRange(range, options:opts, passingTest:predicate)
Returns an NSIndexSet containing the receiving index set’s objects in the specified range that pass the Block test.
- (NSIndexSet) indexesPassingTest(predicate)
Returns an NSIndexSet containing the receiving index set’s objects that pass the Block test.
- (NSIndexSet) indexesWithOptions(opts, passingTest:predicate)
Returns an NSIndexSet containing the receiving index set’s objects that pass the Block test using the specified enumeration options.
- (Integer) indexGreaterThanIndex(index)
Returns either the closest index in the index set that is greater than a specific index or the not-found indicator.
- (Integer) indexGreaterThanOrEqualToIndex(index)
Returns either the closest index in the index set that is greater than or equal to a specific index or the not-found indicator.
- (Integer) indexInRange(range, options:opts, passingTest:predicate)
Returns the index of the first object in the specified range that passes the predicate Block test.
- (Integer) indexLessThanIndex(index)
Returns either the closest index in the index set that is less than a specific index or the not-found indicator.
- (Integer) indexLessThanOrEqualToIndex(index)
Returns either the closest index in the index set that is less than or equal to a specific index or the not-found indicator.
- (Integer) indexPassingTest(predicate)
Returns the index of the first object that passes the predicate Block test.
- (Integer) indexWithOptions(opts, passingTest:predicate)
Returns the index of the first object that passes the predicate Block test using the specified enumeration options.
- (Object) init
Initializes an allocated NSIndexSet object.
- (Object) initWithIndex(index)
Initializes an allocated NSIndexSet object with an index.
- (Object) initWithIndexesInRange(indexRange)
Initializes an allocated NSIndexSet object with an index range. This method raises an NSRangeException when indexRange would add an index that exceeds the maximum allowed value for unsigned integers.This method is a designated initializer for NSIndexSet.
- (Object) initWithIndexSet(indexSet)
Initializes an allocated NSIndexSet object with an index set. This method is a designated initializer for NSIndexSet.
- (Boolean) intersectsIndexesInRange(indexRange)
Indicates whether the index set contains any of the indexes in a range.
- (Boolean) isEqualToIndexSet(indexSet)
Indicates whether the indexes in the receiving index set are the same indexes contained in another index set.
- (Integer) lastIndex
Returns either the last index in the index set or the not-found indicator.