Class SongNode

java.lang.Object
  extended by SongNode

public class SongNode
extends Object

Represents a node in a flexible song structure

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
SongNode()
          Construct a new song node.
 
Method Summary
 jm.music.data.Phrase collect()
          Collect all nodes in this SongPart and return the composite Phrase
 SongNode copyNode()
          copyNode returns a copy of this node
 SongNode getNext()
          Get the next song node
 void insertAfter(SongNode nextOne)
          Insert the input SongNode AFTER this node, and make whatever node comes NEXT become the next of the input node.
 void repeatNext(SongNode nextOne, int count)
          Repeat the input phrase for the number of times specified.
 void repeatNextInserting(SongNode nextOne, int count)
          Repeat the input phrase for the number of times specified.
 void setNext(SongNode nextOne)
          Creates a link between the current node and the input node
 void setPhrase(jm.music.data.Phrase thisPhrase)
          setPhrase takes a Phrase and makes it the one for this node
 void showFromMeOn(int instrument)
          Collect all the notes from this node on in an part (then a score) and open it up for viewing.
 void weave(SongNode 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, toString, wait, wait, wait
 

Constructor Detail

SongNode

public SongNode()
Construct a new song node. The next part is empty, and ours is a blank new part.

Method Detail

setPhrase

public void setPhrase(jm.music.data.Phrase thisPhrase)
setPhrase takes a Phrase and makes it the one for this node

Parameters:
thisPhrase - the phrase for this node

setNext

public void setNext(SongNode nextOne)
Creates a link between the current node and the input node

Parameters:
nextOne - the node to link to

copyNode

public SongNode copyNode()
copyNode returns a copy of this node

Returns:
another song node with the same notes

repeatNextInserting

public void repeatNextInserting(SongNode nextOne,
                                int count)
Repeat the input phrase for the number of times specified. But do an insertion, to save the rest of the list.

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

repeatNext

public void repeatNext(SongNode nextOne,
                       int count)
Repeat the input phrase for the number of times specified. It always inserts the repeated node after the current node

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

insertAfter

public void insertAfter(SongNode nextOne)
Insert the input SongNode AFTER this node, and make whatever node comes NEXT become the next of the input node.

Parameters:
nextOne - SongNode to insert after this one

weave

public void weave(SongNode 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

getNext

public SongNode getNext()
Get the next song node

Returns:
the next song node or null if none

showFromMeOn

public void showFromMeOn(int instrument)
Collect all the notes from this node on in an part (then a score) and open it up for viewing.

Parameters:
instrument - the MIDI instrument (program) to be used in playing

collect

public jm.music.data.Phrase collect()
Collect all nodes in this SongPart and return the composite Phrase

Returns:
the phrase with all the notes in it