RE: [picocontainer-dev] Visitor Work

"Michael Rimov" <[email protected]> Sat, 21 Jun 2008 14:03:07 -0700
Newsgroups gmane.comp.java.picocontainer.devel
Organization Centerline Computers, Inc
Message-ID <008b01c8d3e2$3694f320$a3bed960$@com>
 
> OK Mike, I can apply the patch (after two small manual applications to
> two files) and it builds and passes tests.
> 
> visitContainer(PicoContainer) returning true begs a question:
> 
> "Any visitor callback that returns ABORT_TRAVERSAL indicates the
> desire to abort any further traversal"
> 
> Does that mean traversal just halts at the current visitation, or is
> not allowed to go deeper than the current 'container depth' ?

Well, ideally it would halt.  However, without changing PicoContainer.accept(),
it is impossible to truly do an instantaneous halt.  In particular, if DPC is
iterating the child containers, and while visiting one of the child containers,
the visitor calls ABORT_TRAVERSAL, then DPC will keep iterating the child
containers.

So the visitor will need to keep returning ABORT_TRAVERSAL multiple times.

However, it is at least guaranteed at this point that if visitContainer()
returns ABORT_TRAVERSAL, then none of the container's CAFs, CAs, nor child
containers will be visited.

Hokey?  Absolutely.

Would I modify every accept() method in the pico library to return a boolean
value to allow instantaneous guaranteed aborting of the traversal?  Yup.  

Do I think it would be appropriate at this stage in the 2.0 release cycle to do
so?  Nope :)  I think it would force too many API changes.  (It would affect
CA, CAFs, and PicoContainer interfaces)

								-Mike




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email