public class RunningOctaveCollector<P extends PitchModOctave & Comparable<P>> extends Object
For its definition/realization, it requires a notion of "nearest" pitch w.r.t a particular pitch of the predecessor and a particular pitchModOctave. The CWN convention, as implemened here, requires that there are "WhiteKeys" as the basis for notation, and "nearest" is defined on these.
The input grammar accepted by this pre-processor is
pitch ::= (octUp | octDown)? pitchModOctave | pitchModOctave octaveRegisterUsage: Create an instance, apply the
Translet.Parser
resturned by
parser()
, and finally call reify(MessageReceiver,Iterable,Map)
.Modifier and Type | Field and Description |
---|---|
protected Map<Event,OctaveRegister> |
explicitOcts
Intermediate store between parsing and reification: explicit changes of octave.
|
protected Map<Event,Integer> |
jumps
Intermediate store between parsing and reification: explicit additional octave jump.
|
(package private) String |
octDown
Construction parameter: inut string meaning "one octave lower than the min distance."
|
(package private) String |
octUp
Construction parameter: inut string meaning "one octave higher than the min distance."
|
(package private) Translet.Parser<OctaveRegister> |
parserOctaveRegister
Construction parameter: parser for an explicit octave register.
|
(package private) Translet.Parser<P> |
parserPitchClass
Construction parameter: parser for the pitch class.
|
protected Map<Event,P> |
pitches
Intermediate store between parsing and reification: pitches by events.
|
(package private) Function<P,WhiteKeyModOctave> |
stripAlterations
Function to get from the pitch type (which is a parameter) to a whitekey.
|
Constructor and Description |
---|
RunningOctaveCollector(Translet.Parser<P> parserPitchClass,
Translet.Parser<OctaveRegister> parserOctaveRegister,
String octDown,
String octUp,
Function<P,WhiteKeyModOctave> stripAlterations)
Only constructor, set all parameters.
|
Modifier and Type | Method and Description |
---|---|
Translet.Parser<?> |
parser()
Return the parser.
|
void |
reify(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
Iterable<Event> evs,
Map<Event,PitchAndOctave<OctaveRegister,P>> result)
Steps through the sequence of events "evs" and combines the already parsed
pitch and the (partial) "explicit octave" and "jump" information into the
combined data type, taking the "shortest notational distance" as a default.
|
final Translet.Parser<P extends PitchModOctave & Comparable<P>> parserPitchClass
final Translet.Parser<OctaveRegister> parserOctaveRegister
final String octUp
final String octDown
final Function<P extends PitchModOctave & Comparable<P>,WhiteKeyModOctave> stripAlterations
protected final Map<Event,P extends PitchModOctave & Comparable<P>> pitches
protected final Map<Event,OctaveRegister> explicitOcts
public RunningOctaveCollector(Translet.Parser<P> parserPitchClass, Translet.Parser<OctaveRegister> parserOctaveRegister, String octDown, String octUp, Function<P,WhiteKeyModOctave> stripAlterations)
public final Translet.Parser<?> parser()
reify(MessageReceiver,Iterable,Map)
public void reify(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Iterable<Event> evs, Map<Event,PitchAndOctave<OctaveRegister,P>> result)