org.jvoicexml.implementation.jsapi10
Class JVoiceXMLRecognitionListener

java.lang.Object
  extended by java.lang.Thread
      extended by org.jvoicexml.implementation.jsapi10.JVoiceXMLRecognitionListener
All Implemented Interfaces:
Runnable, EventListener, ResultListener

public final class JVoiceXMLRecognitionListener
extends Thread
implements ResultListener

Thread that waits for input from the recognizer.

Version:
$Revision: 190 $

Copyright © 2005-2007 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Dirk Schnelle

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JVoiceXMLRecognitionListener(UserInputListener inputListener)
          Construct a new object.
 
Method Summary
 void audioReleased(ResultEvent resultEvent)
          A AUDIO_RELEASED event has occured.
 void grammarFinalized(ResultEvent resultEvent)
          A GRAMMAR_FINALIZED event has occured because the Recognizer has determined which Grammar is matched by the incoming speech.
 boolean isListening()
          Check if the listener thread is still listening for recognition results.
 void resultAccepted(ResultEvent resultEvent)
          An RESULT_ACCEPTED event has occured indicating that a Result has transitioned from the UNFINALIZED state to the ACCEPTED state.
 void resultCreated(ResultEvent resultEvent)
          A RESULT_CREATED event is issued when a Recognizer detects incoming speech that may match an active grammar of an application.
 void resultRejected(ResultEvent resultEvent)
          An RESULT_REJECTED event has occured indicating that a Result has transitioned from the UNFINALIZED state to the REJECTED state.
 void resultUpdated(ResultEvent resultEvent)
          A RESULT_UPDATED event has occured because a token has been finalized and/or the unfinalized text of a result has changed.
 void run()
          Keep things alive.
 void stopListening()
          Stop this listener.
 void trainingInfoReleased(ResultEvent resultEvent)
          A TRAINING_INFO_RELEASED event has occured.
 void waitStopListening()
          Wait until the listener thread terminates.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JVoiceXMLRecognitionListener

public JVoiceXMLRecognitionListener(UserInputListener inputListener)
Construct a new object.

Parameters:
inputListener - Listener for user input events.
Method Detail

run

public void run()
Keep things alive. Just wait for someone to stop this listener.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

stopListening

public void stopListening()
Stop this listener.


isListening

public boolean isListening()
Check if the listener thread is still listening for recognition results.

Returns:
true if the recognition listener thread is alive.

waitStopListening

public void waitStopListening()
Wait until the listener thread terminates.


audioReleased

public void audioReleased(ResultEvent resultEvent)
A AUDIO_RELEASED event has occured. This event is only issued to finalized results. See the documentation of the isAudioAvailable method the FinalResult interface for details.

The event is issued to each ResultListener attached to the Recognizer and to the Result. If a GRAMMAR_FINALIZED event was issued, then the matched Grammar is known, and the event is also issued to each ResultListener attached to that Grammar.

Specified by:
audioReleased in interface ResultListener
Parameters:
resultEvent - ResultEvent

grammarFinalized

public void grammarFinalized(ResultEvent resultEvent)
A GRAMMAR_FINALIZED event has occured because the Recognizer has determined which Grammar is matched by the incoming speech.

The event is issued to each ResultListener attached to the Recognizer, Result, and matched Grammar.

Specified by:
grammarFinalized in interface ResultListener
Parameters:
resultEvent - ResultEvent

resultAccepted

public void resultAccepted(ResultEvent resultEvent)
An RESULT_ACCEPTED event has occured indicating that a Result has transitioned from the UNFINALIZED state to the ACCEPTED state.

Since the Result source for this event is finalized, the Result object can be safely cast to the FinalResult interface.

Specified by:
resultAccepted in interface ResultListener
Parameters:
resultEvent - ResultEvent

resultCreated

public void resultCreated(ResultEvent resultEvent)
A RESULT_CREATED event is issued when a Recognizer detects incoming speech that may match an active grammar of an application.

Specified by:
resultCreated in interface ResultListener
Parameters:
resultEvent - ResultEvent

resultRejected

public void resultRejected(ResultEvent resultEvent)
An RESULT_REJECTED event has occured indicating that a Result has transitioned from the UNFINALIZED state to the REJECTED state.

Specified by:
resultRejected in interface ResultListener
Parameters:
resultEvent - ResultEvent

resultUpdated

public void resultUpdated(ResultEvent resultEvent)
A RESULT_UPDATED event has occured because a token has been finalized and/or the unfinalized text of a result has changed.

Specified by:
resultUpdated in interface ResultListener
Parameters:
resultEvent - ResultEvent

trainingInfoReleased

public void trainingInfoReleased(ResultEvent resultEvent)
A TRAINING_INFO_RELEASED event has occured. This event is only issued to finalized results. See the documentation of the isTrainingInfoAvailable method the FinalResult interface for details.

Specified by:
trainingInfoReleased in interface ResultListener
Parameters:
resultEvent - ResultEvent


Copyright © 2005-2007 JVoiceXML group.