Method Recursion
Method Recursion
- Subject: Method Recursion
- From: Ron Jenkins <email@hidden>
- Date: Tue, 6 Jun 2006 13:33:32 -0400
James Bucanek wrote:
Jeremy's correct. But I will point out one quirk about
expandItem:expandChildren:. While it's behaviour is recursive, the
method itself it not. That is, it doesn't call itself with each child
that its going to expand or collapse.
I discovered this fact when overriding the method in attempt to short-
curcuit its normal behavior. I have an outline browser that could
potentially expand to millions of records, each of which must be read
from a database. Allowing the user to option-click one of the top-
level nodes would have been a disaster. I thought that I could
override this and allow one or two levels of children to be expanded,
but change the expandChildren: argument to NO for anything deeper
than that -- but it doesn't work that way.
--
I'm a little new to OOP but maybe the part where the method calls
itself shouldn't be capable of being overridden? Otherwise you
couldn't change the method internally without breaking code, in this
case changing from recursion to a loop.
Ron
PS I'm at work or else I'd test it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden