Up

NSIndexSet documentation

Authors

Richard Frith-Macdonald (rfm@gnu.org)

Copyright: (C) 2004 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSIndexSet class
  2. Software documentation for the NSMutableIndexSet class

Software documentation for the NSIndexSet class

NSIndexSet : NSObject

Declared in:
Foundation/NSIndexSet.h
Conforms to:
NSCopying
NSMutableCopying
NSCoding
Availability: MacOS-X 10.0.0

Instances of this class are collections of unsigned integers in the range 0 to NSNotFound-1.
Each integer can appear in a collection only once.

Instance Variables

Method summary

indexSet 

+ (id) indexSet;
Availability: MacOS-X 10.0.0

Return an empty set.

indexSetWithIndex: 

+ (id) indexSetWithIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Return a set containing the single value anIndex, or returns nil if anIndex is NSNotFound.

indexSetWithIndexesInRange: 

+ (id) indexSetWithIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Return a set containing all the values in aRange, or returns nil if aRange contains NSNotFound.

containsIndex: 

- (BOOL) containsIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Returns YES if the receiver contains anIndex, NO otherwise.

containsIndexes: 

- (BOOL) containsIndexes: (NSIndexSet*)aSet;
Availability: MacOS-X 10.0.0

Returns YES if the receiver contains all the index values present in aSet, NO otherwise.

containsIndexesInRange: 

- (BOOL) containsIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Returns YES if the receiver contains all the index values present in aRange, NO otherwise.

count 

- (NSUInteger) count;
Availability: MacOS-X 10.0.0

Returns the number of index values present in the receiver.

countOfIndexesInRange: 

- (NSUInteger) countOfIndexesInRange: (NSRange)range;
Availability: MacOS-X 10.5.0

Not implemented Returns the number of indexes set within the specified range.

enumerateIndexesInRange: options: usingBlock: 

- (void) enumerateIndexesInRange: (NSRange)range options: (NSEnumerationOptions)opts usingBlock: (GSIndexSetEnumerationBlock)aBlock;
Availability: MacOS-X 10.6.0

Description forthcoming.

enumerateIndexesUsingBlock: 

- (void) enumerateIndexesUsingBlock: (GSIndexSetEnumerationBlock)aBlock;
Availability: MacOS-X 10.6.0

Enumerate all indices in the set by applying a block to them.

enumerateIndexesWithOptions: usingBlock: 

- (void) enumerateIndexesWithOptions: (NSEnumerationOptions)opts usingBlock: (GSIndexSetEnumerationBlock)aBlock;
Availability: MacOS-X 10.6.0

Description forthcoming.

firstIndex 

- (NSUInteger) firstIndex;
Availability: MacOS-X 10.0.0

Returns the first index value in the receiver or NSNotFound if the receiver is empty.

getIndexes: maxCount: inIndexRange: 

- (NSUInteger) getIndexes: (NSUInteger*)aBuffer maxCount: (NSUInteger)aCount inIndexRange: (NSRangePointer)aRange;
Availability: MacOS-X 10.0.0

Copies index values into aBuffer until there are no index values left or aBuffer is full (assuming that the size of aBuffer is given by aCount).
Only copies index values present in aRange and copies them in order.
Returns the number of index values placed in aBuffer.
Modifies aRange to start after the last index value copied.
If aRange is a null pointer, this method attempts to get all index values from the set (and of course no range can be returned in it).

indexGreaterThanIndex: 

- (NSUInteger) indexGreaterThanIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Return the first index value in the receiver which is greater than anIndex.

indexGreaterThanOrEqualToIndex: 

- (NSUInteger) indexGreaterThanOrEqualToIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Return the first index value in the receiver which is greater than or equal to anIndex.

indexLessThanIndex: 

- (NSUInteger) indexLessThanIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Return the first index value in the receiver which is less than anIndex.

indexLessThanOrEqualToIndex: 

- (NSUInteger) indexLessThanOrEqualToIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Return the first index value in the receiver which is less than or equal to anIndex.

initWithIndex: 

- (id) initWithIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Initialise the receiver to contain anIndex. Returns the initialised object or nil if anIndex is NSNotFound.

initWithIndexSet: 

- (id) initWithIndexSet: (NSIndexSet*)aSet;
Availability: MacOS-X 10.0.0

Initialises the receiver with the index values from aSet.

initWithIndexesInRange: 

- (id) initWithIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

This is a designated initialiser for the class.
Initialise the receiver to contain all index values in aRange. Returns the initialised object or nil if aRange contains NSNotFound.

intersectsIndexesInRange: 

- (BOOL) intersectsIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Returns YES if the receiver contains any index values which lie in aRange, No otherwise.

isEqualToIndexSet: 

- (BOOL) isEqualToIndexSet: (NSIndexSet*)aSet;
Availability: MacOS-X 10.0.0

Tests two index sets for equality and returns either YES or NO.

lastIndex 

- (NSUInteger) lastIndex;
Availability: MacOS-X 10.0.0

Returns the last index value in the receiver or NSNotFound if the receiver is empty.



Instance Variables for NSIndexSet Class

_data

@protected void* _data;
Availability: MacOS-X 10.0.0

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.




Software documentation for the NSMutableIndexSet class

NSMutableIndexSet : NSIndexSet

Declared in:
Foundation/NSIndexSet.h
Availability: MacOS-X 10.0.0

Description forthcoming.
Method summary

addIndex: 

- (void) addIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Adds anIndex to the set of indexes stored in the receiver.

addIndexes: 

- (void) addIndexes: (NSIndexSet*)aSet;
Availability: MacOS-X 10.0.0

Adds all the indexes from aSet to the set of indexes stored in the receiver.

addIndexesInRange: 

- (void) addIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Adds all the indexes in aRange to the set of indexes stored in the receiver.

removeAllIndexes 

- (void) removeAllIndexes;
Availability: MacOS-X 10.0.0

Removes all indexes stored in the receiver.

removeIndex: 

- (void) removeIndex: (NSUInteger)anIndex;
Availability: MacOS-X 10.0.0

Removes anIndex from the set of indexes stored in the receiver.

removeIndexes: 

- (void) removeIndexes: (NSIndexSet*)aSet;
Availability: MacOS-X 10.0.0

Removes all the indexes in aSet from the set of indexes stored in the receiver.

removeIndexesInRange: 

- (void) removeIndexesInRange: (NSRange)aRange;
Availability: MacOS-X 10.0.0

Removes all the indexes in aRange from the set of indexes stored in the receiver.

shiftIndexesStartingAtIndex: by: 

- (void) shiftIndexesStartingAtIndex: (NSUInteger)anIndex by: (NSInteger)amount;
Availability: MacOS-X 10.0.0

Moves all the indexes from anIndex upwards by the amount specified.
If amount is negative, index values below anIndex will be overwritten by the shifted values.
If amount is positive, a 'hole' will be left in the index range after anIndex.


Up