Package models

Examples of models.XMASTree


    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification lightBranch = new LightsDecorator(plainBranch);
    BranchOfTreeSpecification ballBranch = new BallDecorator(plainBranch);
    BranchOfTreeSpecification starBranch = new StarDecorator(plainBranch);

    XMASTree myTree2Light2Ball = new XMASTree(4);
    myTree2Light2Ball.addDecorator(lightBranch);
    myTree2Light2Ball.animate();
    myTree2Light2Ball.addDecorator(lightBranch);
    myTree2Light2Ball.addDecorator(ballBranch);
    myTree2Light2Ball.addDecorator(ballBranch);

    System.out.println("\nXMAS tree with 2 lights - 2 ball");
    System.out.println("myTree2Light2Ball.getDecorations():"
        + myTree2Light2Ball.getDecorations());
    myTree2Light2Ball.animate();
    System.out.println("myTree2Light2Ball.animate.getDecorations():"
        + myTree2Light2Ball.getDecorations());

//    XMASTree myTree2Light3Star = new XMASTree();
//    myTree2Light3Star.addBranch(new LightsDecorator(plainBranch));
//    myTree2Light3Star.addBranch(new LightsDecorator(plainBranch));
//    myTree2Light3Star.addBranch(new StarDecorator(plainBranch));
View Full Code Here

TOP

Related Classes of models.XMASTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.