Platforms to show: All Mac Windows Linux Cross-Platform

NSIndexSetMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.firstIndex)+" "+str(n.lastIndex)

This collection is referred to as a index set.

You use index sets in your code to store indexes into some other data structure. For example, given an array, you could use an index set to identify a subset of objects in that array.

Each index value can appear only once in the index set. This is an important concept to understand and is why you would not use index sets to store an arbitrary collection of integer values. To illustrate how this works, if you created an NSIndexSet object with the values 4, 5, 2, and 5, the resulting set would only have the values 4, 5, and 2 in it. Because index values are always maintained in sorted order, the actual order of the values when you created the set would be 2, 4, and then 5.

In most cases, using an index set is more efficient than storing a collection of individual integers. Internally, the NSIndexSet class represents indexes using ranges. For maximum performance and efficiency, overlapping ranges in an index set are automatically coalesced—that is, ranges merge rather than overlap. Thus, the more contiguous the indexes in the set, the fewer ranges are required to specify those indexes.

You must not subclass the NSIndexSet class.

The mutable subclass of NSIndexSet is NSMutableIndexSet.

Sub classes:

Some methods using this class:

Some properties using for this class:

Some events using this class:

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacBase Plugin.


NSIndexPathMBS   -   NSInputStreamMBS


The biggest plugin in space...