|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.speakright.core.FlowBase
org.speakright.core.flows.BranchFlow
public abstract class BranchFlow
BranchFlow provides branching of the callflow based on an application-defined condition. Derived classes override the branch method to supply the branching logic. Sub-flows can jump back to the branch flow later by 'throwing' a GotoBranchEvent.
Branch flows can loop forever if m_loopForever is set in the constructor. That is, when the sub-flows end the branch flow executes again.
| Nested Class Summary | |
|---|---|
static class |
BranchFlow.GotoBranchEvent
An event class used to jump back from a sub-flow to a branch flow. |
| Field Summary | |
|---|---|
protected boolean |
m_loopForever
|
| Constructor Summary | |
|---|---|
BranchFlow()
|
|
| Method Summary | |
|---|---|
protected abstract IFlow |
branch()
Derived classes MUST override this and return a flow object to execute. |
IFlow |
getFirst(IFlowContext context)
Do the branching, as determined by branch() |
IFlow |
getNext(IFlow current,
SRResults results)
If m_loopForever set then return this, else null. |
IFlow |
onCatch(IFlow current,
SRResults results,
java.lang.String eventName,
ThrowEvent event)
Catch a GotoBranchEvent that is targeted at this object, that is, the event's m_branchName matches our name. |
protected abstract void |
onCatchGotoBranchEvent(BranchFlow.GotoBranchEvent ev)
Process the caught GotoBranchEvent. |
| Methods inherited from class org.speakright.core.FlowBase |
|---|
createRenderer, execute, executionCount, fixupGrammar, fixupPrompt, getSubFlowAfter, log, logError, name, onBegin, 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 |
|---|
protected boolean m_loopForever
| Constructor Detail |
|---|
public BranchFlow()
| Method Detail |
|---|
public IFlow getFirst(IFlowContext context)
getFirst in interface IFlowgetFirst in class FlowBaseprotected abstract IFlow branch()
public IFlow getNext(IFlow current,
SRResults results)
getNext in interface IFlowgetNext in class FlowBasecurrent - 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.
public IFlow onCatch(IFlow current,
SRResults results,
java.lang.String eventName,
ThrowEvent event)
onCatch in interface IFlowonCatch in class FlowBasecurrent - 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
protected abstract void onCatchGotoBranchEvent(BranchFlow.GotoBranchEvent ev)
ev - the caught event.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||