Package models

Examples of models.BallDecorator


  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


    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);

    System.out.println("At beginning: "
        + redecoratedBranchWithStarBall5Light.getDecorations());

    // Animate the first time
    redecoratedBranchWithStarBall5Light.animate();
    System.out.println("\nanimate 1: "
        + redecoratedBranchWithStarBall5Light.getDecorations());

    // Animate the second time
    redecoratedBranchWithStarBall5Light.animate();
    System.out.println("\nanimate 2: "
        + redecoratedBranchWithStarBall5Light.getDecorations());

    // Animate the second time
    redecoratedBranchWithStarBall5Light.animate();
    System.out.println("\nanimate 3: "
        + redecoratedBranchWithStarBall5Light.getDecorations());

    // Animate the second time
    redecoratedBranchWithStarBall5Light.animate();
    System.out.println("\nanimate 4: "
        + redecoratedBranchWithStarBall5Light.getDecorations());

  }
View Full Code Here

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

public class TestBallDecorator {
 
  public static void main (String [] args){
 
  BranchOfTreeSpecification plainBranch = new UndecoratedBranch();
  BranchOfTreeSpecification decoratedBranch = new BallDecorator( plainBranch);
  BranchOfTreeSpecification reDecoratedBranch = new BallDecorator( new BallDecorator( 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

    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());

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

TOP

Related Classes of models.BallDecorator

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.