Re: [picocontainer-dev] Visitor Work
Paul Hammant <[email protected]> Sat, 21 Jun 2008 17:26:34 -0700
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
maybe it should be tri-state...
HALT_IMMEDIATELY, KEEP_GOING, and NO_DEEPER
Or that might not be possible as you say.
- Paul
On Jun 21, 2008, at 2:03 PM, Michael Rimov wrote:
>
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email