Mercurial > docs > DesignPatterns
diff code/composite-leaf.java @ 7:20c0116dcb97
added files (forgot for last commit
author | meillo@marmaro.de |
---|---|
date | Mon, 18 Jun 2007 12:10:45 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code/composite-leaf.java Mon Jun 18 12:10:45 2007 +0200 @@ -0,0 +1,25 @@ + class Leaf implements IComponent { + private String id; + + public Leaf(String id) { + this.id = id; + } + + public String toString() { + return this.id; + } + + public Collection getChildren() { + return null; + } + + // false because failed to add + public boolean addComponent(IComponent c) { + return false; + } + + // false because failed to find it for removal + public boolean removeComponent(IComponent c) { + return false; + } + }