Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Note(char name,
int octave,
int accidental,
double duration,
boolean isNatural)
Constructor for the class
|
Modifier and Type | Method and Description |
---|---|
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
|
private char name
private int octave
private int accidental
private double duration
private boolean isNatural
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.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object execute(IPhraseVisitor algo, java.lang.Object... params)
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