Next Page > Hide TOC

NSMutableIndexSet Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in Mac OS X v10.3 and later.
Companion guide
Declared in
NSIndexSet.h
Related sample code

Overview

The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as a mutable index set.

The values in a mutable index set are always sorted, so the order in which values are added is irrelevant.

You must not subclass the NSMutableIndexSet class.

Tasks

Adding Indexes

Removing Indexes

Shifting Index Groups

Instance Methods

addIndex:

Adds an index to the receiver.

- (void)addIndex:(NSUInteger)index

Parameters
index

Index to add.

Availability
See Also
Related Sample Code
Declared In
NSIndexSet.h

addIndexes:

Adds the indexes in an index set to the receiver.

- (void)addIndexes:(NSIndexSet *)indexSet

Parameters
indexSet

Index set to add.

Availability
See Also
Declared In
NSIndexSet.h

addIndexesInRange:

Adds the indexes in an index range to the receiver.

- (void)addIndexesInRange:(NSRange)indexRange

Parameters
indexRange

Index range to add. Must include only indexes representable as unsigned integers.

Discussion

This method raises an NSRangeException when indexRange would add an index that exceeds the maximum allowed value for unsigned integers.

Availability
See Also
Declared In
NSIndexSet.h

removeAllIndexes

Removes the receiver’s indexes.

- (void)removeAllIndexes

Availability
See Also
Declared In
NSIndexSet.h

removeIndex:

Removes an index from the receiver.

- (void)removeIndex:(NSUInteger)index

Parameters
index

Index to remove.

Availability
See Also
Declared In
NSIndexSet.h

removeIndexes:

Removes the indexes in an index set from the receiver.

- (void)removeIndexes:(NSIndexSet *)indexSet

Parameters
indexSet

Index set to remove.

Availability
See Also
Declared In
NSIndexSet.h

removeIndexesInRange:

Removes the indexes in an index range from the receiver.

- (void)removeIndexesInRange:(NSRange)indexRange

Parameters
indexRange

Index range to remove.

Availability
See Also
Declared In
NSIndexSet.h

shiftIndexesStartingAtIndex:by:

Shifts a group of indexes to the left or the right within the receiver.

- (void)shiftIndexesStartingAtIndex:(NSUInteger)startIndex by:(NSInteger)delta

Parameters
startIndex

Head of the group of indexes to shift.

delta

Amount and direction of the shift. Positive integers shift the indexes to the right. Negative integers shift the indexes to the left.

Discussion

The group of indexes shifted is made up by startIndex and the indexes that follow it in the receiver.

A left shift deletes the indexes in the range (startIndex-delta,delta) from the receiver.

A right shift inserts empty space in the range (indexStart,delta) in the receiver.

Availability
Declared In
NSIndexSet.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.