Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958563

CJHam
Unregistered




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

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.

Post Extras Print Post   Remind Me!     Notify Moderator


Entire topic
Subject Posted by Posted on
* Mistake in Figure 7 on isLeaf() Post It Note CJHam 04/01/04 06:54 PM

Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   



Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 5499

Rate this thread

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5