11package org .teachingextensions .logo ;
22
3+ import java .awt .Color ;
4+
35import org .teachingextensions .WindowUtils .TurtleWindow ;
46import org .teachingextensions .logo .Turtle .Animals ;
7+ import org .teachingextensions .logo .utils .TortoiseUtils ;
58import org .teachingextensions .logo .utils .ColorUtils .PenColors ;
69import org .teachingextensions .logo .utils .LineAndShapeUtils .Text ;
710import org .teachingextensions .logo .utils .PizzaUtils .Pizza ;
811import org .teachingextensions .logo .utils .PizzaUtils .Topping ;
9- import org .teachingextensions .logo .utils .TortoiseUtils ;
1012import org .teachingextensions .virtualproctor .VirtualProctor ;
1113
12- import java .awt .*;
13-
1414/**
1515 * <img src="https://lh5.googleusercontent.com/-B3Q59gpYW8o/T4tA2k_TYUI/AAAAAAAAAjo/WiqdoXjbkb0/s65/Tortoise.png" style="text-align: left" alt="A tortoise drawing a line" >
1616 * The Tortoise allows you to draw lines and shapes by moving it around on the window
1717 */
1818public class Tortoise
1919{
2020 private Topping topping ;
21-
2221 /**
2322 * Displays the Tortoise
2423 * <div><b>Example:</b> {@code Tortoise.show()} </div>
@@ -27,7 +26,6 @@ public static void show()
2726 {
2827 turtle ().show ();
2928 }
30-
3129 /**
3230 * Gets the speed that the tortoise moves
3331 * <div><b>Example:</b> {@code int speed = Tortoise.getSpeed(8);}</div>
@@ -38,7 +36,6 @@ public static int getSpeed()
3836 {
3937 return turtle ().getSpeed ();
4038 }
41-
4239 /**
4340 * Sets the speed the tortoise moves
4441 * <div><b>Example:</b> {@code Tortoise.setSpeed(8)}</div>
@@ -50,7 +47,6 @@ public static void setSpeed(int speed)
5047 {
5148 turtle ().setSpeed (speed );
5249 }
53-
5450 /**
5551 * Moves the Tortoise Forward the number of pixels specified. <br>
5652 * <div><b>Example:</b> {@code Tortoise.move(72)}</div>
@@ -75,7 +71,6 @@ public static void turn(Number degreesToTheRight)
7571 {
7672 turtle ().turn (degreesToTheRight .doubleValue ());
7773 }
78-
7974 /**
8075 * Gives you access to the window the
8176 * Tortoise is moving on so you can do things like change it's color. <br>
@@ -86,7 +81,6 @@ public static TurtleWindow getBackgroundWindow()
8681 {
8782 return turtle ().getBackgroundWindow ();
8883 }
89-
9084 /**
9185 * Gets the current width of the pen drawn by the Tortoise. <br>
9286 * <div><b>Example:</b> {@code width = Tortoise.getPenWidth()}</div>
@@ -97,7 +91,6 @@ public static int getPenWidth()
9791 {
9892 return turtle ().getPenWidth ();
9993 }
100-
10194 /**
10295 * Sets the width of the pen drawn by the Tortoise. <br>
10396 * <div><b>Example:</b> {@code Tortoise.setPenWidth(2)}</div>
@@ -109,7 +102,6 @@ public static void setPenWidth(Number width)
109102 {
110103 turtle ().setPenWidth (width .intValue ());
111104 }
112-
113105 /**
114106 * Gets the current color of the pen drawn by the Tortoise. <br>
115107 * <div><b>Example:</b> {@code pen = Tortoise.getPenColor()}</div>
@@ -120,20 +112,18 @@ public static Color getPenColor()
120112 {
121113 return turtle ().getPenColor ();
122114 }
123-
124115 /**
125- * Sets the color drawn by the Tortoise. <br>
116+ * Sets the color of the line drawn by the Tortoise. <br>
126117 * <div><b>Example:</b> {@code Tortoise.setPenColor(PenColors.Reds.Red)}</div>
127118 *
128119 * @param color
129- * the color of the pen
120+ * the color of the line drawn
130121 * @see PenColors
131122 */
132123 public static void setPenColor (Color color )
133124 {
134125 turtle ().setPenColor (color );
135126 }
136-
137127 /**
138128 * Gets the current position of the Tortoise on the y axis. <br>
139129 * (0,0) is the top left of the screen <br>
@@ -145,7 +135,6 @@ public static int getY()
145135 {
146136 return turtle ().getY ();
147137 }
148-
149138 /**
150139 * Sets the position of the Tortoise on the y axis. <br>
151140 * (0,0) is the top left of the screen <br>
@@ -158,7 +147,6 @@ public static void setY(int y)
158147 {
159148 turtle ().setY (y );
160149 }
161-
162150 /**
163151 * Gets the current position of the Tortoise on the x axis. <br>
164152 * (0,0) is the top left of the screen <br>
@@ -170,7 +158,6 @@ public static int getX()
170158 {
171159 return turtle ().getX ();
172160 }
173-
174161 /**
175162 * Sets the position of the Tortoise on the x axis. <br>
176163 * (0,0) is the top left of the screen <br>
@@ -183,7 +170,6 @@ public static void setX(int x)
183170 {
184171 turtle ().setX (x );
185172 }
186-
187173 /**
188174 * Gets the current heading of the Tortoise. <br>
189175 * 0 degrees is due north. <br>
@@ -196,7 +182,6 @@ public static double getAngle()
196182 {
197183 return turtle ().getAngleInDegrees ();
198184 }
199-
200185 /**
201186 * Sets the angle the Tortoise is facing. <br>
202187 * 0 is straight up (like 'North') <br>
@@ -209,7 +194,6 @@ public static void setAngle(int angle)
209194 {
210195 turtle ().setAngleInDegrees (angle );
211196 }
212-
213197 /**
214198 * Changes the type of animal you are using. <br>
215199 * <div><b>Example:</b> {@code Tortoise.setAnimal(Animals.Spider);}</div>
@@ -221,7 +205,6 @@ public static void setAnimal(Animals animal)
221205 {
222206 turtle ().setAnimal (animal );
223207 }
224-
225208 /**
226209 * Blows up your turtle! <br>
227210 * <div><b>Example:</b> {@code Tortoise.explode(Animals.ExplodedTurtle);}</div>
@@ -232,7 +215,6 @@ public static void explode()
232215 {
233216 turtle ().setAnimal (Animals .ExplodedTurtle );
234217 }
235-
236218 /**
237219 * Makes it so the tortoise will not draw a line of color out of its butt. <br>
238220 * <b>Example:</b> {@code Tortoise.penUp()}
@@ -241,7 +223,6 @@ public static void setPenUp()
241223 {
242224 turtle ().penUp ();
243225 }
244-
245226 /**
246227 * Makes it so a line of color out of will trail from the Tortoise. <br>
247228 * <b>Example:</b> {@code Tortoise.penDown()}
@@ -250,7 +231,6 @@ public static void setPenDown()
250231 {
251232 turtle ().penDown ();
252233 }
253-
254234 /**
255235 * Removes everything from the window. <br>
256236 * <b>Example:</b> {@code Tortoise.clearWindow()}
@@ -260,7 +240,6 @@ public static void clear()
260240 turtle ().clear ();
261241 turtle ().getBackgroundWindow ().setTurtle (turtle ());
262242 }
263-
264243 /**
265244 * Hides the tortoise, you will still see the pen markings it made before and after it's hidden. <br>
266245 * <b>Example:</b> {@code Tortoise.hide()}
@@ -269,12 +248,10 @@ public static void hide()
269248 {
270249 turtle ().hide ();
271250 }
272-
273251 private static Turtle turtle ()
274252 {
275253 return TortoiseUtils .getTurtle ();
276254 }
277-
278255 /**
279256 * Moves the Tortoise to a particular spot on the canvas. <br>
280257 * <div><b>Example:</b> {@code Tortoise.moveTo(100,200);}</div>
@@ -288,12 +265,10 @@ public static void moveTo(int x, int y)
288265 {
289266 turtle ().moveTo (x , y );
290267 }
291-
292268 public static TurtleWindow ___ ()
293269 {
294270 return new TurtleWindow ();
295271 }
296-
297272 /**
298273 * Makes a cool shape fast
299274 * <div><b>Example: </b> {@code tortoise.drawShape(6,PenColors.Reds.Red, 50, 20)}</div>
@@ -322,7 +297,6 @@ public static void drawShape(int sides, Color color, int length, int width)
322297 VirtualProctor .setClassName ("Grace Hopper's Class" );
323298 VirtualProctor .setName ("Jean Bartik" );
324299 }
325-
326300 /**
327301 * Draws an entire Tortoise -- fast!
328302 * <div><b>Example: </b> {@code tortoise.drawTortoise()}</div>
@@ -344,7 +318,6 @@ public static void drawTortoise()
344318 Tortoise .turn (-90 );
345319 Tortoise .makeTortoiseLeg ();
346320 }
347-
348321 private static void makeTortoiseLeg ()
349322 {
350323 for (int i = 0 ; i < 4 ; i ++)
@@ -353,7 +326,6 @@ private static void makeTortoiseLeg()
353326 Tortoise .turn (90 );
354327 }
355328 }
356-
357329 private static void makeTortoiseBody ()
358330 {
359331 Tortoise .turn (-90 );
@@ -375,13 +347,11 @@ private static void makeTortoiseBody()
375347 Tortoise .turn (-25 );
376348 Tortoise .move (65 );
377349 }
378-
379350 public static void setVisible (boolean b )
380351 {
381352 turtle ().setFrameVisible (b );
382353 turtle ().setPanelVisible (b );
383354 }
384-
385355 /**
386356 * Checks if a tortoise can eat a slice of a pizza
387357 * <div><b>Example:</b> {@code tortoise.eatPizza(pizza)}</div>
@@ -397,7 +367,6 @@ public boolean eatPizza(Pizza pizza)
397367 if (this .topping != Topping .Cheese ) { return pizza .hasTopping (topping ); }
398368 return pizza .wasCooked () && pizza .hasTopping (topping );
399369 }
400-
401370 /**
402371 * Checks to see if a tortoise likes a particular kind of pizza topping
403372 * <div><b>Example:</b> {@code tortoise.likesTopping(topping)}</div>
0 commit comments