Class ASCIIArtiste

java.lang.Object
  extended by ASCIIArtiste

public class ASCIIArtiste
extends java.lang.Object


Field Summary
private  double HEART_PEAK
          Proportion of peak to triangle when drawing heart.
private  double SPADE_BOX
          Proportion of box to upside down heart when drawing spade.
 
Constructor Summary
ASCIIArtiste()
          Create a new ASCIIArtiste object.
 
Method Summary
private  int getBoxHeightForSpade(int spadeHeight)
          Compute height of box for spade shape, given total spade height
private  int getHeartHeightForSpade(int spadeHeight)
          Compute height of heart for spade shape, given total spade height
private  int getPeakHeightForHeart(int heartHeight)
          Compute height of peak for heart shape, given total heart height
private  int getTriangleHeightForHeart(int heartHeight)
          Compute height of triangle for heart shape, given total heart height
private  int getTriangleWidth(int triangleHeight)
          Compute the width of a triangle given its height
static void main(java.lang.String[] args)
          Driver for ASCIIArtiste class.
private  void printBox(int height, int width, int margin)
          Print out rectangular box at the given horizontal offset, using stars and whitespace.
 void printClub(int height)
          Theoretically, print out a club using rows of stars and whitespace; right now just prints out a simple box.
 void printDiamond(int height)
          Print out a diamond using rows of stars and whitespace.
 void printHeart(int height)
          Print out a heart using rows of stars and whitespace.
private  void printHeartPeaks(int height, int width, boolean pointUp)
          Print out top part of heart with twin peaks, using stars and whitespace.
private  void printHeartPeaksBody(int i, int height, int width, int margin)
          Helper function for printing the peaks of a heart shape, one line at a time; only partially implemented.
private  int printHeartShape(int height, boolean pointUp)
          Print out a heart, using stars and whitespace, either right side up or upside down.
 void printSpade(int height)
          Print out a spade using rows of stars and whitespace.
private  void printTriangle(int height, int margin, boolean pointUp)
          Print out triangle that is symmetric around vertical axis, using stars and whitespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEART_PEAK

private final double HEART_PEAK
Proportion of peak to triangle when drawing heart. It's fine, but not required, to experiment by changing this default value.

See Also:
Constant Field Values

SPADE_BOX

private final double SPADE_BOX
Proportion of box to upside down heart when drawing spade. It's fine, but not required, to experiment by changing this default value.

See Also:
Constant Field Values
Constructor Detail

ASCIIArtiste

public ASCIIArtiste()
Create a new ASCIIArtiste object.

Method Detail

getBoxHeightForSpade

private int getBoxHeightForSpade(int spadeHeight)
Compute height of box for spade shape, given total spade height

Parameters:
spadeHeight - number of rows to use for entire spade
Returns:
number of rows to use for lower box section

getHeartHeightForSpade

private int getHeartHeightForSpade(int spadeHeight)
Compute height of heart for spade shape, given total spade height

Parameters:
spadeHeight - number of rows to use for entire spade
Returns:
number of rows to use for heart section

getPeakHeightForHeart

private int getPeakHeightForHeart(int heartHeight)
Compute height of peak for heart shape, given total heart height

Parameters:
heartHeight - number of rows to use for entire heart
Returns:
number of rows to use for upper peak section

getTriangleHeightForHeart

private int getTriangleHeightForHeart(int heartHeight)
Compute height of triangle for heart shape, given total heart height

Parameters:
heartHeight - number of rows to use for entire heart
Returns:
number of rows to use for triangle section

getTriangleWidth

private int getTriangleWidth(int triangleHeight)
Compute the width of a triangle given its height

Parameters:
triangleHeight - number of rows in triangle
Returns:
width of triangle at widest point

main

public static void main(java.lang.String[] args)
Driver for ASCIIArtiste class. Start by just using this as a test driver, ensuring that each simple private piece of your program works correctly. Eventually however, you'll want to replace the entire body of the main method with code to implement the Artiste Interface in the specification. When you do change this to be the code for the Artiste Interface, ensure that you call only public methods of the ASCIIArtiste class. You can make that easier to do, if you prefer, by writing the main method in another file named, for example, CardMaker.java. If you use that solution, be sure to submit the second file both physically and electronically and state clearly in your README.txt file what you have done.


printBox

private void printBox(int height,
                      int width,
                      int margin)
Print out rectangular box at the given horizontal offset, using stars and whitespace.

Parameters:
height - number of rows to use
width - number of columns to use
margin - number of white space rows to insert on the left

printClub

public void printClub(int height)
Theoretically, print out a club using rows of stars and whitespace; right now just prints out a simple box.

Parameters:
height - number of rows to use

printDiamond

public void printDiamond(int height)
Print out a diamond using rows of stars and whitespace.

Parameters:
height - number of rows to use

printHeart

public void printHeart(int height)
Print out a heart using rows of stars and whitespace.

Parameters:
height - number of rows to use

printHeartPeaks

private void printHeartPeaks(int height,
                             int width,
                             boolean pointUp)
Print out top part of heart with twin peaks, using stars and whitespace.

Parameters:
height - number of rows to use
width - number of columns to use at widest point
pointUp - if true, heart printout has point facing upwards and peaks facing downwards (upside down heart); if false, heart printout has point facing downwards and peaks facing upwards (standard heart configuration).

printHeartPeaksBody

private void printHeartPeaksBody(int i,
                                 int height,
                                 int width,
                                 int margin)
Helper function for printing the peaks of a heart shape, one line at a time; only partially implemented.

Parameters:
i - loop counter for main loop in calling method
height - number of rows to print out
width - width of heart at widest point
margin - number of white space rows to insert on the left

printHeartShape

private int printHeartShape(int height,
                            boolean pointUp)
Print out a heart, using stars and whitespace, either right side up or upside down.

Parameters:
height - number of rows to use
pointUp - if true, heart printout has point facing upwards and peaks facing downwards (upside down heart); if false, heart printout has point facing downwards and peaks facing upwards (standard heart configuration).
Returns:
width of heart

printSpade

public void printSpade(int height)
Print out a spade using rows of stars and whitespace.

Parameters:
height - number of rows to use

printTriangle

private void printTriangle(int height,
                           int margin,
                           boolean pointUp)
Print out triangle that is symmetric around vertical axis, using stars and whitespace.

Parameters:
height - number of rows to use
margin - number of white space rows to insert on the left
pointUp - if true, triangle point is on top and flat part is on bottom; if false, triangle point is facing down and flat part is on top.