public class SignatureSubparser extends java.lang.Object implements Subparser, KeyProvider
| Modifier and Type | Field and Description |
|---|---|
static char |
FLAT_CHAR |
static java.lang.String |
KEY_SIGNATURE |
static int |
KEYSIG_MIDPOINT |
static java.lang.String |
MAJOR_ABBR |
static java.lang.String[] |
MAJOR_KEY_SIGNATURES |
static java.lang.String |
MINOR_ABBR |
static java.lang.String[] |
MINOR_KEY_SIGNATURES |
static java.lang.String |
SEPARATOR |
static char |
SHARP_CHAR |
static java.lang.String |
TIME_SIGNATURE |
| Constructor and Description |
|---|
SignatureSubparser() |
| Modifier and Type | Method and Description |
|---|---|
byte |
convertAccidentalCountToKeyRootPositionInOctave(int accidentalCount,
byte scale)
Turns number of accidentals (negative for flats, positive for sharps) to a key and returns the key's root note's position in the octave
|
byte |
convertKeyToByte(Key key)
Converts the given Key to a byte value, from -7 for Cb major or Ab major to +7 for C# minor or A# minor, with 0 being C major or A minor
|
Key |
createKey(java.lang.String keySignature)
Given a key signature, like "Cmaj" or "Kbbbb", return the corresponding Key
|
Key |
createKeyFromAccidentals(java.lang.String keySignature)
Returns a Key given a string containing as many flats or sharps as the number one would see on a staff for the corresponding key; e.g., "Kbbbb" = Ab Major
|
java.lang.String |
createKeyString(byte notePositionInOctave,
byte scale)
Creates a key name, like Cmaj, given the root note's position in an octave (e.g., 0 for C) and a major or minor indicator - @see Scale MAJOR_SCALE_INDICATOR and MINOR_SCALE_INDICATOR
|
static SignatureSubparser |
getInstance() |
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.
|
boolean |
matchesKeySignature(java.lang.String music) |
boolean |
matchesTimeSignature(java.lang.String music) |
int |
parse(java.lang.String music,
StaccatoParserContext context)
Parses the given music string.
|
public static final java.lang.String KEY_SIGNATURE
public static final java.lang.String TIME_SIGNATURE
public static final java.lang.String SEPARATOR
public static final java.lang.String[] MAJOR_KEY_SIGNATURES
public static final java.lang.String[] MINOR_KEY_SIGNATURES
public static final int KEYSIG_MIDPOINT
public static final java.lang.String MAJOR_ABBR
public static final java.lang.String MINOR_ABBR
public static final char SHARP_CHAR
public static final char FLAT_CHAR
public static SignatureSubparser getInstance()
public boolean matches(java.lang.String music)
Subparserpublic boolean matchesKeySignature(java.lang.String music)
public boolean matchesTimeSignature(java.lang.String music)
public Token.TokenType getTokenType(java.lang.String tokenString)
SubparsergetTokenType in interface SubparsertokenString - The Staccato token to map to a typepublic int parse(java.lang.String music,
StaccatoParserContext context)
Subparserpublic Key createKey(java.lang.String keySignature)
KeyProvidercreateKey in interface KeyProviderpublic Key createKeyFromAccidentals(java.lang.String keySignature)
public java.lang.String createKeyString(byte notePositionInOctave,
byte scale)
KeyProvidercreateKeyString in interface KeyProviderpublic byte convertAccidentalCountToKeyRootPositionInOctave(int accidentalCount,
byte scale)
KeyProviderconvertAccidentalCountToKeyRootPositionInOctave in interface KeyProviderpublic byte convertKeyToByte(Key key)
KeyProviderconvertKeyToByte in interface KeyProvider