Re: NSIndexSet
Re: NSIndexSet
- Subject: Re: NSIndexSet
- From: Matthew Johnson <email@hidden>
- Date: Sat, 29 Nov 2003 23:04:42 -0600
The check for an overlapping range is a great idea I hadn't thought of.
Thanks Jon! I decided to just loop over the smaller set for now if
there is an overlapping range...
Matthew
On Nov 29, 2003, at 9:59 PM, Jon Hull wrote:
On Nov 29, 2003, at 6:30 PM, Matthew Johnson wrote:
I am implementing a category on NSIndexSet that includes a method -
(BOOL)intersectsIndexes:(NSIndexSet *)indexSet. The implementation
of
this will have to loop through one of the index sets and check for
intersection using containsIndex and intersectsIndexesInRange. I am
wondering whether it would generally be quicker to loop through the
smaller index set or perform the intersection tests on the smaller
index set. Opinions?
Why not just use the methods firstIndex and lastIndex on the both sets
then use the larger firstIndex and smaller lastIndex to make an
NSRange, then return intersectsIndexesInRange?
OOPS, disregard that last message just looked at the docs more
carefully.
I would suggest only checking in the NSRange mentioned in my last
message, but beyond that I doubt that there is a huge speed
difference.
Thanks,
Jon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.