Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSIndexSetMBS class.

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
Var 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
Var 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
Var 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
Var 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
Var 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
Var 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
Var n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
Var 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
Var 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
Var n as new NSIndexSetMBS(5,6) // 5, 6, 7, 8, 9, 10
Var 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
Var 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
Var n1 as NSIndexSetMBS = NSIndexSetMBS.indexSetWithIndexesInRange(10,10)
Var n2 as NSIndexSetMBS = NSIndexSetMBS.indexSetWithIndexesInRange(30,5)
Var n3 as new NSMutableIndexSetMBS
n3.addIndexes n1
n3.addIndexes n2
Var count1 as Integer = n1.count // 10
Var count2 as Integer = n2.count // 5
Var count3 as Integer = n3.count // 15
Var values1() as Integer = n1.Values
Var values2() as Integer = n2.Values
Var 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...