[gme-users] RE: About the generated visitor

Aditya Agrawal Aditya at isis.vanderbilt.edu
Mon Apr 5 14:23:12 CDT 2004


> > I guess it would be more complete and useful to implement the
> > traversal code as well. I guess we have to wait for Adi'
> > input as well. Also, if you have observed BON 2.0 has this
> > facility of visiting bottom-up or top-down (i.e all leaves
> > first and then nodes, or nodes first and children next). I
> > was trying to mimic this in my code with the use of the
> > "vOrder" argument.
> >
> 
> Lacking documentation (and proximity) for BON2.0, can you give me more
> details on how to do the topdown/bottom up traversal schemes?
> Specifically,
> which calls to make? I 'found' the bottom-up by accident one day,
after I
> had already written my own top-down version. I have decided to
cross-post,
> since this seems interesting to UDM's traversal discussion as well as
> GME's thought process.

[Adi] 
udm-users, Please excuse me saying the same thing again, this is for the
gme-users.

If we provide some predefined traversal order to the visitor we are
restricting it. [Please read the Design Patterns Gang of Four book for
more details on this design pattern]. 

The correct way to provide the functionality that BON 2 currently
provides is to have another class called HierarchyVisitor that derives
from a bare base Visitor and does the traversal for you. In this case
the HierarchyVisitor will need to use the Strategy pattern to allow
outside users to make the implementation calls. [Please read on the
Strategy pattern as well]. Using the strategy pattern, top-down,
bottom-up and all such issues can be easily tackeled. If people are
interested I can write some more about exactly how this would be done.

Thanks,
Adi


More information about the gme-users mailing list