Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSIndexSetMBS class.

NSIndexSetMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes an allocated NSIndexSet object.
Example
dim x as new NSIndexSetMBS

See also:

NSIndexSetMBS.Constructor(index as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes an allocated NSIndexSet object with an index.
Example
dim n as new NSIndexSetMBS(5)
MsgBox str(n.firstIndex)+" "+str(n.lastIndex)

See also:

NSIndexSetMBS.Constructor(indexes as NSIndexSetMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes an allocated NSIndexSet object with an index set.
Example
dim n as new NSIndexSetMBS(5)
dim x as new NSIndexSetMBS(n)
MsgBox str(x.firstIndex)

See also:

NSIndexSetMBS.Constructor(StartIndex as Integer, Length as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes an allocated NSIndexSet object with an index range.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10

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

See also:

NSIndexSetMBS.containsIndex(index as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Indicates whether the receiver contains a specific index.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10

if n.containsIndex(6) then
MsgBox "OK"
else
MsgBox "Error."
end if

if n.containsIndex(11) then
MsgBox "Error."
else
MsgBox "OK"
end if

Returns true when the receiver contains index, false otherwise.

Some examples using this method:

NSIndexSetMBS.containsIndexes(indexes as NSIndexSetMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Indicates whether the receiver contains a superset of the indexes in another index set.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
dim m as new NSIndexSetMBS(6,2)

if n.containsIndexes(m) then
MsgBox "OK"
else
MsgBox "Error."
end if

True when the receiver contains a superset of the indexes in indexSet, false otherwise.

NSIndexSetMBS.containsIndexesInRange(StartIndex as Integer, Length as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Indicates whether the receiver contains the indexes represented by an index range.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
if n.containsIndexesInRange(6,2) then
MsgBox "OK"
else
MsgBox "Error."
end if

Returns true when the receiver contains the indexes in indexRange, false otherwise.

NSIndexSetMBS.copy as NSIndexSetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the Cocoa and RB object.

NSIndexSetMBS.count as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the number of indexes in the receiver.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.count) // shows 6

NSIndexSetMBS.countOfIndexesInRange(StartIndex as Integer, Length as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the number of indexes in the receiver that are members of a given range.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.countOfIndexesInRange(1,8)) // shows 4

Available in Mac OS X v10.5 and later.

NSIndexSetMBS.firstIndex as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the first index in the receiver or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.firstIndex)+" "+str(n.lastIndex)

First index in the receiver or NSNotFound (&h7fffffff) when the receiver is empty.

Some examples using this method:

NSIndexSetMBS.indexGreaterThanIndex(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the closest index in the receiver that is greater than a specific index or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.indexGreaterThanIndex(1)) // shows(5)

Returns the losest index in the receiver greater than index; NSNotFound (&h7FFFFFFF) when the receiver contains no qualifying index.

NSIndexSetMBS.indexGreaterThanOrEqualToIndex(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the closest index in the receiver that is greater than or equal to a specific index or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.indexGreaterThanOrEqualToIndex(1)) // shows(5)

Returns closest index in the receiver greater than or equal to index; NSNotFound (&h7FFFFFFF) when the receiver contains no qualifying index.

NSIndexSetMBS.indexLessThanIndex(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the closest index in the receiver that is less than a specific index or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.indexLessThanIndex(20)) // shows 10
MsgBox str(n.indexLessThanIndex(1)) // shows 2147483647 for not found

Returns closest index in the receiver less than index; NSNotFound (&h7FFFFFFF) when the receiver contains no qualifying index.

NSIndexSetMBS.indexLessThanOrEqualToIndex(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the closest index in the receiver that is less than or equal to a specific index or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.indexLessThanOrEqualToIndex(20)) // shows 10

Returns closest index in the receiver less than or equal to index; NSNotFound (&h7FFFFFFF) when the receiver contains no qualifying index.

NSIndexSetMBS.intersectsIndexesInRange(StartIndex as Integer, Length as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Indicates whether the receiver contains any of the indexes in a range.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10

if n.intersectsIndexesInRange(1,4) then
MsgBox "Error"
else
MsgBox "OK"
end if

if n.intersectsIndexesInRange(1,6) then
MsgBox "OK"
else
MsgBox "Error"
end if

NSIndexSetMBS.isEqualToIndexSet(other as NSIndexSetMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Indicates whether the indexes in the receiver are the same indeces contained in another index set.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
dim m as NSIndexSetMBS = n.mutableCopy

if m.isEqualToIndexSet(n) then
MsgBox "OK"
else
MsgBox "Failed."
end if

NSIndexSetMBS.lastIndex as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns either the last index in the receiver or the not-found indicator.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
MsgBox str(n.firstIndex)+" "+str(n.lastIndex)

Returns Last index in the receiver or NSNotFound (&h7FFFFFFF) when the receiver is empty.

Some examples using this method:

NSIndexSetMBS.mutableCopy as NSMutableIndexSetMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an editable copy of the indexset.
Example
dim n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
dim m as NSMutableIndexSetMBS = n.mutableCopy

m.addIndex 20

MsgBox str(n.lastIndex)+" "+str(m.lastIndex)

NSIndexSetMBS.Operator_Convert as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Converts an indexset to string for display.
Example
dim n as NSIndexSetMBS = NSIndexSetMBS.indexSetWithIndexesInRange(10,40)
MsgBox n

This is for having str() function and msgbox work with NSIndexSetMBS class.
If more than 20 values, you get only 20 values followed with dots and last value on the end.

NSIndexSetMBS.Values as Integer()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns all values in array.
Example
dim n1 as NSIndexSetMBS = NSIndexSetMBS.indexSetWithIndexesInRange(10,10)
dim n2 as NSIndexSetMBS = NSIndexSetMBS.indexSetWithIndexesInRange(30,5)
dim n3 as new NSMutableIndexSetMBS
n3.addIndexes n1
n3.addIndexes n2
dim count1 as Integer = n1.count // 10
dim count2 as Integer = n2.count // 5
dim count3 as Integer = n3.count // 15
dim values1() as Integer = n1.Values
dim values2() as Integer = n2.Values
dim values3() as Integer = n3.Values
break // look in debugger

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


The biggest plugin in space...