Skip to content

Commit e7fd6d5

Browse files
committed
added Javadoc info
1 parent 5e1cc2b commit e7fd6d5

6 files changed

Lines changed: 121 additions & 1 deletion

File tree

src/org/teachingextensions/logo/ColorWheel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.awt.Color;
44

55
/**
6+
* <img src="https://cdn0.iconfinder.com/data/icons/pixelo/32/color-palette.png" align="left" >
67
* ColorWheel is a place to store a color palette. <br/>
78
* <b>Example:</b> If you have a palette of
89
* <font color="blue">blue</font>,

src/org/teachingextensions/logo/Pizza.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,31 @@
22

33
import java.util.ArrayList;
44

5+
/**
6+
* <img src="https://cdn2.iconfinder.com/data/icons/fatcow/32x32/pizza.png" align="left">
7+
* The Pizza allows you to make different sizes and kinds of pizza!
8+
*/
59
public class Pizza
610
{
711
private ArrayList<Topping> toppings = new ArrayList<Topping>();
812
private boolean cooked;
913
private int slices = 2;
14+
/**
15+
* Adds a topping to a pizza
16+
* <div><b>Example:</b> {@code pizza.addTopping(Topping.Spam)} </div>
17+
*
18+
* @param topping
19+
* A topping from the list
20+
*/
1021
public void addTopping(Topping topping)
1122
{
1223
this.toppings.add(topping);
1324
}
25+
/**
26+
* Checks to see if a pizza has a particular kind of topping
27+
* <div><b>Example:</b> {@code pizza.hasTopping(topping)}</div>
28+
*
29+
*/
1430
public boolean hasTopping(Topping topping)
1531
{
1632
for (Topping toppingToday : toppings)
@@ -19,17 +35,35 @@ public boolean hasTopping(Topping topping)
1935
}
2036
return false;
2137
}
38+
/**
39+
* Cooks a pizza
40+
* <div><b>Example:</b> {@code pizza.cook()}</div>
41+
*
42+
*/
2243
public void cook()
2344
{
2445
this.cooked = true;
2546
}
47+
/**
48+
* Checks whether a pizza was cooked
49+
* <div><b>Example:</b> {@code pizza.wasCooked()}</div>
50+
*
51+
* @return whether or not the pizza has been cooked already
52+
*/
2653
public boolean wasCooked()
2754
{
2855
return this.cooked;
2956
}
3057
public void ____()
3158
{
3259
}
60+
/**
61+
* Checks whether you can take a slice of pizza or not
62+
* <div><b>Example:</b> {@code pizza.takeSlice()}</div>
63+
*
64+
* @return whether or not the pizza has any more slices to take
65+
* If there are still slices, takes one slice
66+
*/
3367
public boolean takeSlice()
3468
{
3569
if (0 < this.slices)
@@ -39,6 +73,11 @@ public boolean takeSlice()
3973
}
4074
return false;
4175
}
76+
/**
77+
* Adds more slices to a pizza
78+
* <div><b>Example:</b> {@code pizza.superSizeIt()}</div>
79+
*
80+
*/
4281
public void superSizeIt()
4382
{
4483
this.slices = 8;

src/org/teachingextensions/logo/Tortoise.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ public static void setAngle(int angle)
244244
{
245245
turtle().setAngleInDegrees(angle);
246246
}
247+
/**
248+
* Moves the Tortoise to a particular spot on the canvas. <br/>
249+
* <div><b>Example:</b> {@code Tortoise.moveTo(100,200);}</div>
250+
*
251+
* @param x
252+
* the x position
253+
* @param y
254+
* the y position
255+
*/
247256
public static void moveTo(int x, int y)
248257
{
249258
turtle().moveTo(x, y);
@@ -253,13 +262,28 @@ public static TurtlePanel ___()
253262
return new TurtlePanel();
254263
}
255264
private Topping topping;
265+
/**
266+
* Checks if a tortoise can eat a slice of a pizza
267+
* <div><b>Example:</b> {@code tortoise.eatPizza(pizza)}</div>
268+
*
269+
* @param pizza
270+
* the pizza
271+
* @return whether or not there is pizza left to eat that a tortoise likes
272+
*/
256273
public boolean eatPizza(Pizza pizza)
257274
{
258275
if (!pizza.takeSlice()) { return false; }
259276
if (this.topping == null) { return true; }
260277
if (this.topping != Topping.Cheese) { return pizza.hasTopping(topping); }
261278
return pizza.wasCooked() && pizza.hasTopping(topping);
262279
}
280+
/**
281+
* Checks to see if a tortoise likes a particular kind of pizza topping
282+
* <div><b>Example:</b> {@code tortoise.likesTopping(topping)}</div>
283+
*
284+
* @param topping
285+
* the topping
286+
*/
263287
public void likesTopping(Topping topping)
264288
{
265289
this.topping = topping;

src/org/teachingextensions/logo/shapes/Circle.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
import org.teachingextensions.logo.Paintable;
1010
import org.teachingextensions.windows.ProgramWindow;
1111

12+
/**
13+
* <img src="http://www2.psd100.com/ppp/2013/11/2701/Blue-circle-1127210229.png" align="left" >
14+
* The Circle allows you to draw circles on the canvas
15+
*/
1216
public class Circle implements Paintable
1317
{
1418
private final int radius;
@@ -21,22 +25,54 @@ public Circle(int radius, Color color)
2125
this.radius = radius;
2226
this.mainColor = color;
2327
}
28+
/**
29+
* Sets the center the circle
30+
* <div><b>Example:</b> {@code circle.setCenter(8,10)}</div>
31+
*
32+
* @param x
33+
* The x value
34+
* @param y
35+
* The y value
36+
*/
2437
public void setCenter(int x, int y)
2538
{
2639
this.x = x;
2740
this.y = y;
2841
}
42+
/**
43+
* Adds a circle to the window
44+
* <div><b>Example:</b> {@code circle.addTo(panel)}</div>
45+
*
46+
* @param panel
47+
* the ProgramWindow or panel
48+
*/
2949
public void addTo(ProgramWindow panel)
3050
{
3151
panel.addPaintable(this);
3252
}
53+
/**
54+
* Paints a circle
55+
* <div><b>Example:</b> {@code circle.paint(g,caller)}</div>
56+
*
57+
* @param g
58+
* the graphics object
59+
* @param caller
60+
* the Program Window or panel
61+
*/
3362
@Override
3463
public void paint(Graphics2D g, JPanel caller)
3564
{
3665
Color color2 = Colors.getTransparentVersion(mainColor, percentTransparent);
3766
g.setColor(color2);
3867
g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
3968
}
69+
/**
70+
* Sets the transparency of the circle
71+
* <div><b>Example:</b> {@code circle.setTransparency(80)}</div>
72+
*
73+
* @param percentTransparent
74+
* The percentage of transparency of the circle
75+
*/
4076
public void setTransparency(int percentTransparent)
4177
{
4278
this.percentTransparent = percentTransparent;

src/org/teachingextensions/logo/shapes/Text.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
import org.teachingextensions.logo.Paintable;
99
import org.teachingextensions.logo.TurtlePanel;
1010

11+
/**
12+
* <img src="http://www.iconeasy.com/icon/thumbnails/System/BlankOn/Text%20Icon.jpg" align="left" >
13+
* The Text allows you to write text on the canvas
14+
*/
1115
public class Text implements Paintable
1216
{
1317
private final String string;
@@ -17,12 +21,28 @@ public Text(String string)
1721
{
1822
this.string = string;
1923
}
24+
/**
25+
* Sets text position
26+
* <div><b>Example:</b> {@code text.setTopLeft(x,y)}</div>
27+
*
28+
* @param x
29+
* the X position
30+
* @param
31+
* the Y position
32+
*/
2033
public Text setTopLeft(int x, int y)
2134
{
2235
this.x = x;
2336
this.y = y;
2437
return this;
2538
}
39+
/**
40+
* Adds text to the window
41+
* <div><b>Example:</b> {@code text.addTo(panel)}</div>
42+
*
43+
* @param panel
44+
* the ProgramWindow or panel
45+
*/
2646
public void addTo(TurtlePanel panel)
2747
{
2848
panel.addPaintable(this);

src/org/teachingkidsprogramming/section07events/DeepDive07Events.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class DeepDive07Events
2121
// Step 4: Consider at least one thing you just learned
2222
// Step 5: Advance to the next method
2323
// Do not change anything except the blank (___)
24-
//
24+
// HINT: If you are stuck, look at the JavaDoc
2525
@Test
2626
public void twoTortoises() throws Exception
2727
{

0 commit comments

Comments
 (0)