Class AmazingGraceSongElement2

java.lang.Object
  extended by AmazingGraceSongElement2

public class AmazingGraceSongElement2
extends Object

Class that represents elements of the song amazing grace version 2

Author:
Mark Guzdial, Barb Ericson

Constructor Summary
AmazingGraceSongElement2()
          When we make a new element, the next part is empty, and ours is a blank new part
 
Method Summary
 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.
 AmazingGraceSongElement2 getNext()
          Method to get the next element
 jm.music.data.Part part()
          We could just access myPart directly but we can CONTROL access by using a method (called an accessor)
 jm.music.data.Phrase phrase1()
          method that returns the first phrase of Amazing Grace
 jm.music.data.Phrase phrase2()
          method that returns phrase 2
 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(AmazingGraceSongElement2 nextOne)
          Method to set the next element
 void setPhrase(jm.music.data.Phrase myPhrase, double startTime, int instrument)
          setPhrase takes a phrase and makes it the one for this element at the desired start time with the given instrument
 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

AmazingGraceSongElement2

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

Method Detail

setPhrase

public void setPhrase(jm.music.data.Phrase myPhrase,
                      double startTime,
                      int instrument)
setPhrase takes a phrase and makes it the one for this element at the desired start time with the given instrument

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

phrase1

public jm.music.data.Phrase phrase1()
method that returns the first phrase of Amazing Grace

Returns:
phrase1

phrase2

public jm.music.data.Phrase phrase2()
method that returns phrase 2

Returns:
phrase 2

setNext

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

Parameters:
nextOne - the next element

getNext

public AmazingGraceSongElement2 getNext()
Method to get the next element

Returns:
the next element

part

public jm.music.data.Part part()
We could just access myPart directly but we can CONTROL access by using a method (called an accessor)

Returns:
the part

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

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.

Parameters:
the - channel to use

showFromMeOn

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