/* * SoundNode is a class representing a drawn picture * node in a scene tree. **/ public class SoundNode extends CollectableNode { /** * The sound I'm associated with **/ Sound mySound; /* * Make me with this sound * @param sound the Sound I'm associated with **/ public SoundNode(Sound sound){ super(); // Call superclass constructor mySound = sound; } /** * Method to return a string with informaiton * about this node */ public String toString() { return "SoundNode (with sound: "+mySound+" and next: "+next; } /** * Collect all the sounds from me on, * recursively. **/ public Sound collect(){ if (this.getNext() == null) {return mySound;} else {return mySound.append(this.getNext().collect());} } /** * Collect and process after **/ public Sound collectAfter(){ if (this.getNext() == null) {return mySound;} else {return mySound.append(this.getNext().collectAfter());} } }