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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/code/composite-leaf.java Mon Jun 18 12:10:45 2007 +0200 1.3 @@ -0,0 +1,25 @@ 1.4 + class Leaf implements IComponent { 1.5 + private String id; 1.6 + 1.7 + public Leaf(String id) { 1.8 + this.id = id; 1.9 + } 1.10 + 1.11 + public String toString() { 1.12 + return this.id; 1.13 + } 1.14 + 1.15 + public Collection getChildren() { 1.16 + return null; 1.17 + } 1.18 + 1.19 + // false because failed to add 1.20 + public boolean addComponent(IComponent c) { 1.21 + return false; 1.22 + } 1.23 + 1.24 + // false because failed to find it for removal 1.25 + public boolean removeComponent(IComponent c) { 1.26 + return false; 1.27 + } 1.28 + }