il.ac.tau.cs.software1.turtle
Class Turtle

java.lang.Object
|
+--il.ac.tau.cs.software1.turtle.Turtle

public class Turtle
extends java.lang.Object

A Turtle is a logo turtle that is used to draw. a turtle has a pen attached to a tail. If the tail is down the turtle draws as it moves on the plane.


Constructor Summary
Turtle()
          constructs a new turtle
 
Method Summary
 double getAngle()
          returns the direction which the turtle is facing
static int getDelay()
          return the delay the turtle
 double getX()
          returns the x coordinate of the turtle's location
 double getY()
          returns the y coordinate of the turtle's location
 void hide()
          hides this turtle
 void home()
          moves the turtle to it's initial location and orientation
 boolean isTailDown()
           
 boolean isVisible()
           
 void jumpTo(int newX, int newY)
          moves the turtle to the given x,y location without drawing a line from the current location
static void main(java.lang.String[] args)
           
 void moveBackward(double units)
          moves the turtle backwards by the given units.
 void moveForward(double units)
          moves the turtle forward by the given units.
 void setAngle(double angle)
          sets the angle of which the turtle is facing to the given angle
static void setDelay(int _delay)
          sets the delay of the turtle motion in miliseconds - default delay is 0
 void setVisible(boolean visible)
          sets the visibility of the turtle
 void show()
          shows this turtle
 void tailDown()
          sets the turtle tail down
 void tailUp()
          sets the turtle tail up
 void turnLeft(int degrees)
          turns the turtle left by the given degrees
 void turnRight(int degrees)
          turns the turtle right by the given degrees
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Turtle

public Turtle()
constructs a new turtle

Method Detail

home

public void home()
moves the turtle to it's initial location and orientation


jumpTo

public void jumpTo(int newX,
int newY)
moves the turtle to the given x,y location without drawing a line from the current location

Parameters:
newX -
newY -

moveForward

public void moveForward(double units)
moves the turtle forward by the given units. the turtles location is rounded to the nearest pixel (int) at the given distance from it's current location

Parameters:
units -

moveBackward

public void moveBackward(double units)
moves the turtle backwards by the given units. the turtles location is rounded to the nearest pixel (int) at the given distance from it's current location

Parameters:
units -

turnLeft

public void turnLeft(int degrees)
turns the turtle left by the given degrees

Parameters:
degrees -

turnRight

public void turnRight(int degrees)
turns the turtle right by the given degrees

Parameters:
degrees -

tailDown

public void tailDown()
sets the turtle tail down


tailUp

public void tailUp()
sets the turtle tail up


isTailDown

public boolean isTailDown()
Returns:
true iff the tail of the turtle is down

hide

public void hide()
hides this turtle


show

public void show()
shows this turtle


setVisible

public void setVisible(boolean visible)
sets the visibility of the turtle

Parameters:
visible -

isVisible

public boolean isVisible()
Returns:
true iff the turtle is visible

setAngle

public void setAngle(double angle)
sets the angle of which the turtle is facing to the given angle

Parameters:
angle -

getAngle

public double getAngle()
returns the direction which the turtle is facing

Returns:

getX

public double getX()
returns the x coordinate of the turtle's location

Returns:

getY

public double getY()
returns the y coordinate of the turtle's location

Returns:

setDelay

public static void setDelay(int _delay)
sets the delay of the turtle motion in miliseconds - default delay is 0

Parameters:
_delay -

getDelay

public static int getDelay()
return the delay the turtle

Returns:

main

public static void main(java.lang.String[] args)