> My understanding of the semantics of node.isLeaf() is that it returns
> true if the node has children (whether fetched or not) and false if the
> node has no children.

That is probably the correct way of thinking about it but its not what
I had in mind when I programmed it.  I was thinking more in terms of
"folders" and "documents."  Something could have a folder yet have no
documents.  So in that case isLeaf returns true but getChildCount
returns 0.
 
> My understanding of the semantics of node.getChildCount() is that it can
> return the number of children fetched or the number of children to be
> fetched, depending upon the needs of the application.  I haven't gone
> through all the Tree2 code, so I'm a little unclear why getChildCount()
> has to be part of the TreeNode interface.

Its useful in a few places.  One is where you want to display the
number of nodes contained in a branch (like we do in the simple
examples.)
 
> With this in mind, I would think that most boolean decisions that are
> based upon whether a node has children should be based upon the
> node.isLeaf() method, not the node.getChildCount() method.

What if we go back to node.isLeaf (as you suggest) but the default
implementation of tree node (TreeNodeBase) will answer that question
by checking the childCount?  Would that work for both sides?

> Are there other interpretations out there about the semantics of these
> two methods?
> 
> Thanks,
> 
> - Brendan

sean

Reply via email to