Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class javax.speech.recognition.RecognizerEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--javax.speech.SpeechEvent
              |
              +--javax.speech.EngineEvent
                    |
                    +--javax.speech.recognition.RecognizerEvent

public class RecognizerEvent
extends EngineEvent
Event issued by Recognizer through RecognizerListener. Inherits the following event types from EngineEvent: ENGINE_ALLOCATED, ENGINE_DEALLOCATED, ENGINE_ALLOCATING_RESOURCES, ENGINE_DEALLOCATING_RESOURCES, ENGINE_PAUSED, ENGINE_RESUMED.

The source object for any RecognizerEvent is the Recognizer.

See Also:
EngineEvent, Recognizer, RecognizerListener, Serialized Form

Field Summary
static int CHANGES_COMMITTED
          CHANGES_COMMITTED event is issued when a Recognizer changes from the SUSPENDED state to the LISTENING state.
static int FOCUS_GAINED
          FOCUS_GAINED event is issued when a Recognizer changes from the FOCUS_OFF state to the FOCUS_ON state.
static int FOCUS_LOST
          FOCUS_LOST event is issued when a Recognizer changes from the FOCUS_ON state to the FOCUS_OFF state.
GrammarException grammarException
          Non-null if any error is detected in a grammar's definition while producing a CHANGES_COMMITTED event.
static int RECOGNIZER_PROCESSING
          RECOGNIZER_PROCESSING event is issued when a Recognizer changes from the LISTENING state to the PROCESSING state to indicate that it is actively processing a recognition Result.
static int RECOGNIZER_SUSPENDED
          RECOGNIZER_SUSPENDED event is issued when a Recognizer changes from either the LISTENING state or the PROCESSING state to the SUSPENDED state.
 
Fields inherited from class javax.speech.EngineEvent
ENGINE_ALLOCATED, ENGINE_ALLOCATING_RESOURCES, ENGINE_DEALLOCATED, ENGINE_DEALLOCATING_RESOURCES, ENGINE_PAUSED, ENGINE_RESUMED, newEngineState, oldEngineState
 
Fields inherited from class javax.speech.SpeechEvent
id
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
RecognizerEvent(Recognizer source, int id, long oldEngineState, long newEngineState, GrammarException grammarException)
          Construct a RecognizerEvent with a specified event source, event identifier, old and new states, and optionally a GrammarException for a CHANGES_COMMITTED event.
 
Method Summary
GrammarException getGrammarException()
          Returns non-null for a CHANGES_COMMITTED event if an error is found in the grammar definition.
String paramString()
          Returns a parameter string identifying this event.
 
Methods inherited from class javax.speech.EngineEvent
getNewEngineState, getOldEngineState, paramString
 
Methods inherited from class javax.speech.SpeechEvent
getId, paramString, toString
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

RECOGNIZER_PROCESSING

public static final int RECOGNIZER_PROCESSING
RECOGNIZER_PROCESSING event is issued when a Recognizer changes from the LISTENING state to the PROCESSING state to indicate that it is actively processing a recognition Result. The transition is triggered when the recognizer detects speech in the incoming audio stream that may match and active grammar. The transition occurs immediately before the RESULT_CREATED is issued to ResultListeners.

See Also:
recognizerProcessing, LISTENING, PROCESSING, RESULT_CREATED, getEngineState, getId

RECOGNIZER_SUSPENDED

public static final int RECOGNIZER_SUSPENDED
RECOGNIZER_SUSPENDED event is issued when a Recognizer changes from either the LISTENING state or the PROCESSING state to the SUSPENDED state.

A transition from the LISTENING state to the SUSPENDED state is triggered by a call to either the suspend method or the commitChanges method.

A transition from the PROCESSING state to the SUSPENDED state is triggered by the finalization of the result currently being recognized. In this instance, the RECOGNIZER_SUSPENDED event is followed immediately by either the RESULT_ACCEPTED or RESULT_REJECTED event that finalizes the result.

See Also:
recognizerSuspended, LISTENING, PROCESSING, SUSPENDED, suspend, commitChanges, getEngineState, getId, RESULT_ACCEPTED, RESULT_REJECTED

CHANGES_COMMITTED

public static final int CHANGES_COMMITTED
CHANGES_COMMITTED event is issued when a Recognizer changes from the SUSPENDED state to the LISTENING state. This state transition takes place when changes to the definition and enabled state of all a recognizer's grammars have been applied. The new grammar definitions are used as incoming speech is recognized in the LISTENING and PROCESSING states of the Recognizer.

Immediately following the CHANGES_COMMITTED event, GRAMMAR_CHANGES_COMMITTED events are issued to the GrammarListeners of each changed Grammar.

If any errors are detected in any grammar's definition during the commit, a GrammarException is provided with this event. The GrammarException is also included with the GRAMMAR_CHANGES_COMMITTED event to Grammar with the error. The GrammarException has the same function as the GrammarException thrown on the commitChanges method.

The causes and timing of the CHANGES_COMMITTED event are described with the state transition documentation for a Recognizer with the the committing changes documentation for a Grammar.

See Also:
changesCommitted, commitChanges, LISTENING, SUSPENDED, GRAMMAR_CHANGES_COMMITTED, getEngineState, getId

FOCUS_GAINED

public static final int FOCUS_GAINED
FOCUS_GAINED event is issued when a Recognizer changes from the FOCUS_OFF state to the FOCUS_ON state. This event typically occurs as a result of a call the the requestFocus method of the Recognizer.

The event indicates that the FOCUS_ON bit of the engine state is set.

Since recognizer focus is a key factor in the activation policy for grammars, a FOCUS_GAINED event is followed by a GRAMMAR_ACTIVATED event to the GrammarListeners of each Grammar that is activated. Activation conditions and the role of recognizer focus are detailed in the documentation for the Grammar interface.

See Also:
focusGained, FOCUS_LOST, FOCUS_ON, requestFocus, GRAMMAR_ACTIVATED, Grammar

FOCUS_LOST

public static final int FOCUS_LOST
FOCUS_LOST event is issued when a Recognizer changes from the FOCUS_ON state to the FOCUS_OFF state. This event may occur as a result of a call to the releaseFocus method of the Recognizer or because another application has requested recognizer focus.

The event indicates that the FOCUS_OFF bit of the engine state is set.

Since recognizer focus is a key factor in the activation policy for grammars, a FOCUS_LOST event is followed by a GRAMMAR_DEACTIVATED event to the GrammarListeners of each Grammar that loses activatation. Activation conditions and the role of recognizer focus are detailed in the documentation for the Grammar interface.

See Also:
focusLost, FOCUS_GAINED, FOCUS_OFF, releaseFocus, GRAMMAR_DEACTIVATED, Grammar

grammarException

protected GrammarException grammarException
Non-null if any error is detected in a grammar's definition while producing a CHANGES_COMMITTED event. null for other event types. The exception serves the same functional role as the GrammarException thrown on the commitChanges method.

See Also:
getGrammarException, commitChanges
Constructor Detail

RecognizerEvent

public RecognizerEvent(Recognizer source,
                       int id,
                       long oldEngineState,
                       long newEngineState,
                       GrammarException grammarException)
Construct a RecognizerEvent with a specified event source, event identifier, old and new states, and optionally a GrammarException for a CHANGES_COMMITTED event.

Parameters:
source - the Recognizer that issued the event
id - the identifier for the event type
oldEngineState - engine state prior to this event
newEngineState - engine state following this event
grammarException - non-null if an error is detected during CHANGES_COMMITTED
Method Detail

getGrammarException

public GrammarException getGrammarException()
Returns non-null for a CHANGES_COMMITTED event if an error is found in the grammar definition. The exception serves the same functional role as the GrammarException thrown on the commitChanges method.

See Also:
commitChanges

paramString

public String paramString()
Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.

Returns:
a string identifying the event
Overrides:
paramString in class EngineEvent

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com