[antlr-interest] On trees and JavaBeans, part 2: tree creation
Bryan Ewbank
ewbank at gmail.com
Tue Apr 19 01:55:41 PDT 2005
The Tree isn't what is changing, but merely some position within it:
TreeIterator itr = tree.getIterator();
itr = itr.getChild(i);
We could even define standard TreeIterators for traversals so that a
traversal would look more like a standard loop:
for (itr = tree.getPreOrderDepthFirstIter(); itr; itr++) ...
One less thing to reimplement each time.
On 4/19/05, Micheal J <open.zone at virgin.net> wrote:
> > Hi Guys,
> >
> > I like the flexibility of swing's tree interface, but I don't
> > like the
> > need to pass in the parent to get the child.
> >
> > Tree t = tree.getChild(parent, i);
> >
> > just seems less pleasant than
> >
> > Tree t = parent.getChild(i);
>
> I'm sure you agree this is a minor point ;-)
>
> > Also, you still need a tree node of some kind to actually implement a
> > tree. Perhaps Tree and TreeNode?
>
> Perhaps but a TreeModel-style interface doesn't care or know about the
> concrete types. That is encapsulated in implementation classes.
More information about the antlr-interest
mailing list