JSAPI 2.0

javax.speech
Class EngineEvent

Object
  extended by SpeechEvent
      extended by EngineEvent
Direct Known Subclasses:
RecognizerEvent, SynthesizerEvent

public abstract class EngineEvent
extends SpeechEvent

Provides information to applications about changes in the state of a speech Engine. EngineEvents are issued to the appropriate EngineListener attached to an Engine. The subclasses of EngineEvent provide specific methods and events for the associated types of Engines.

See Also:
Engine, EngineListener

Field Summary
static int DEFAULT_MASK
          The default mask for events in this class.
static int ENGINE_ALLOCATED
          Event issued when Engine allocation is complete.
static int ENGINE_ALLOCATING_RESOURCES
          Event issued when Engine allocation has commenced.
static int ENGINE_DEALLOCATED
          Event issued when Engine deallocation is complete.
static int ENGINE_DEALLOCATING_RESOURCES
          Event issued when Engine deallocation has commenced.
static int ENGINE_DEFOCUSED
          Event issued when an Engine loses focus.
static int ENGINE_ERROR
          Event issued when an Engine error occurs.
static int ENGINE_FOCUSED
          Event issued when an Engine gains focus.
static int ENGINE_PAUSED
          Event issued when the Engine is PAUSED.
static int ENGINE_RESUMED
          Event issued when the Engine is RESUMED.
 
Fields inherited from class SpeechEvent
DISABLE_ALL, ENABLE_ALL
 
Constructor Summary
EngineEvent(Engine source, int id, long oldEngineState, long newEngineState, Throwable problem)
          Constructs an EngineEvent to indicate a change in state.
 
Method Summary
 Throwable getEngineError()
          Returns the non-null Throwable Object that describes the problem for an ENGINE_ERROR event.
 long getNewEngineState()
          Returns the state following this EngineEvent.
 long getOldEngineState()
          Returns the state preceding this EngineEvent.
 String paramString()
          Returns a parameter String that contains the event ID in text form.
 
Methods inherited from class SpeechEvent
getId, getSource, toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ENGINE_ALLOCATED

public static final int ENGINE_ALLOCATED
Event issued when Engine allocation is complete.

The ALLOCATED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, allocate, ALLOCATED, Constant Field Values

ENGINE_DEALLOCATED

public static final int ENGINE_DEALLOCATED
Event issued when Engine deallocation is complete.

The DEALLOCATED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, deallocate, DEALLOCATED, Constant Field Values

ENGINE_ALLOCATING_RESOURCES

public static final int ENGINE_ALLOCATING_RESOURCES
Event issued when Engine allocation has commenced.

The ALLOCATING_RESOURCES flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, allocate, ALLOCATING_RESOURCES, Constant Field Values

ENGINE_DEALLOCATING_RESOURCES

public static final int ENGINE_DEALLOCATING_RESOURCES
Event issued when Engine deallocation has commenced.

The DEALLOCATING_RESOURCES flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, deallocate, DEALLOCATING_RESOURCES, Constant Field Values

ENGINE_PAUSED

public static final int ENGINE_PAUSED
Event issued when the Engine is PAUSED.

The PAUSED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, pause, PAUSED, Constant Field Values

ENGINE_RESUMED

public static final int ENGINE_RESUMED
Event issued when the Engine is RESUMED.

The RESUMED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, resume, RESUMED, Constant Field Values

ENGINE_FOCUSED

public static final int ENGINE_FOCUSED
Event issued when an Engine gains focus. The Engine changes from the DEFOCUSED state to the FOCUSED state.

The FOCUSED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, DEFOCUSED, FOCUSED, ENGINE_DEFOCUSED, Constant Field Values

ENGINE_DEFOCUSED

public static final int ENGINE_DEFOCUSED
Event issued when an Engine loses focus. The Engine changes from the FOCUSED state to the DEFOCUSED state.

The DEFOCUSED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, FOCUSED, DEFOCUSED, ENGINE_FOCUSED, Constant Field Values

ENGINE_ERROR

public static final int ENGINE_ERROR
Event issued when an Engine error occurs. This event provides asynchronous notification of an internal error in the Engine that prevents normal behavior of that Engine. The application should deallocate the Engine in this case.

The ERROR_OCCURRED flag from getNewEngineState is set.

See Also:
getNewEngineState, getId, getEngineError, ERROR_OCCURRED, deallocate, Constant Field Values

DEFAULT_MASK

public static final int DEFAULT_MASK
The default mask for events in this class.

The following events are delivered by default: ENGINE_ALLOCATED, ENGINE_DEALLOCATED, ENGINE_PAUSED, ENGINE_RESUMED, ENGINE_FOCUSED, ENGINE_DEFOCUSED and ENGINE_ERROR.

The events ENGINE_ALLOCATING_RESOURCES and ENGINE_DEALLOCATING_RESOURCES represent transient states and may be enabled if desired.

See Also:
ENGINE_ALLOCATED, ENGINE_ALLOCATING_RESOURCES, ENGINE_DEALLOCATED, ENGINE_DEALLOCATING_RESOURCES, ENGINE_PAUSED, ENGINE_RESUMED, ENGINE_FOCUSED, ENGINE_DEFOCUSED, ENGINE_ERROR, setEngineMask, getEngineMask, Constant Field Values
Constructor Detail

EngineEvent

public EngineEvent(Engine source,
                   int id,
                   long oldEngineState,
                   long newEngineState,
                   Throwable problem)
            throws IllegalArgumentException
Constructs an EngineEvent to indicate a change in state.

oldEngineState and newEngineState are 0 if the Engine states are unknown or undefined.

problem applies to ENGINE_ERROR and must be null for other events.

Parameters:
source - the Engine that issued the event
id - the event identifier
oldEngineState - the Engine state prior to this event
newEngineState - the Engine state following this event
problem - non-null for ENGINE_ERROR, otherwise null
Throws:
IllegalArgumentException - if called with an inappropriate event identifier or an invalid parameter value
See Also:
getSource, getId, getOldEngineState, getNewEngineState, getEngineError, getEngineState, ENGINE_ERROR, ENGINE_ALLOCATED, ENGINE_ALLOCATING_RESOURCES, ENGINE_DEALLOCATED, ENGINE_DEALLOCATING_RESOURCES, ENGINE_DEFOCUSED, ENGINE_FOCUSED, ENGINE_PAUSED, ENGINE_RESUMED
Method Detail

getNewEngineState

public long getNewEngineState()
Returns the state following this EngineEvent. In the absence of any other events, this value matches the value returned from getEngineState.

Returns:
the new Engine state
See Also:
getEngineState, getOldEngineState

getOldEngineState

public long getOldEngineState()
Returns the state preceding this EngineEvent.

Returns:
the old Engine state
See Also:
getEngineState, getNewEngineState

getEngineError

public Throwable getEngineError()
Returns the non-null Throwable Object that describes the problem for an ENGINE_ERROR event.

This method returns null for all other events.

Returns:
the Exception or Error describing the problem
See Also:
ENGINE_ERROR

paramString

public String paramString()
Returns a parameter String that contains the event ID in text form.

This method is useful for event-logging and for debugging. The method toString may provide more detail.

Specified by:
paramString in class SpeechEvent
Returns:
a String that contains the event ID in text form
See Also:
toString

JSAPI 2.0

JavaTM Speech API 2.0, Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.

Free Web Hosting