org.speakright.core.tests
Class Flow2Wrapper

java.lang.Object
  extended by org.speakright.core.FlowBase
      extended by org.speakright.core.flows.BasicFlow
          extended by org.speakright.core.tests.Flow2Wrapper
All Implemented Interfaces:
java.io.Serializable, IFlow

public class Flow2Wrapper
extends BasicFlow

See Also:
Serialized Form

Field Summary
 IFlow m_flow1
           
 IFlow m_flow2
           
 
Fields inherited from class org.speakright.core.flows.BasicFlow
m_L
 
Constructor Summary
Flow2Wrapper(java.lang.String name, IFlow flow1, IFlow flow2)
           
 
Method Summary
 IFlow getFirst(IFlowContext context)
          If there are sub-flows then return the first one, otherwise return self.
 IFlow getNext(IFlow current, SRResults results)
          get the next flow.
 IFlow onCatch(IFlow current, SRResults results, java.lang.String eventName, ThrowEvent event)
          The default implementation of onCatch is to return null, indicating that this object does not handle custom events.
 IFlow onDisconnect(IFlow current, SRResults results)
          The default implementation of onDisconnect is to return null, indicating that this object does not handle disconnect events.
 IFlow onValidateFailed(IFlow current, SRResults results)
          The default implementation of onValidateFailed is to return null, indicating that this object does not handle validate-failed events.
 
Methods inherited from class org.speakright.core.flows.BasicFlow
add, addPromptFlow, findSubFlow, getSubFlowAfter, SubFlowCount
 
Methods inherited from class org.speakright.core.FlowBase
createRenderer, execute, executionCount, fixupGrammar, fixupPrompt, log, logError, name, onBegin, onComplete, onEnd, onNoInput, onPlatformError, onTransferFailed, 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_flow1

public IFlow m_flow1

m_flow2

public IFlow m_flow2
Constructor Detail

Flow2Wrapper

public Flow2Wrapper(java.lang.String name,
                    IFlow flow1,
                    IFlow flow2)
Method Detail

getFirst

public IFlow getFirst(IFlowContext context)
Description copied from class: BasicFlow
If there are sub-flows then return the first one, otherwise return self. BasicFlow supports optional sub-flows. An optional sub-flow can return null from it's getFirst method to indicate that it doesn't wish to run. BasicFlow must still adhere to the rule that SRRunner requires getFirst never return null; therefore at least one sub-flow's getFirst must return non-null. Detail: getFirst method of sub-flows may be called more than once.

Specified by:
getFirst in interface IFlow
Overrides:
getFirst in class BasicFlow
Returns:
an IFlow object to be executed.

getNext

public IFlow getNext(IFlow current,
                     SRResults results)
Description copied from class: BasicFlow
get the next flow. If there are sub-flows then return the next sub-flow.

Specified by:
getNext in interface IFlow
Overrides:
getNext in class BasicFlow
Parameters:
current - the currently executing flow object. More precisely, current is the flow object that this object most recently returned from getFirst or getNext.
results - the results of current's execution by the speech platform. Results contains user input and/or events such as disconnect or platform-error.
Returns:
the next flow to run, or null which means this flow object is finished.

onDisconnect

public IFlow onDisconnect(IFlow current,
                          SRResults results)
Description copied from class: FlowBase
The default implementation of onDisconnect is to return null, indicating that this object does not handle disconnect events.

Specified by:
onDisconnect in interface IFlow
Overrides:
onDisconnect in class FlowBase
Parameters:
current - the currently executing flow object.
results - the results of current's execution. In this case results will contain a Disconnect result code. User input may be present, if the caller spoke before hanging up. Some applications may want to process this final utterance before terminating.
Returns:
the next flow to run, or null which means this flow object does not handle this event.

onCatch

public IFlow onCatch(IFlow current,
                     SRResults results,
                     java.lang.String eventName,
                     ThrowEvent event)
Description copied from class: FlowBase
The default implementation of onCatch is to return null, indicating that this object does not handle custom events.

Specified by:
onCatch in interface IFlow
Overrides:
onCatch in class FlowBase
Parameters:
current - the currently executing flow object.
results - the results of current's execution.
eventName - name of the event. most event handling can be done using just the name.
event - event object. advanced event handling may require the actual event object
Returns:
the next flow to run, or null which means this flow object does not handle this event.

onValidateFailed

public IFlow onValidateFailed(IFlow current,
                              SRResults results)
Description copied from class: FlowBase
The default implementation of onValidateFailed is to return null, indicating that this object does not handle validate-failed events.

Specified by:
onValidateFailed in interface IFlow
Overrides:
onValidateFailed in class FlowBase
Parameters:
current - the currently executing flow object.
results - the results of current's execution. In this case results will contain the user input that failed validation.
Returns:
the next flow to run, or null which means this flow object does not handle this event.