public class NoteSubparser extends java.lang.Object implements Subparser, NoteProvider, ChordProvider
Modifier and Type | Method and Description |
---|---|
Chord |
createChord(java.lang.String chordString) |
Note |
createNote(java.lang.String noteString) |
double |
getDurationForString(java.lang.String s) |
static NoteSubparser |
getInstance() |
Note |
getMiddleC() |
Token.TokenType |
getTokenType(java.lang.String tokenString)
Asks the subparser to provide a TokenType for the given token.
|
boolean |
matches(java.lang.String music)
Indicates whether the subparser should be responsible for parsing the given music string.
|
int |
parse(java.lang.String s,
StaccatoParserContext context)
Parses the given music string.
|
int |
parseNoteElement(java.lang.String s,
int index,
org.staccato.NoteSubparser.NoteContext noteContext,
StaccatoParserContext parserContext)
Parses a note element.
|
static void |
populateContext(StaccatoParserContext context) |
public static NoteSubparser getInstance()
public boolean matches(java.lang.String music)
Subparser
public Token.TokenType getTokenType(java.lang.String tokenString)
Subparser
getTokenType
in interface Subparser
tokenString
- The Staccato token to map to a typepublic int parse(java.lang.String s, StaccatoParserContext context)
Subparser
public int parseNoteElement(java.lang.String s, int index, org.staccato.NoteSubparser.NoteContext noteContext, StaccatoParserContext parserContext)
s
- the token that contains a note elementJFugueException
- if there is a problem parsing the elementpublic Note createNote(java.lang.String noteString)
createNote
in interface NoteProvider
public Note getMiddleC()
getMiddleC
in interface NoteProvider
public double getDurationForString(java.lang.String s)
getDurationForString
in interface NoteProvider
public static void populateContext(StaccatoParserContext context)
public Chord createChord(java.lang.String chordString)
createChord
in interface ChordProvider