public abstract class ParameterCollector extends Object
ParameterCollector(MuLiMessageReceiver,String)
parseVoice(Vox)
.
Its code steps through the events, concatenates all parameter text and
prepares the error location map.
parseEvent(Event, ULex.State)
is called internally.
If the State==null, then no parameter is defined for this event
finalizeEvent(Event)
is called.
finalizeTrack()
is called.
parseEvent(Event, ULex.State)
,
finalizeEvent(Event)
and finalizeTrack()
must be
overridden by every derived specialization.
error(int, String, Object...)
and
warning(int, String, Object...)
are "callbacks"
for these methods. They
translate from string buffer positions (as found in ULex.State) into
source file locations (as stored with the Event under processing)
and propagate the message to msg
.Modifier and Type | Field and Description |
---|---|
protected Event |
event |
protected MuLiMessageReceiver<XMLDocumentIdentifier> |
msg
The message receiver determined with the constructor.
|
protected String |
paramName |
static ULex<String> |
parser_text_separator |
protected ParameterCollector |
sourceContext |
protected SortedMap<Integer,Location<XMLDocumentIdentifier>> |
startLoc |
protected ULex.State |
state |
static String |
text_separator |
protected Vox |
vox |
Constructor and Description |
---|
ParameterCollector(MuLiMessageReceiver<XMLDocumentIdentifier> msg,
String paramName) |
Modifier and Type | Method and Description |
---|---|
protected void |
error(int loc,
String text,
Object... args)
Translate the text position from buffer index back to source file posistion
and generate an error message to
msg . |
abstract void |
finalizeEvent(Event event)
Must be specialized for parsing the parameter values for one
single event, but may never be called directly.
|
abstract void |
finalizeTrack()
Must be specialized for finalzing the parsing process of a whole
voice, but may never be called directly.
|
protected Location<XMLDocumentIdentifier> |
findLocation(int loc) |
abstract void |
parseEvent(Event event,
ULex.State state)
Must be specialized for parsing the parameter values for one
single event, but may never be called directly.
|
void |
parseVoice(Vox voice)
The only public entry method.
|
protected void |
setSourceContext(ParameterCollector sourceContext) |
protected void |
warning(int loc,
String text,
Object... args)
Translate the text position from buffer index back to source file posistion
and generate a warning message to
msg . |
public static final String text_separator
protected final MuLiMessageReceiver<XMLDocumentIdentifier> msg
protected final String paramName
protected Vox vox
protected Event event
protected final SortedMap<Integer,Location<XMLDocumentIdentifier>> startLoc
protected ParameterCollector sourceContext
protected ULex.State state
public ParameterCollector(MuLiMessageReceiver<XMLDocumentIdentifier> msg, String paramName)
protected void setSourceContext(ParameterCollector sourceContext)
public abstract void parseEvent(Event event, ULex.State state)
event
- the event to processstate
- the input datapublic abstract void finalizeEvent(Event event)
public abstract void finalizeTrack()
protected Location<XMLDocumentIdentifier> findLocation(int loc)
protected void error(int loc, String text, Object... args)
msg
.protected void warning(int loc, String text, Object... args)
msg
.public void parseVoice(Vox voice)
ULex.State
.
Then calls parseEvent(Event, ULex.State)
and
finalizeEvent(Event)
in a loop, and finally finalizeTrack()
.