org.speakright.core.render
Class Question

java.lang.Object
  extended by org.speakright.core.render.FormElement
      extended by org.speakright.core.render.Question
All Implemented Interfaces:
java.io.Serializable

public class Question
extends FormElement
implements java.io.Serializable

Represents a single-slot single question, which basically maps to a VoiceXML field tag. A question consists of prompts and grammars. 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
 GrammarSet m_grammarSet
           
 int m_maxAttempts
          # of times to try before giving up with no-input error 1 means try once, 2 means try + 1 retry, ...
 PromptSet m_promptSet
           
 
Constructor Summary
Question()
           
Question(Grammar gram, Prompt prompt)
           
 
Method Summary
 void add(PromptType type, java.lang.String text)
          Add a prompt of the given type
 void addGrammar(Grammar gram)
          adds (or replaces if gram.type already in the grammar set)
 void addPrompt(Prompt prompt)
          Add a prompt (low-level), but only if not already in prompt set
 Grammar grammar()
          Get the voice grammar.
 void InitPrompts(java.lang.String subject)
          Init the error and escalating prompts to something reasonable, using m_subject.
 void renderGrammars(GrammarPipeline pipeline)
          Render the grammars in this question into GrammarItems, which are used to generated VoiceXML.
 void renderPrompts(PromptPipeline pipeline)
          Render the prompts in this question into PromptItems, which are used to generate VoiceXML.
 void setMaxAttempts(int n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_promptSet

public PromptSet m_promptSet

m_grammarSet

public GrammarSet m_grammarSet

m_maxAttempts

public int m_maxAttempts
# of times to try before giving up with no-input error 1 means try once, 2 means try + 1 retry, ... This value is one more than "max retries"

Constructor Detail

Question

public Question()

Question

public Question(Grammar gram,
                Prompt prompt)
Method Detail

grammar

public Grammar grammar()
Get the voice grammar. Will return null in the rare cases that a question doesn't have a voice grammar.

Returns:

addGrammar

public void addGrammar(Grammar gram)
adds (or replaces if gram.type already in the grammar set)

Parameters:
gram -

setMaxAttempts

public void setMaxAttempts(int n)

InitPrompts

public void InitPrompts(java.lang.String subject)
Init the error and escalating prompts to something reasonable, using m_subject. Apps are free to then change or replace the prompts with more suitable prompts themselves.

Parameters:
subject - the subject of the question, such as "tickets".

add

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

Parameters:
type -
text -

addPrompt

public void addPrompt(Prompt prompt)
Add a prompt (low-level), but only if not already in prompt set

Parameters:
prompt -

renderPrompts

public void renderPrompts(PromptPipeline pipeline)
Render the prompts in this question into PromptItems, which are used to generate VoiceXML.

Overrides:
renderPrompts in class FormElement

renderGrammars

public void renderGrammars(GrammarPipeline pipeline)
Render the grammars in this question into GrammarItems, which are used to generated VoiceXML.

Overrides:
renderGrammars in class FormElement