Class Branch

java.lang.Object
  extended by DrawableNode
      extended by Branch
Direct Known Subclasses:
HBranch, MoveBranch, VBranch

public class Branch
extends DrawableNode

A branch of a tree that can have children

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
Branch()
          Construct a branch with the first child and next as null
 
Method Summary
 void addChild(DrawableNode child)
          Method to add a child node
 void drawWith(Turtle turtle)
          Ask all our children to draw, then let next draw.
 DrawableNode getFirstChild()
          Method to get the first child in the branch
 String toString()
          Method to return a string with information about this branch
 
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

Branch

public Branch()
Construct a branch with the first child and next as null

Method Detail

getFirstChild

public DrawableNode getFirstChild()
Method to get the first child in the branch

Returns:
the first child in the list

toString

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

Overrides:
toString in class Object

addChild

public void addChild(DrawableNode child)
Method to add a child node

Parameters:
the - child to add

drawWith

public void drawWith(Turtle turtle)
Ask all our children to draw, then let next draw.

Specified by:
drawWith in class DrawableNode
Parameters:
turtle - the Turtle to draw with