Class SoundElement

java.lang.Object
  extended by SoundElement

public class SoundElement
extends Object

Sounds for a linked list

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
SoundElement(Sound aSound)
          Constructor sets next to null and references the input sound.
 
Method Summary
 void add(SoundElement node)
          Add the input node after the last node in this list.
 void blockingPlay()
          Play JUST me, blocked.
 Sound collect()
          Collect all the sounds from me on, recursively into one sound.
 SoundElement copyNode()
          copyNode returns a copy of this element
 SoundElement getNext()
          Method to get the next element
 Sound getSound()
          The method to get the sound
 void insertAfter(SoundElement node)
          Insert the input node after this node.
 SoundElement last()
          Return the last element in the list
static void main(String[] args)
           
 void playFromMeOn()
          Play the list of sound elements after me
 void playSound()
          Play JUST me, blocked.
 void remove(SoundElement node)
          Method to remove a node from the list, fixing links appropriately.
 void repeatNext(SoundElement nextOne, int count)
          Repeat the input phrase for the number of times specified.
 void replace(Sound oldSound, Sound newSound)
          Replace the one sound with the other sound in all the elements from me on.
 void setNext(SoundElement nextOne)
          Method to set the next element
 String toString()
          Provide a printable representation of me
 void weave(SoundElement nextOne, int count, int skipAmount)
          Weave the input song node count times every skipAmount nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SoundElement

public SoundElement(Sound aSound)
Constructor sets next to null and references the input sound.

Parameters:
aSound - the sound to use
Method Detail

getSound

public Sound getSound()
The method to get the sound

Returns:
the sound associated with this node

playSound

public void playSound()
Play JUST me, blocked.


blockingPlay

public void blockingPlay()
Play JUST me, blocked.


toString

public String toString()
Provide a printable representation of me

Overrides:
toString in class Object
Returns:
the information string

setNext

public void setNext(SoundElement nextOne)
Method to set the next element

Parameters:
nextOne - next element to add to the list

getNext

public SoundElement getNext()
Method to get the next element

Returns:
the next element in the list

playFromMeOn

public void playFromMeOn()
Play the list of sound elements after me


collect

public Sound collect()
Collect all the sounds from me on, recursively into one sound.

Returns:
the resulting sound

remove

public void remove(SoundElement 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(SoundElement node)
Insert the input node after this node.

Parameters:
node - the element to insert after this.

last

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

Returns:
the last element in the list

add

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

Parameters:
node - element to insert after this.

copyNode

public SoundElement copyNode()
copyNode returns a copy of this element

Returns:
another element with the same sound

repeatNext

public void repeatNext(SoundElement nextOne,
                       int count)
Repeat the input phrase for the number of times specified. It always appends to the current node and loses any next reference.

Parameters:
nextOne - the node to be copied in to list
count - the number of times to copy it in.

weave

public void weave(SoundElement nextOne,
                  int count,
                  int skipAmount)
Weave the input song node count times every skipAmount nodes

Parameters:
nextOne - node to be copied into the list
count - how many times to copy
skipAmount - how many nodes to skip per weave

replace

public void replace(Sound oldSound,
                    Sound newSound)
Replace the one sound with the other sound in all the elements from me on. Two sounds are equal if come from same filename

Parameters:
oldSound - sound to be replaced
newSound - sound to put in its place

main

public static void main(String[] args)