Class AmazingGraceSongElement

java.lang.Object
  extended by AmazingGraceSongElement

public class AmazingGraceSongElement
extends Object

Class that represents elements of the song amazing grace

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
AmazingGraceSongElement()
          When we make a new element, the next part is empty, and ours is a blank new part
 
Method Summary
 void addPhrase1(double startTime, int instrument)
          addPhrase1 puts the first part of AmazingGrace into our part of the song at the desired start time with the given instrument
 void addPhrase2(double startTime, int instrument)
          Add the second phrase
 double getEndTime()
          Why do we need this? If we want one piece to start after another, we need to know when the last one ends.
 AmazingGraceSongElement getNext()
          Method to get the next element
 jm.music.data.Part getPart()
          We could just access myPart directly but we can CONTROL access by using a method We'll use it in showFromMeOn
 jm.music.data.Part part()
          We could just access myPart directly but we can CONTROL access by using a method We'll use it in showFromMeOn
 void setChannel(int channel)
          We need setChannel because each part has to be in its own channel if it has different start times.
 void setNext(AmazingGraceSongElement nextOne)
          Set the next element
 void showFromMeOn()
          Method to show from this element on
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AmazingGraceSongElement

public AmazingGraceSongElement()
When we make a new element, the next part is empty, and ours is a blank new part

Method Detail

addPhrase1

public void addPhrase1(double startTime,
                       int instrument)
addPhrase1 puts the first part of AmazingGrace into our part of the song at the desired start time with the given instrument

Parameters:
startTime - the time to start playing this element
instrument - the instrument to use

addPhrase2

public void addPhrase2(double startTime,
                       int instrument)
Add the second phrase

Parameters:
startTime - the time to start
instrument - the instrument to use

setNext

public void setNext(AmazingGraceSongElement nextOne)
Set the next element

Parameters:
nextOne - the one to use as the next

getNext

public AmazingGraceSongElement getNext()
Method to get the next element

Returns:
the next element

getPart

public jm.music.data.Part getPart()
We could just access myPart directly but we can CONTROL access by using a method We'll use it in showFromMeOn

Returns:
the part for this element

part

public jm.music.data.Part part()
We could just access myPart directly but we can CONTROL access by using a method We'll use it in showFromMeOn

Returns:
the part for this element

getEndTime

public double getEndTime()
Why do we need this? If we want one piece to start after another, we need to know when the last one ends. Notice: It's the phrase that knows the end time. We have to ask the part for its phrase (assuming only one) to get the end time.

Returns:
the end time of this element

setChannel

public void setChannel(int channel)
We need setChannel because each part has to be in its own channel if it has different start times. So, we'll set the channel when we assemble the score. (But if we only need it for showFromMeOn, we could make it PRIVATE...)

Parameters:
channel - the channel to use

showFromMeOn

public void showFromMeOn()
Method to show from this element on