Package models

Examples of models.LightsDecorator


public class TestBallLightDecorator {

  public static void main(String[] args) {

    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification decoratedBranchLightBall = new LightsDecorator(
        new BallDecorator(plainBranch));

    BranchOfTreeSpecification reDecoratedBallLight = new BallDecorator(
        new LightsDecorator(plainBranch));

    System.out.println("plainBranch.getDecorations() ="
        + plainBranch.getDecorations());
    System.out.println("decoratedBranchLightBall.getDecorations() ="
        + decoratedBranchLightBall.getDecorations());
    System.out.println("reDecoratedBallLight.getDecorations() ="
        + reDecoratedBallLight.getDecorations());

    // Animate the first time
    System.out.println();
    plainBranch.animate();
    System.out.println("plainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranchLightBall.animate();
    System.out
        .println("decoratedBranchLightBall.animate.getDecorations() ="
            + decoratedBranchLightBall.getDecorations());
    reDecoratedBallLight.animate();

    System.out.println("reDecoratedBallLight.animate.getDecorations() ="
        + reDecoratedBallLight.getDecorations());

    // Animate the second time
    System.out.println();
    plainBranch.animate();
    System.out.println("plainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranchLightBall.animate();
    System.out
        .println("decoratedBranchLightBall.animate.getDecorations() ="
            + decoratedBranchLightBall.getDecorations());

    reDecoratedBallLight.animate();
    System.out.println("reDecoratedBallLight.animate.getDecorations() ="
        + reDecoratedBallLight.getDecorations());
  }
View Full Code Here


        plainBranch);

    BranchOfTreeSpecification redecoratedBranchWithStarBall = new BallDecorator(
        decoratedBranchWithStar);

    BranchOfTreeSpecification redecoratedBranchWithStarBallLight = new LightsDecorator(
        redecoratedBranchWithStarBall);
    BranchOfTreeSpecification redecoratedBranchWithStarBall2Light = new BallDecorator(
        redecoratedBranchWithStarBallLight);
    BranchOfTreeSpecification redecoratedBranchWithStarBall3Light = new StarDecorator(
        redecoratedBranchWithStarBall2Light);
    BranchOfTreeSpecification redecoratedBranchWithStarBall4Light = new LightsDecorator(
        redecoratedBranchWithStarBall3Light);
    BranchOfTreeSpecification redecoratedBranchWithStarBall5Light = new BallDecorator(
        redecoratedBranchWithStarBall4Light);

    System.out.println("At beginning: "
View Full Code Here

   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    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);
View Full Code Here

        plainBranch);

    BranchOfTreeSpecification redecoratedBranchWithStarBall = new BallDecorator(
        decoratedBranchWithStar);

    BranchOfTreeSpecification redecoratedBranchWithStarBallLight = new LightsDecorator(
        redecoratedBranchWithStarBall);

    System.out.println("\nplainBranch.getDecorations() ="
        + plainBranch.getDecorations());
    System.out.println("decoratedBranchWithStar.getDecorations() ="
        + decoratedBranchWithStar.getDecorations());
    System.out.println("redecoratedBranchWithStarBall.getDecorations() ="
        + redecoratedBranchWithStarBall.getDecorations());

    System.out
        .println("redecoratedBranchWithStarBallLight.getDecorations() ="
            + redecoratedBranchWithStarBallLight.getDecorations());

    // Animate the first time
    plainBranch.animate();
    System.out.println("\nplainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranchWithStar.animate();
    System.out.println("decoratedBranchWithStar.animate.getDecorations() ="
        + decoratedBranchWithStar.getDecorations());

    redecoratedBranchWithStarBall.animate();
    System.out
        .println("redecoratedBranchWithStarBall.animate.getDecorations() ="
            + redecoratedBranchWithStarBall.getDecorations());

    redecoratedBranchWithStarBallLight.animate();
    System.out
        .println("redecoratedBranchWithStarBallLight.animate.getDecorations() ="
            + redecoratedBranchWithStarBallLight.getDecorations());

    // Animate the second time
    plainBranch.animate();
    System.out.println("\nplainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranchWithStar.animate();
    System.out.println("decoratedBranchWithStar.animate.getDecorations() ="
        + decoratedBranchWithStar.getDecorations());

    redecoratedBranchWithStarBall.animate();
    System.out
        .println("redecoratedBranchWithStarBall.animate.getDecorations() ="
            + redecoratedBranchWithStarBall.getDecorations());

    redecoratedBranchWithStarBallLight.animate();
    System.out
        .println("redecoratedBranchWithStarBallLight.animate.getDecorations() ="
            + redecoratedBranchWithStarBallLight.getDecorations());
  }
View Full Code Here

public class TestLightDecorator {

  public static void main(String[] args) {

    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification decoratedBranch = new LightsDecorator(
        plainBranch);
    BranchOfTreeSpecification reDecoratedBranch = new LightsDecorator(
        new LightsDecorator(plainBranch));

    System.out.println("plainBranch.getDecorations() ="
        + plainBranch.getDecorations());
    System.out.println("decoratedBranch.getDecorations() ="
        + decoratedBranch.getDecorations());
    System.out.println("reDecoratedBranch.getDecorations() ="
        + reDecoratedBranch.getDecorations());

    plainBranch.animate();
    System.out.println("plainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranch.animate();
    System.out.println("decoratedBranch.animate.getDecorations() ="
        + decoratedBranch.getDecorations());

    reDecoratedBranch.animate();
    System.out.println("reDecoratedBranch.animate.getDecorations() ="
        + reDecoratedBranch.getDecorations());

    plainBranch.animate();
    System.out.println("plainBranch.animate.getDecorations() ="
        + plainBranch.getDecorations());

    decoratedBranch.animate();
    System.out.println("decoratedBranch.animate.getDecorations() ="
        + decoratedBranch.getDecorations());

    reDecoratedBranch.animate();
    System.out.println("reDecoratedBranch.animate.getDecorations() ="
        + reDecoratedBranch.getDecorations());
  }
View Full Code Here

TOP

Related Classes of models.LightsDecorator

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.