Class DrawableNode

java.lang.Object
  extended by DrawableNode
Direct Known Subclasses:
Branch, PictNode

public abstract class DrawableNode
extends Object

Stuff that all nodes and branches in the scene tree know.

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
DrawableNode()
          Constructor for DrawableNode just sets next to null
 
Method Summary
 void add(DrawableNode node)
          Add the input node after the last node in this list.
 void drawOn(Picture bg)
          Draw on the given picture
abstract  void drawWith(Turtle t)
          Use the given turtle to draw oneself
 DrawableNode getNext()
          Method to get the next node
 void insertAfter(DrawableNode node)
          Insert the input node after this node.
 DrawableNode last()
          Return the last element in the list
 void remove(DrawableNode node)
          Method to remove a node from the list, fixing links appropriately.
 void setNext(DrawableNode nextOne)
          Method to set the next node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawableNode

public DrawableNode()
Constructor for DrawableNode just sets next to null

Method Detail

setNext

public void setNext(DrawableNode nextOne)
Method to set the next node

Parameters:
nextOne - next node in list

getNext

public DrawableNode getNext()
Method to get the next node

Returns:
the next node

drawWith

public abstract void drawWith(Turtle t)
Use the given turtle to draw oneself

Parameters:
t - the Turtle to draw with

drawOn

public void drawOn(Picture bg)
Draw on the given picture

Parameters:
bg - the background picture to draw on

remove

public void remove(DrawableNode node)
Method to remove a node from the list, fixing links appropriately. You can't remove the current node from the head of the list.

Parameters:
node - the element to remove from list.

insertAfter

public void insertAfter(DrawableNode node)
Insert the input node after this node.

Parameters:
node - element to insert after this.

last

public DrawableNode last()
Return the last element in the list

Returns:
the last element in the list

add

public void add(DrawableNode node)
Add the input node after the last node in this list.

Parameters:
node - element to insert after this.