Class SoundBranch

java.lang.Object
  extended by CollectableNode
      extended by SoundBranch
Direct Known Subclasses:
ScaleBranch

public class SoundBranch
extends CollectableNode

Class that represents a branch in a tree of sounds

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
SoundBranch()
          Construct a branch with the first child and next as null
 
Method Summary
 void addChild(CollectableNode child)
          Method to add a node to the end of the children list
 Sound collect()
          Collect all the sound from our firstChild, then collect from next.
 Sound collectAfter()
          Collect all the sound from our firstChild, then collect from next.
 Sound collectSwap()
          Collect all the sound from our firstChild, then collect from next.
 CollectableNode getFirstChild()
          Method to return the first child
 String toString()
          Method to return a string with information about this branch
 
Methods inherited from class CollectableNode
add, getNext, insertAfter, last, playFromMeOn, remove, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SoundBranch

public SoundBranch()
Construct a branch with the first child and next as null

Method Detail

getFirstChild

public CollectableNode getFirstChild()
Method to return the first child

Returns:
the first child

toString

public String toString()
Method to return a string with information about this branch

Overrides:
toString in class Object
Returns:
the information string

addChild

public void addChild(CollectableNode child)
Method to add a node to the end of the children list

Parameters:
child - the child to add

collect

public Sound collect()
Collect all the sound from our firstChild, then collect from next.

Specified by:
collect in class CollectableNode
Returns:
the combined sound

collectAfter

public Sound collectAfter()
Collect all the sound from our firstChild, then collect from next. If there's processing, do to Next, not to Children

Specified by:
collectAfter in class CollectableNode
Returns:
the collected sound

collectSwap

public Sound collectSwap()
Collect all the sound from our firstChild, then collect from next. But return next BEFORE firstChild

Returns:
the collected sound