Package models

Examples of models.StarDecorator


public class TestStarDecorator {

  public static void main(String[] args) {

    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification decoratedBranch = new StarDecorator(
        plainBranch);
    BranchOfTreeSpecification reDecoratedBranch = new StarDecorator(
        new StarDecorator(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());
  }
View Full Code Here


public class TestAllDecorators {

  public static void main(String[] args) {

    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification decoratedBranchWithStar = new StarDecorator(
        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);
View Full Code Here

   */
  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);
    myTree2Light2Ball.animate();
    myTree2Light2Ball.addDecorator(lightBranch);
View Full Code Here

public class TestMultiDecorators {

  public static void main(String[] args) {

    BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
    BranchOfTreeSpecification decoratedBranchWithStar = new StarDecorator(
        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());
View Full Code Here

TOP

Related Classes of models.StarDecorator

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.