public class PatternDistributor extends Object
Vox
object
by calling process(Vox)
before any further processing of the voice data.
Afterwards the parameter texts in the Vox object are adjusted accordingly
and can be processed as usual (by applying Translet
parsers, etc.)
The patterns are collected and distributed in their textual representation, i.e. without and prior to any analysis.
The behaviour can be depicted by the following state machine:
start---> [INIT] | | "$xxx" V -----> [COLLECTING] <-------- ^^ | | ________ ) "$xxx" || | |"IDEM" || | | ||"$yyy" | V (starting from 0) <---- ||____ |[USING]_________________________) "IDEM" | | | <------------ | | | | | "TERM"| | | | | |"TERM"/"zzz" | |"$yyy" V V | "CONT"/"IDEM" ------- [SUSPENDED] ------------/
Modifier and Type | Class and Description |
---|---|
static class |
PatternDistributor.Phase
States of the state machine.
|
Modifier and Type | Field and Description |
---|---|
static String |
default_endUse
Default for
endUse |
static String |
default_resumeUse
Default for
resumeUse |
static String |
default_startDef
Default for
startDef |
static String |
default_startUse
Default for
startUse |
protected String |
endUse
String constant ending the use of the pattern, when parsed in the parameter track.
|
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> |
msg
The drain of error messages
|
protected String |
paramName
Name of the parameter track to process.
|
protected List<CheckedList<CheckedPair_LR<Location<XMLDocumentIdentifier>,String>>> |
pattern
Store for the parameter values which make up the pattern.
|
protected int |
patternphase
Current counter for re-playing the pattern.
|
protected PatternDistributor.Phase |
phase
State of the state machine, modelling recording and playback.
|
protected String |
resumeUse
String constant ending the use of the pattern, when parsed in the parameter track.
|
protected String |
startDef
String constant starting the definition/recording of a pattern
|
protected int |
startDef_length
Holds the string length of
startDef , for conenience. |
protected String |
startUse
String constant starting the use of the pattern, when parsed in the parameter track.
|
Constructor and Description |
---|
PatternDistributor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
String pname)
Constructor with default string values for the keywords.
|
PatternDistributor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg,
String pname,
String startDef,
String startUse,
String endUse,
String resumeUse)
Constructor with explicit string values for the keywords.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjust(Event ev)
Remove the "start pattern definition" prefix
startDef from the
parameter source text. |
protected void |
copyFromPattern(Event ev)
Copy the parameter value back into the voice from the current pattern position.
|
protected void |
copyIntoPattern(Event ev)
Record the parameter value back fromt the voice into the pattern.
|
(package private) void |
exclusiveCheck(Location<XMLDocumentIdentifier> location,
String paramName,
String keyword,
String input)
Raises an error iff the keyword is not the only contents of the parameter source text.
|
void |
process(Vox v)
Service access point: Process this voice and replace the pattern keywords in its
parameter track (with the name given when creating this instance) by pattern expansion.
|
protected void |
startUsing(Event ev,
String ptext,
Location<XMLDocumentIdentifier> loc,
String keyword,
boolean reset)
Start with the given event the re-play of the pattern.
|
protected final MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg
protected final String paramName
protected final String startDef
protected final int startDef_length
startDef
, for conenience.protected final String startUse
protected final String endUse
protected final String resumeUse
public static final String default_startDef
startDef
public static final String default_startUse
startUse
public static final String default_endUse
endUse
public static final String default_resumeUse
resumeUse
protected List<CheckedList<CheckedPair_LR<Location<XMLDocumentIdentifier>,String>>> pattern
protected int patternphase
protected PatternDistributor.Phase phase
public PatternDistributor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String pname)
msg
- the drain for the error messages.pname
- the name of the parsameter track to process.public PatternDistributor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String pname, String startDef, String startUse, String endUse, String resumeUse)
msg
- the drain for the error messages.pname
- the name of the parameter track to process.protected void copyFromPattern(Event ev)
protected void copyIntoPattern(Event ev)
protected void adjust(Event ev)
startDef
from the
parameter source text. (This includes adjustment of the location.)
This is destructive: The event object will be altered.
FIXME ginge auch NUR auf "pattern" !?!?!void exclusiveCheck(Location<XMLDocumentIdentifier> location, String paramName, String keyword, String input)
protected void startUsing(Event ev, String ptext, Location<XMLDocumentIdentifier> loc, String keyword, boolean reset)
ev
- the current eventptext
- the input value for this parameter (for error messageing only)loc
- the location of the parameters input text (for error messageing only)keyword
- the keyword found in the source text (for error messageing only)reset
- whether to start with the beginning of the pattern, not to resume it.public void process(Vox v)