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 ChordcreateChord(java.lang.String chordString)NotecreateNote(java.lang.String noteString)doublegetDurationForString(java.lang.String s)static NoteSubparsergetInstance()NotegetMiddleC()Token.TokenTypegetTokenType(java.lang.String tokenString)Asks the subparser to provide a TokenType for the given token.booleanmatches(java.lang.String music)Indicates whether the subparser should be responsible for parsing the given music string.intparse(java.lang.String s, StaccatoParserContext context)Parses the given music string.intparseNoteElement(java.lang.String s, int index, org.staccato.NoteSubparser.NoteContext noteContext, StaccatoParserContext parserContext)Parses a note element.static voidpopulateContext(StaccatoParserContext context)
-
-
-
Method Detail
-
getInstance
public static NoteSubparser getInstance()
-
matches
public boolean matches(java.lang.String music)
Description copied from interface:SubparserIndicates 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:SubparserAsks the subparser to provide a TokenType for the given token.- Specified by:
getTokenTypein 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:SubparserParses 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:
createNotein interfaceNoteProvider
-
getMiddleC
public Note getMiddleC()
- Specified by:
getMiddleCin interfaceNoteProvider
-
getDurationForString
public double getDurationForString(java.lang.String s)
- Specified by:
getDurationForStringin interfaceNoteProvider
-
populateContext
public static void populateContext(StaccatoParserContext context)
-
createChord
public Chord createChord(java.lang.String chordString)
- Specified by:
createChordin interfaceChordProvider
-
-