docs/DesignPatterns

diff code/composite-main.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-main.java	Mon Jun 18 12:10:45 2007 +0200
     1.3 @@ -0,0 +1,19 @@
     1.4 +    public class Main {
     1.5 +            public static void main(String[] args) {
     1.6 +                    Composite england = new Composite("England");
     1.7 +                    Leaf york = new Leaf("York");
     1.8 +                    Leaf london = new Leaf("London");
     1.9 +                    england.addComponent(york);
    1.10 +                    england.addComponent(london);
    1.11 +                    england.removeComponent(york);
    1.12 +
    1.13 +                    Composite france = new Composite("France");
    1.14 +                    france.addComponent(new Leaf("Paris"));
    1.15 +
    1.16 +                    Composite europe = new Composite("Europe");
    1.17 +                    europe.addComponent(england);
    1.18 +                    europe.addComponent(france);
    1.19 +
    1.20 +                    System.out.println(europe.toString());
    1.21 +            }
    1.22 +    }