org.speakright.core.flows
Class QuestionFlow

java.lang.Object
  extended by org.speakright.core.FlowBase
      extended by org.speakright.core.flows.QuestionFlow
All Implemented Interfaces:
java.io.Serializable, IFlow
Direct Known Subclasses:
BaseSROQuestion, TestConfirmation.AskCityFlow, TestConfirmation.ConfYNFlow, TestModel.EarlyBindingFlow, TestRender.QFlow, TestSerialization.QFlow, TestWebServlet2.QFlow

public class QuestionFlow
extends FlowBase

Flow object that asks the user a question. The user can reply using either speech or DTMF digits, depending on the grammar used. This class implements a single-slot single question. This is the simplest form of directed dialog VUI.

Author:
IanRaeLaptop
See Also:
Serialized Form

Field Summary
protected  Question m_quest
           
 
Constructor Summary
QuestionFlow()
           
QuestionFlow(java.lang.String gtext, java.lang.String ptext)
          Constructor.
 
Method Summary
 void add(PromptType type, java.lang.String text)
          Add a prompt to the question.
 void addBinding(java.lang.String slotName, java.lang.String modelVar)
          Add a model binding.
 void addGrammar(Grammar gram)
          Add/replace a grammar to the question.
 void addGrammar(java.lang.String gtext)
          Add/replace a grammar to the question.
 void addPrompt(Prompt prompt)
          Add a prompt to the question.
 IFlowRenderer createRenderer()
          Create the type-specific renderer
protected  void InitPrompts(java.lang.String subject)
          initialize the main, silence, and noreco prompts to default values.
 
Methods inherited from class org.speakright.core.FlowBase
execute, executionCount, fixupGrammar, fixupPrompt, getFirst, getNext, getSubFlowAfter, log, logError, name, onBegin, onCatch, onComplete, onDisconnect, onEnd, onNoInput, onPlatformError, onTransferFailed, onValidateFailed, promptGroup, setExecutionCount, setName, setPromptGroup, shouldExecute, validateInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_quest

protected Question m_quest
Constructor Detail

QuestionFlow

public QuestionFlow()

QuestionFlow

public QuestionFlow(java.lang.String gtext,
                    java.lang.String ptext)
Constructor.

Parameters:
gtext - a grammar text (url, inline grammar, etc)
ptext - prompt text
Method Detail

InitPrompts

protected void InitPrompts(java.lang.String subject)
initialize the main, silence, and noreco prompts to default values.

Parameters:
subject - the subject of the question, such as "flight". Used to construct the prompts. Of course, simply inserting a subject into our default prompts may not always be grammatically correct. Issues such as lack of pluralization may occur. In those cases, you should set the prompts yourself.

add

public void add(PromptType type,
                java.lang.String text)
Add a prompt to the question.

Parameters:
type - type of prompt. This includes the role (MAIN, SILENCE, NORECO) and escalation count.
text - prompt text.

addPrompt

public void addPrompt(Prompt prompt)
Add a prompt to the question. (low-level)

Parameters:
type - type of prompt. This includes the role (MAIN, SILENCE, NORECO) and escalation count.
text - prompt text.

addGrammar

public void addGrammar(Grammar gram)
Add/replace a grammar to the question. Each question can have at most one VOICE and one DTMF grammar.

Parameters:
gram - grammar

addGrammar

public void addGrammar(java.lang.String gtext)
Add/replace a grammar to the question. Each question can have at most one VOICE and one DTMF grammar.

Parameters:
grammar - text such as "inline:yes no"

addBinding

public void addBinding(java.lang.String slotName,
                       java.lang.String modelVar)
Add a model binding.

Parameters:
slotName - slot in the grammar that is the value to be bound. When the speech platform sends back the user input, it sends back (slot,value) pairs.
modelVar - name of the model variable to bind to. This variable must have get and set methods with the following signatures public {type} {modelVar}(); public void set{modelVar}({type} value); Examples: public String City(); public void setCity(String value);

createRenderer

public IFlowRenderer createRenderer()
Create the type-specific renderer

Specified by:
createRenderer in interface IFlow
Overrides:
createRenderer in class FlowBase