|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprovided.music.Note
public class Note
Basic class representing musical Notes.
Field Summary | |
---|---|
private int |
accidental
Accidental (normally in {-1, 0, +1}) |
private double |
duration
Duration |
private boolean |
isNatural
Flag to override key signature |
private char |
name
Note name: {A, B, C, D, E, F, G, Z} (Z = rest) |
private int |
octave
Octave value |
Constructor Summary | |
---|---|
Note(char name,
int octave,
int accidental,
double duration,
boolean isNatural)
Constructor for the class |
Method Summary | |
---|---|
java.lang.Object |
execute(IPhraseVisitor algo,
java.lang.Object... params)
Calls the "Note" case of the visitor. |
int |
getAccidental()
Accessor to get the value of the accidental |
double |
getDuration()
Accessor to get the note duraton |
boolean |
getIsNatural()
Accessor for isNatural flag |
char |
getName()
Accessor to get the name of the note |
int |
getOctave()
Accessor to get the octave |
void |
setAccidental(int accidental)
Accessor to set the accidental value |
void |
setDuration(double duration)
Accessor to set the note duration |
void |
setIsNatural(boolean isNatural)
Settor for isNatural flag. |
void |
setName(char name)
Accessor to set the name of the note |
void |
setOctave(int octave)
Accessor to set the octave of the note |
java.lang.String |
toString()
Returns a string representation of the Note |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private char name
private int octave
private int accidental
private double duration
private boolean isNatural
Constructor Detail |
---|
public Note(char name, int octave, int accidental, double duration, boolean isNatural)
name
- The name of the noteoctave
- The octave of the note w.r.t. middle C. Zero = same octave as middle C.accidental
- accidental setting sharp > 0, flat < 0duration
- duration of noteisNatural
- flag to override key signature. True if note should be natural, overriding key signature.Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object execute(IPhraseVisitor algo, java.lang.Object... params)
execute
in interface IPhrase
algo
- The visitor to executeparams
- The input parameters supplied to the algo when its appropriate case is called.
public void setName(char name)
name
- - the name to setpublic char getName()
public void setOctave(int octave)
octave
- - the octave to setpublic int getOctave()
public void setAccidental(int accidental)
accidental
- - the accidental to setpublic int getAccidental()
public void setDuration(double duration)
duration
- - the duration to setpublic double getDuration()
public boolean getIsNatural()
public void setIsNatural(boolean isNatural)
isNatural
- New isNatural setting
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |