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