**DONOTDELETE**
(Unregistered)
04/01/04 06:54 PM
Mistake in Figure 7 on isLeaf() Post It Note

Small mistake in "Figure 7. A component node adapter.".

Mistake is in the far right side Post It Note, where it says:
"
public boolean isLeaf() {
return component.getComponentCount() > 0;
}
"

This is wrong. You can see that isLeaf() wouldn't return true when it really was a leaf.

Checking the article confirms this: the author's Java code is correct, but his UML class model is an accidental fudge of these two methods from the Java code:

public boolean isLeaf() {
return !isContainer();
}

public boolean isContainer() {
return getComponent().getComponentCount() > 0;
}

Great article though. Nice practical example of Adapter. In general, excellent UML use.



Contact us JavaWorld

Powered by UBB.threads™ 6.5.5

Featured White Papers


RESEARCH CENTERS: Java Standard Edition | Java Enterprise Edition | Java Micro Edition | Development Tools
About Us | Advertise | Contact Us | Terms of Service/Privacy
Copyright, 2006-2008 Network World, Inc. All rights reserved.