|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eu.bandm.tscore.tdom.Visitor eu.bandm.tscore.base.Reducer
public class Reducer
Realizes second step of any tscore text processing pipeline by
translating the output of TScoreParser
,
which is an instance of a eu.bandm.tscore.tdom
tdom model,
into a eu.bandm.tscore.model
umod model.
All parameter strings are left as raw, unparsed data and must
be parsed in subsequent steps by dedicated parsers, depending on the
score format which is to implement.
Usage Pattern:
Call the constructor Reducer(MuLiMessageReceiver, TimeScape)
with
a pre-built instance of TimeScape
. This serves as a global
container for the reduction results!
Then call reduce(Document_file, Reactions)
or
reduce(Document_file)
.
Nested Class Summary | |
---|---|
protected class |
Reducer.MergeSymbols<E extends TypedChoice>
Creates a new list of elements, where all adjacent idents, numerics and nonAlfanumeric(E/P)s are concatenated in one Element_ident. |
static class |
Reducer.Reaction
Encodes how the code will react to a specific input condition. |
static class |
Reducer.Reactions
An instance of this class is used to parametrize the call of reduce(Document_file,Reactions) for defining the
reactions to certain critical conditions in the input data. |
Field Summary | |
---|---|
protected SortedMap<Integer,Tp> |
col2tp
|
protected Part |
currentPart
|
protected Vox |
currentVox
|
static Reducer.Reactions |
defaultReactions
Contains an instance with default values, as described with the fields of Reducer.Reactions . |
protected MuLiMessageReceiver<XMLDocumentIdentifier> |
msg
|
protected Reducer.Reactions |
reactions
|
protected TimeScape |
timescape
The central container for all reducing results, must set when calling the constructor Reducer(MuLiMessageReceiver,TimeScape) |
protected Map<Tp,Integer> |
tp2col
|
protected SortedMap<Integer,Event> |
voxEvents
|
Constructor Summary | |
---|---|
Reducer(MuLiMessageReceiver<XMLDocumentIdentifier> msg,
TimeScape timescape)
|
Method Summary | |
---|---|
protected void |
checkMeasureLineNumber(eu.bandm.tscore.tdom.Element el)
|
protected void |
ERROR(eu.bandm.tscore.tdom.Element el,
String txt,
Object... args)
|
protected void |
ERROR(Tp tp,
String txt,
Object... args)
|
protected Tp |
getCol2tp(eu.bandm.tscore.tdom.Element el)
|
static String |
getParamText(Event ev,
String key,
String sep)
|
protected void |
makeEvent(int col,
Tp tp,
eu.bandm.tscore.tdom.Element el)
|
protected void |
makeEvent(Tp tp,
eu.bandm.tscore.tdom.Element el)
|
protected void |
makeParenthesizedEvents(eu.bandm.tscore.tdom.Element_division division,
Tp from,
Tp to)
<!ELEMENT division (elementV+) > |
void |
makeSubdivision(eu.bandm.tscore.tdom.Element[] els,
Tp from,
Tp to)
<!ELEMENT subsubdivision EMPTY > |
protected void |
putCol2tp(eu.bandm.tscore.tdom.Element el,
Tp tp)
|
protected void |
putCol2tp(int loc,
Tp tp)
|
protected void |
putTp2Loc(Tp tp,
eu.bandm.tscore.tdom.Element el)
PLEASE NOTE that locations for time points are kept with "part", because they can appear more than once, but not per part. |
protected void |
react(Reducer.Reaction react,
Location<XMLDocumentIdentifier> loc,
String txt,
Object... args)
|
void |
reduce(eu.bandm.tscore.tdom.Document_file file)
Call the reduce(Document_file,Reactions) method
with the default reactions,
as described with the fields of Reducer.Reactions . |
void |
reduce(eu.bandm.tscore.tdom.Document_file file,
Reducer.Reactions reactions)
The result of the parsing process are zero or more instances of Part ,
Vox and
Tp .. |
protected boolean |
testMakeEvent(int col,
Map<Integer,eu.bandm.tscore.tdom.Element> col2sub)
Test whether there is an event on the "one-beat". |
protected Location<XMLDocumentIdentifier> |
tp2loc(Tp tp)
|
void |
visit(eu.bandm.tscore.tdom.Element_akkolade element)
<!ELEMENT akkolade (measureline, voxs) > |
void |
visit(eu.bandm.tscore.tdom.Element_formatdef element)
<!ELEMENT formatdef (ident) > |
void |
visit(eu.bandm.tscore.tdom.Element_measureline.Seq_1 seq)
|
void |
visit(eu.bandm.tscore.tdom.Element_measureline element)
<!ELEMENT measureline ((ident | numeric), subsubdivision*, subdivision*)*
>
|
void |
visit(eu.bandm.tscore.tdom.Element_paramline element)
<!ELEMENT paramline (ident, element*) > |
void |
visit(eu.bandm.tscore.tdom.Element_parsdef element)
<!ELEMENT parsDef (ident_or_string, useFormat?, akkolade*) > |
void |
visit(eu.bandm.tscore.tdom.Element_useFormat element)
<!ELEMENT useFormat (ident) > |
void |
visit(eu.bandm.tscore.tdom.Element_voiceline element)
Makes all events in one voiceline, relative to a current status of column/timepoint definitions, as defined by a preceding timeline. |
protected void |
WARNING(eu.bandm.tscore.tdom.Element el,
String txt,
Object... args)
|
protected void |
WARNING(Tp tp,
String txt,
Object... args)
|
Methods inherited from class eu.bandm.tscore.tdom.Visitor |
---|
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Reducer.Reactions defaultReactions
Reducer.Reactions
.
protected Reducer.Reactions reactions
protected final TimeScape timescape
Reducer(MuLiMessageReceiver,TimeScape)
protected final MuLiMessageReceiver<XMLDocumentIdentifier> msg
protected Part currentPart
protected SortedMap<Integer,Tp> col2tp
protected Map<Tp,Integer> tp2col
protected SortedMap<Integer,Event> voxEvents
protected Vox currentVox
Constructor Detail |
---|
public Reducer(MuLiMessageReceiver<XMLDocumentIdentifier> msg, TimeScape timescape)
msg
- the message channel for all errors/warningstimescape
- the container for all processing results,
seereduce(Document_file,Reactions)
,Method Detail |
---|
public void reduce(eu.bandm.tscore.tdom.Document_file file, Reducer.Reactions reactions)
Part
,
Vox
and
Tp
.. They all will be entered
into the corresponding maps in timescape
.
FIXME MISSING: Parsing of format definitions (Element_formatdef)
and their application.
public void reduce(eu.bandm.tscore.tdom.Document_file file)
reduce(Document_file,Reactions)
method
with the default reactions,
as described with the fields of Reducer.Reactions
.
public static String getParamText(Event ev, String key, String sep)
protected void putTp2Loc(Tp tp, eu.bandm.tscore.tdom.Element el)
protected void ERROR(eu.bandm.tscore.tdom.Element el, String txt, Object... args)
protected void WARNING(eu.bandm.tscore.tdom.Element el, String txt, Object... args)
protected void ERROR(Tp tp, String txt, Object... args)
protected void WARNING(Tp tp, String txt, Object... args)
protected Location<XMLDocumentIdentifier> tp2loc(Tp tp)
protected void react(Reducer.Reaction react, Location<XMLDocumentIdentifier> loc, String txt, Object... args)
protected void putCol2tp(int loc, Tp tp)
protected void putCol2tp(eu.bandm.tscore.tdom.Element el, Tp tp)
protected Tp getCol2tp(eu.bandm.tscore.tdom.Element el)
public void visit(eu.bandm.tscore.tdom.Element_formatdef element)
<!ELEMENT formatdef (ident) >
visit
in class eu.bandm.tscore.tdom.Visitor
public void visit(eu.bandm.tscore.tdom.Element_useFormat element)
<!ELEMENT useFormat (ident) >
visit
in class eu.bandm.tscore.tdom.Visitor
public void visit(eu.bandm.tscore.tdom.Element_parsdef element)
<!ELEMENT parsDef (ident_or_string, useFormat?, akkolade*) >
visit
in class eu.bandm.tscore.tdom.Visitor
public void visit(eu.bandm.tscore.tdom.Element_akkolade element)
<!ELEMENT akkolade (measureline, voxs) >
visit
in class eu.bandm.tscore.tdom.Visitor
public void visit(eu.bandm.tscore.tdom.Element_measureline element)
<!ELEMENT measureline ((ident | numeric), subsubdivision*, subdivision*)*
>
visit
in class eu.bandm.tscore.tdom.Visitor
protected void checkMeasureLineNumber(eu.bandm.tscore.tdom.Element el)
public void visit(eu.bandm.tscore.tdom.Element_measureline.Seq_1 seq)
visit
in class eu.bandm.tscore.tdom.Visitor
public void makeSubdivision(eu.bandm.tscore.tdom.Element[] els, Tp from, Tp to)
<!ELEMENT subsubdivision EMPTY >
public void visit(eu.bandm.tscore.tdom.Element_voiceline element)
testMakeEvent(int,Map)
TDivision
is created and the events are made at the
corresponding sub-points of this division.
In this turn, it is tested explicitly wheter a sub-division or a
single event has to be made.
Element_subdivision
being the LAST in the input and
extending beyond the current section are NOT treated but memorized.
voxEvents
, for parsing of subsequent parameter lines.
visit
in class eu.bandm.tscore.tdom.Visitor
protected boolean testMakeEvent(int col, Map<Integer,eu.bandm.tscore.tdom.Element> col2sub)
protected void makeParenthesizedEvents(eu.bandm.tscore.tdom.Element_division division, Tp from, Tp to)
<!ELEMENT division (elementV+) >
protected void makeEvent(Tp tp, eu.bandm.tscore.tdom.Element el)
protected void makeEvent(int col, Tp tp, eu.bandm.tscore.tdom.Element el)
public void visit(eu.bandm.tscore.tdom.Element_paramline element)
<!ELEMENT paramline (ident, element*) >
visit
in class eu.bandm.tscore.tdom.Visitor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |