java.lang.Object ASCIIArtiste
public class ASCIIArtiste
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 |
---|
private final double HEART_PEAK
private final double SPADE_BOX
Constructor Detail |
---|
public ASCIIArtiste()
Method Detail |
---|
private int getBoxHeightForSpade(int spadeHeight)
spadeHeight
- number of rows to use for entire spade
private int getHeartHeightForSpade(int spadeHeight)
spadeHeight
- number of rows to use for entire spade
private int getPeakHeightForHeart(int heartHeight)
heartHeight
- number of rows to use for entire heart
private int getTriangleHeightForHeart(int heartHeight)
heartHeight
- number of rows to use for entire heart
private int getTriangleWidth(int triangleHeight)
triangleHeight
- number of rows in triangle
public static void main(java.lang.String[] args)
private void printBox(int height, int width, int margin)
height
- number of rows to usewidth
- number of columns to usemargin
- number of white space rows to insert on the leftpublic void printClub(int height)
height
- number of rows to usepublic void printDiamond(int height)
height
- number of rows to usepublic void printHeart(int height)
height
- number of rows to useprivate void printHeartPeaks(int height, int width, boolean pointUp)
height
- number of rows to usewidth
- number of columns to use at widest pointpointUp
- 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).private void printHeartPeaksBody(int i, int height, int width, int margin)
i
- loop counter for main loop in calling methodheight
- number of rows to print outwidth
- width of heart at widest pointmargin
- number of white space rows to insert on the leftprivate int printHeartShape(int height, boolean pointUp)
height
- number of rows to usepointUp
- 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).
public void printSpade(int height)
height
- number of rows to useprivate void printTriangle(int height, int margin, boolean pointUp)
height
- number of rows to usemargin
- number of white space rows to insert on the leftpointUp
- 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.