docs/DesignPatterns
annotate code/composite-main.java @ 15:0bbbd5de5daf
added content from markus rundel
author | meillo@marmaro.de |
---|---|
date | Sun, 24 Jun 2007 11:41:52 +0200 |
parents | |
children |
rev | line source |
---|---|
meillo@7 | 1 public class Main { |
meillo@7 | 2 public static void main(String[] args) { |
meillo@7 | 3 Composite england = new Composite("England"); |
meillo@7 | 4 Leaf york = new Leaf("York"); |
meillo@7 | 5 Leaf london = new Leaf("London"); |
meillo@7 | 6 england.addComponent(york); |
meillo@7 | 7 england.addComponent(london); |
meillo@7 | 8 england.removeComponent(york); |
meillo@7 | 9 |
meillo@7 | 10 Composite france = new Composite("France"); |
meillo@7 | 11 france.addComponent(new Leaf("Paris")); |
meillo@7 | 12 |
meillo@7 | 13 Composite europe = new Composite("Europe"); |
meillo@7 | 14 europe.addComponent(england); |
meillo@7 | 15 europe.addComponent(france); |
meillo@7 | 16 |
meillo@7 | 17 System.out.println(europe.toString()); |
meillo@7 | 18 } |
meillo@7 | 19 } |