docs/DesignPatterns
annotate code/composite-leaf.java @ 26:19e867456aff
added content to composite
author | meillo@marmaro.de |
---|---|
date | Wed, 27 Jun 2007 21:24:13 +0200 |
parents | |
children |
rev | line source |
---|---|
meillo@7 | 1 class Leaf implements IComponent { |
meillo@7 | 2 private String id; |
meillo@7 | 3 |
meillo@7 | 4 public Leaf(String id) { |
meillo@7 | 5 this.id = id; |
meillo@7 | 6 } |
meillo@7 | 7 |
meillo@7 | 8 public String toString() { |
meillo@7 | 9 return this.id; |
meillo@7 | 10 } |
meillo@7 | 11 |
meillo@7 | 12 public Collection getChildren() { |
meillo@7 | 13 return null; |
meillo@7 | 14 } |
meillo@7 | 15 |
meillo@7 | 16 // false because failed to add |
meillo@7 | 17 public boolean addComponent(IComponent c) { |
meillo@7 | 18 return false; |
meillo@7 | 19 } |
meillo@7 | 20 |
meillo@7 | 21 // false because failed to find it for removal |
meillo@7 | 22 public boolean removeComponent(IComponent c) { |
meillo@7 | 23 return false; |
meillo@7 | 24 } |
meillo@7 | 25 } |