Class MoveBranch

java.lang.Object
  extended by DrawableNode
      extended by Branch
          extended by MoveBranch

public class MoveBranch
extends Branch

Class that represents a change in location

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
MoveBranch(int x, int y)
          Construct a branch with children and next as null
 
Method Summary
 void drawWith(Turtle t)
          Set the location, then draw
 int getXPos()
          Method to get the x position
 int getYPos()
          Method to get the Y position
 void moveTo(int x, int y)
          Method to move to a new x and y
 String toString()
          Method to return a string with information about this branch
 
Methods inherited from class Branch
addChild, getFirstChild
 
Methods inherited from class DrawableNode
add, drawOn, getNext, insertAfter, last, remove, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MoveBranch

public MoveBranch(int x,
                  int y)
Construct a branch with children and next as null

Parameters:
x - the x position to use
y - the y position to use
Method Detail

getXPos

public int getXPos()
Method to get the x position

Returns:
the x position

getYPos

public int getYPos()
Method to get the Y position

Returns:
the y position

moveTo

public void moveTo(int x,
                   int y)
Method to move to a new x and y

Parameters:
x - the new x
y - the new y

toString

public String toString()
Method to return a string with information about this branch

Overrides:
toString in class Branch
Returns:
the information string

drawWith

public void drawWith(Turtle t)
Set the location, then draw

Overrides:
drawWith in class Branch
Parameters:
t - the Turtle to draw with