/* * PictNode is a class representing a drawn picture * node in a scene tree. **/ public class PictNode extends DrawableNode { /** * The picture I'm associated with **/ Picture myPict; /* * Make me with this picture * @param pict the Picture I'm associated with **/ public PictNode(Picture pict){ super(); // Call superclass constructor myPict = pict; } /** * Method to return a string with informaiton * about this node */ public String toString() { return "PictNode (with picture: "+myPict+" and next: "+next; } /* * Use the given turtle to draw oneself * @param pen the Turtle to draw with **/ public void drawWith(Turtle pen){ pen.drop(myPict); } /** * Methods to set and get next elements * @param nextOne next element in list **/ public void setNextNode(PictNode nextOne){ this.next = nextOne; } /** * Gets value of next node * @return next node */ public PictNode getNextNode(){ return (PictNode) this.next; } /** * Returns a clone (shallow copy) of this PictNode */ public PictNode makeClone() { PictNode clone = new PictNode(getMyPict()); clone.setNextNode(this.getNextNode()); return clone; } /** * @return The Picture associated with this node */ public Picture getMyPict() { return myPict; } /** * @param p new picture to use */ public void setMyPict(Picture p) { myPict = p; } }