tortues
Class Tortoise

java.lang.Object
  extended by tortues.Tortoise

public class Tortoise
extends java.lang.Object

Franklin is a Tortoise   * @author Julien VAUBOURG   * @version 0.2 (2010-10-12)


Constructor Summary
protected Tortoise()
          Constructor
 
Method Summary
protected  int backward(int steps, java.awt.Dimension vivariumSize)
          Backward the turtle according to its orientation
protected  void backwardTorique(java.awt.Dimension vivariumSize)
          If the turtle is on a border and that it must backward, this function can to cross it across the torique plan
protected  int forward(int steps, java.awt.Dimension vivariumSize)
          Forward the turtle according to its orientation
protected  void forwardTorique(java.awt.Dimension vivariumSize)
          If the turtle is on a border and that it must forward, this function can to cross it across the torique plan
protected  java.awt.Point getCoord()
          Returns the current turtle position
protected  int getOrientation()
          Returns the current turtle orientation
protected  void go2(java.awt.Point p)
          Put the turtle to a specified position
protected  boolean isInDrawMode()
          Is pen down ?
protected  void origin()
          Put on the original position
protected  void penDown()
          Switch draw mode to On
protected  void penUp()
          Switch draw mode to Off
protected  void turnLeft(int deg)
          Change the orientation of the turtle of -x degrees
protected  void turnRight(int deg)
          Change the orientation of the turtle of x degrees
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tortoise

protected Tortoise()
Constructor

Method Detail

origin

protected void origin()
Put on the original position


getCoord

protected java.awt.Point getCoord()
Returns the current turtle position

Returns:
Turtle position

getOrientation

protected int getOrientation()
Returns the current turtle orientation

Returns:
Turtle orientation

isInDrawMode

protected boolean isInDrawMode()
Is pen down ?

Returns:
Pen state

turnLeft

protected void turnLeft(int deg)
Change the orientation of the turtle of -x degrees

Parameters:
deg - Degrees to rotate

turnRight

protected void turnRight(int deg)
Change the orientation of the turtle of x degrees

Parameters:
deg - Degrees to rotate

penDown

protected void penDown()
Switch draw mode to On


penUp

protected void penUp()
Switch draw mode to Off


forward

protected int forward(int steps,
                      java.awt.Dimension vivariumSize)
Forward the turtle according to its orientation

Parameters:
steps - Number of pixel to move
vivariumSize - Vivarium's size
Returns:
Pixels left to forward (positive if the turtle has striked a border)

backward

protected int backward(int steps,
                       java.awt.Dimension vivariumSize)
Backward the turtle according to its orientation

Parameters:
steps - Number of pixel to move
vivariumSize - Vivarium's size
Returns:
Pixels left to backward (positive if the turtle has striked a border)

go2

protected void go2(java.awt.Point p)
Put the turtle to a specified position

Parameters:
p - Go to p

forwardTorique

protected void forwardTorique(java.awt.Dimension vivariumSize)
If the turtle is on a border and that it must forward, this function can to cross it across the torique plan

Parameters:
vivariumSize - Vivarium's size

backwardTorique

protected void backwardTorique(java.awt.Dimension vivariumSize)
If the turtle is on a border and that it must backward, this function can to cross it across the torique plan

Parameters:
vivariumSize - Vivarium's size