public class TendencyCollector<E extends Entity> extends Object
Event
.
reify(MessageReceiver, Iterable,Map, Map, Map, Map, Map, Map, Map, Map)
(specifiying a sequence of Event
s
and all maps where to store the results.
Entity
") like brightness, voltage, etc.
The entity and its parser, given as attribute to this class, can appear
in tendency contexts, spanning the process between two(2) values over a non-empty
sequence of events, and in singleton mode, i.e. only one(1) value related to
only one(1) event (and mostly inherited by the successor events).
Tendency Context
Each tendency, as constructed by this algorithm, is contained in one(1) particular parameter track, and is defined atop of one(1) particular domain. For the values of this domain a lexical representation must exist which is non-ambigue in the parsing context. This context is built by the configuration of the dedicated input symbols mentioned in the following parsing rules.
Each recognized tendency, which correspond to exactly one(1) appearance
of a tendency symbol in the source text, one(1) instance of EventSet
is constructed. All information (contained events, kind and number,
start and end value, start and end text) is collected into fields of this instance,
or into maps indexed by this instance.
The startpoint of each tendency group is denotated by
<
and >
.
A sensible alternative, e.g. in a more technical type of notation,
could be /
and \
or ^
and v
.
>"cresc. sempre"
" is not detected automatically on this level of
processing and may lead to severe confusion!
The tendency extends up to its end point symbol. This is given by
!
").
lastEventIncluded
.
(Please not that the meaning, whether the process ends at the beginning or the end
of that event's sounding duration is independent, and
decided in later processing steps.)
Combination works as... ..singleton | ..tendency start | | ..end | | | Event[n] Event[n+1] [n+2] Event[n+k] | | | 1 2 4 8 | | | (^binary encoding) | | | (example:) 0 I E 1 p (p p ) ! (inherit) S E 2 < ----------------------------- !/f create tendency Group S E 3 p < ----------------------------- !/f create tendency Group 4 f (parsed as 1) 5 p f (NOT ALLOWED) I (e) 6 < f (f f ) ! (inherit) I (e) 7 p < f (f f ) ! (inherit) E 8 ! (sensible only as END OF TENDENCY) I E 9 p ! (no inheritance, no process) I E 10 < ! (create singleton tendency) I E 11 p < ! (create singleton tendency) 12 f ! (parsed as 9) 13 p f ! (NOT ALLOWED) I E 14 < f ! (create singleton tendency) I E 15 p < f ! (create singleton tendency)
So if the last syntactic element is (1) an entity value, then inheritance is started, if it is (2) a tendency sign, a tendency EventSet is started. The parser grammar could be described by
tendency ::= domainValue? tendencySymbol domainValue? endSymbol? number? additionalText?
Singleton Usage
Beside the apperance in a tendency, as described above, the source text of a domain value can appear in a stand-alone syntax, without tendency symbol.
Multimap
s Event <-> D called
singleton_explicit
and singleton_inherited
.
This is realized by a parser accepting ...
singleton ::= domainValue endSymbol? number? additionalText?
Remark 1
Currently we support the groups numbers "0" to "9", while "no number" defaults to "0"
Remark 2
According to the general tscore discipline, all components belonging to the same event must be written without intervening blanks.
c cis d dis e % p<1"molto">2 >2 >2 >2 ff1>2 !2
Remark 3
In the context of music, the predominant application will be with loudness/intensity. But in modern music there will be other applications, e.g. between articulations:
c cis d dis e f g h v< .-< -< ( "Tonform jedesmal verlängern"
Remark 4
In classical notation dim/cresc annotations are only for one single (instrumental) voice. But in contemporary notations it may be notated in some over-all directives' (pseudo) voice, and valid for (a subset of) an ensemble:
dim sempre >-----------------------------> Instr a x x Instr b o o Instr c o x x oTo use this algorithm with such a data structure, the events must in a preparatory step be collected into a pseudo (possibly overlapping, non-monodic) "sum"-voice, i.e. List of Events.
Modifier and Type | Class and Description |
---|---|
protected class |
TendencyCollector.TendencyCtrl
Intermediate storage, one instance for each tendency control command
attached to an event.
|
Modifier and Type | Field and Description |
---|---|
(package private) Translet.Parser<String> |
additionalTextParser
Parser for the additional text.
|
static String |
default_endSymbol
The default end sign.
|
(package private) static String[] |
default_tendencySymolbs
The default signs for increase and decrease.
|
(package private) Translet.Parser<E> |
domainParser
Parser for the parameter values.
|
(package private) String |
endSymbol
The symbol for "end of tendency", set on construction.
|
(package private) boolean |
lastEventIncluded
Whether the last event is included in the event set built for a tendency.
|
protected Function6<E,String,E,Boolean,Integer,String,TendencyCollector.TendencyCtrl> |
packTendencyCtrl |
(package private) E[] |
runningFlats
Running/inherited simple parameter values, when visiting the analysed events in
source order.
|
(package private) EventSet[] |
runningTendencies
Set of all currently collecting tendencies, when visiting the analysed events in
source order.
|
(package private) boolean |
singletonTendencyAllowed
Whether a tendency (created by attaching a tendency symbol to an event) may
be terminated immediately, by an
endSymbol or a parameter value at the
very same event. |
(package private) Multimap<Event,TendencyCollector.TendencyCtrl> |
tendencyCtrls
Intermediate storage for the tendency information, by events.
|
(package private) String[] |
tendencySymbols
The symbols for increase and decrease, set on construction.
|
Constructor and Description |
---|
TendencyCollector(String[] tendencySymbols,
String endSymbol,
Translet.Parser<E> domainParser,
Translet.Parser<String> additionalTextParser,
boolean lastEventIncluded,
boolean singletonTendencyAllowed)
Only constructor.
|
Modifier and Type | Method and Description |
---|---|
Translet.Parser<?> |
getParser()
Returns the parser which realizes the combination of parameters set when
constructing this instance.
|
void |
reify(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
Iterable<Event> evs,
Map<String,EventSet> tendencies,
Map<EventSet,E> startValues,
Map<EventSet,E> endValues,
Map<EventSet,String> startTexts,
Map<EventSet,String> endTexts,
Map<Event,E> singleton_explict,
Map<Event,E> singleton_inherited,
Map<Event,String> singleton_text)
Analyses the parameter text of the events by visiting them in the given order.
|
protected boolean |
startsTendency(TendencyCollector.TendencyCtrl tc)
Whether this intermediate object carries a tendency symbol.
|
final String[] tendencySymbols
final String endSymbol
final Translet.Parser<E extends Entity> domainParser
final Translet.Parser<String> additionalTextParser
final boolean lastEventIncluded
final boolean singletonTendencyAllowed
endSymbol
or a parameter value at the
very same event. If this value is false, the parser will simply reject
the corresponding input combinations.static final String[] default_tendencySymolbs
public static final String default_endSymbol
final Multimap<Event,TendencyCollector.TendencyCtrl> tendencyCtrls
getParser()
must be integrated into the
whole parsing process of the voice. It will fill this storage. After completion,
a call to reify(MessageReceiver, Iterable,Map, Map, Map, Map, Map, Map, Map, Map)
will analyse this storage and construct event sets.protected Function6<E extends Entity,String,E extends Entity,Boolean,Integer,String,TendencyCollector.TendencyCtrl> packTendencyCtrl
EventSet[] runningTendencies
public TendencyCollector(String[] tendencySymbols, String endSymbol, Translet.Parser<E> domainParser, Translet.Parser<String> additionalTextParser, boolean lastEventIncluded, boolean singletonTendencyAllowed)
tendencySymbols
- an array of two strings, for increase and decrease.endSymbol
- the input string for "end of tendency"domainParser
- the parser for the values of the parameter domainadditionalTextParser
- the parser for additional text to the start
and/or the end of tendency groupslastEventIncluded
- whether the event carrying the "end of tendency" sign
is included in the EventSetsingletonTendencyAllowed
- whether an "end of tendency" input will be accepted
on the event which has just started this tendency group.public Translet.Parser<?> getParser()
public void reify(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Iterable<Event> evs, Map<String,EventSet> tendencies, Map<EventSet,E> startValues, Map<EventSet,E> endValues, Map<EventSet,String> startTexts, Map<EventSet,String> endTexts, Map<Event,E> singleton_explict, Map<Event,E> singleton_inherited, Map<Event,String> singleton_text)
msg
- the target of warningseve
- input parameter: the set of events to analyse, in the sequential ordertendencies
- all tendency groups by name FIXME name synthetisch ????startValues
- maps a recognized tendency group (=member in the range of
"tendencies") to its start value.endValues
- maps a recognized tendency group (=member in the range of
"tendencies") to its start value.startTexts
- maps a recognized tendency group (=member in the range of
"tendencies") to its start text.endTexts
- maps a recognized tendency group (=member in the range of
"tendencies") to its start text.singleton_explicit
- maps all events which carry an explicit paramter valuesingleton_inherited
- maps all events which inherti the parameter value from
some predecessor.singleton_text
- maps all events which carry an additional "start_text",
which is also an "end_text" in case of a singleton tendency group.protected boolean startsTendency(TendencyCollector.TendencyCtrl tc)