Class SceneElement

java.lang.Object
  extended bySceneElement
Direct Known Subclasses:
SceneElementLayered, SceneElementPositioned

public abstract class SceneElement
extends Object

An element that knows how to draw itself in a scene with a turtle


Field Summary
protected  Picture myPic
          the picture that this element holds
protected  SceneElement next
          the next element in the list -- any SceneElement
 
Constructor Summary
SceneElement()
           
 
Method Summary
 void add(SceneElement node)
          Add the input node after the last node in this list.
 void drawFromMeOn(Picture bg)
          Method to draw from this node on in the list.
abstract  void drawWith(Turtle t)
           
 SceneElement getNext()
           
 Picture getPicture()
          Returns the picture in the node.
 void insertAfter(SceneElement node)
          Insert the input node after this node.
 SceneElement last()
          Return the last element in the list
 void remove(SceneElement node)
          Method to remove node from list, fixing links appropriately.
 SceneElement reverse()
          Reverse the list starting at this, and return the last element of the list.
 void setNext(SceneElement nextOne)
          Methods to set and get next elements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPic

protected Picture myPic
the picture that this element holds


next

protected SceneElement next
the next element in the list -- any SceneElement

Constructor Detail

SceneElement

public SceneElement()
Method Detail

setNext

public void setNext(SceneElement nextOne)
Methods to set and get next elements

Parameters:
nextOne - next element in list

getNext

public SceneElement getNext()

getPicture

public Picture getPicture()
Returns the picture in the node.

Returns:
the picture in the node

drawFromMeOn

public void drawFromMeOn(Picture bg)
Method to draw from this node on in the list. For positioned elements, compute locations. Each new element has it's lower-left corner at the lower-right of the previous node. Starts drawing from left-bottom

Parameters:
bg - Picture to draw drawing on

drawWith

public abstract void drawWith(Turtle t)

remove

public void remove(SceneElement node)
Method to remove node from list, fixing links appropriately.

Parameters:
node - element to remove from list.

insertAfter

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

Parameters:
node - element to insert after this.

last

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


reverse

public SceneElement reverse()
Reverse the list starting at this, and return the last element of the list. The last element becomes the FIRST element of the list, and THIS goes to null.


add

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

Parameters:
node - element to insert after this.