docs/DesignPatterns
annotate code/composite-main.java @ 21:80c995d97cfa
updated Observer
author | meillo@marmaro.de |
---|---|
date | Tue, 26 Jun 2007 14:36:01 +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 } |