Package org.staccato
Class NoteSubparser
- java.lang.Object
-
- org.staccato.NoteSubparser
-
- All Implemented Interfaces:
ChordProvider
,NoteProvider
,Subparser
public class NoteSubparser extends java.lang.Object implements Subparser, NoteProvider, ChordProvider
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Method Detail
-
getInstance
public static NoteSubparser getInstance()
-
matches
public boolean matches(java.lang.String music)
Description copied from interface:Subparser
Indicates whether the subparser should be responsible for parsing the given music string.
-
getTokenType
public Token.TokenType getTokenType(java.lang.String tokenString)
Description copied from interface:Subparser
Asks the subparser to provide a TokenType for the given token.- Specified by:
getTokenType
in interfaceSubparser
- Parameters:
tokenString
- The Staccato token to map to a type
-
parse
public int parse(java.lang.String s, StaccatoParserContext context)
Description copied from interface:Subparser
Parses the given music string.
-
parseNoteElement
public int parseNoteElement(java.lang.String s, int index, org.staccato.NoteSubparser.NoteContext noteContext, StaccatoParserContext parserContext)
Parses a note element.- Parameters:
s
- the token that contains a note element- Throws:
JFugueException
- if there is a problem parsing the element
-
createNote
public Note createNote(java.lang.String noteString)
- Specified by:
createNote
in interfaceNoteProvider
-
getMiddleC
public Note getMiddleC()
- Specified by:
getMiddleC
in interfaceNoteProvider
-
getDurationForString
public double getDurationForString(java.lang.String s)
- Specified by:
getDurationForString
in interfaceNoteProvider
-
populateContext
public static void populateContext(StaccatoParserContext context)
-
createChord
public Chord createChord(java.lang.String chordString)
- Specified by:
createChord
in interfaceChordProvider
-
-