public class ABCParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ABCTokenizer |
abcT
ABCTokenizer to use.
|
private java.util.Set<Note> |
accidentalNotes
Set of accidental notes in the current measure.
|
private DecoratorSeqList |
beginningTarget
Proxy to that is used to reference the beginning of the phrase before it
has finished being calculated.
|
private ATokVisitor |
checkNextNoteAlgo
Checks for dotted notes.
|
private double |
dottedCorrection
The amount to additively correct the duration by due to dotted notes;
|
(package private) double |
grace_multiplier
Grace note duration multiplier.
|
(package private) double |
graceDuration
Total grace note duration of previous grace notes
|
private boolean |
isGrace
Current notes to be parsed are grace notes
|
private java.util.Stack<DecoratorSeqList> |
jumpSecondRepeatStack
Stack that holds the proxies to the current second repeat start location.
|
private java.util.Stack<DecoratorSeqList> |
jumpTargetStack
A stack that hold the latest jump targets (repeat start) for repeats.
|
private ATokVisitor |
makeSeqListAlgo
Main algo used to create a list of IPhrases from the stream of tokens that represents the progression of the song (phrase).
|
Constructor and Description |
---|
ABCParser(java.lang.String inputFileName)
Constructs a parser for the given ABC input file.
|
Modifier and Type | Method and Description |
---|---|
private void |
addAccidental(Note note)
Adds a note to the set of accidentals replaces any note with the same
name and octave.
|
private void |
checkAccidentals(Note note)
Checks to see if the given Note is in the set of accidentals Checks name
and octave but not duration or accidental
|
private Note |
makeNote(Token host)
Parse a Note from the given Token
|
IPhrase |
parse()
Run the parser and parse the entire file, returning an IPhrase object that represents the entire piece of music.
|
private DecoratorSeqList |
popJumpTarget()
Pull off the current jump target from the jump target stack.
|
private void |
pushJumpTarget(DecoratorSeqList target)
Push the given jump target onto the stack so that it is now the current
jump target.
|
private void |
removeAccidental(Note note)
Removes a note from the set of accidentals Removes any note with the same
name and octave.
|
private Token |
swapToken(Token t)
Swap the given token for the next token in the tokenizer, returning the
next token.
|
private ABCTokenizer abcT
private DecoratorSeqList beginningTarget
private java.util.Stack<DecoratorSeqList> jumpTargetStack
private java.util.Stack<DecoratorSeqList> jumpSecondRepeatStack
private ATokVisitor makeSeqListAlgo
private boolean isGrace
double grace_multiplier
double graceDuration
private double dottedCorrection
private ATokVisitor checkNextNoteAlgo
private java.util.Set<Note> accidentalNotes
public ABCParser(java.lang.String inputFileName)
inputFileName
- the name of the input text fileprivate DecoratorSeqList popJumpTarget()
private void pushJumpTarget(DecoratorSeqList target)
target
- The new current jump target.public IPhrase parse()
private Note makeNote(Token host)
host
- The Note tokenprivate void checkAccidentals(Note note)
note
- The note to checkprivate void addAccidental(Note note)
note
- the Note to add.private void removeAccidental(Note note)
note
- the note to removeprivate Token swapToken(Token t)
t
- The token to be swapped into the tokenizer