| Overview | Package | Class | Tree | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--java.util.EventObject
|
+--javax.speech.SpeechEvent
|
+--javax.speech.recognition.GrammarEvent
GrammarEvent is issued to each
GrammarListener attached to a Grammar
when major events associated with that Grammar occur.
The source for a GrammarEvent is always a
Grammar object.
| Field Summary | |
| boolean | definitionChanged
True if the grammar's definition has changed with a GRAMMAR_CHANGES_COMMITTED event. |
| boolean | enabledChanged
True if the grammar's enabled property has changed with a
GRAMMAR_CHANGES_COMMITTED event. |
| static int | GRAMMAR_ACTIVATED
A GRAMMAR_ACTIVATED event is issued when a
grammar changes state from deactivated to activated. |
| static int | GRAMMAR_CHANGES_COMMITTED
A GRAMMAR_CHANGES_COMMITTED event is issued when a
Recognizer completes
committing changes to a Grammar. |
| static int | GRAMMAR_DEACTIVATED
A GRAMMAR_DEACTIVATED event is issued when a
grammar changes state from activated to deactivated.
|
| GrammarException | grammarException
Non-null if any error is detected in a grammar's definition while producing a GRAMMAR_CHANGES_COMMITTED event.
|
| Fields inherited from class javax.speech.SpeechEvent | |
| id | |
| Fields inherited from class java.util.EventObject | |
| source | |
| Constructor Summary | |
| GrammarEvent(Grammar source,
int id,
boolean enabledChanged,
boolean definitionChanged,
GrammarException grammarException)
Constructs a GrammarEvent event with a specified
event identifier plus state change and exception values.
|
|
| GrammarEvent(Grammar source,
int id)
Constructs a GrammarEvent event with a specified
event identifier. |
|
| Method Summary | |
| boolean | getDefinitionChanged()
Returns true for a GRAMMAR_CHANGES_COMMITTED
event if the definition of the source Grammar
has changed. |
| boolean | getEnabledChanged()
Returns true for a GRAMMAR_CHANGES_COMMITTED
event if the enabled property of the Grammar changed. |
| GrammarException | getGrammarException()
Returns non-null for a GRAMMAR_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.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 |
public static final int GRAMMAR_CHANGES_COMMITTED
GRAMMAR_CHANGES_COMMITTED event is issued when a
Recognizer completes
committing changes to a Grammar. The event
is issued immediately following the CHANGES_COMMITTED
event that is issued to RecognizerListeners. That
event indicates that changes have been applied to all grammars
of a Recognizer. The GRAMMAR_CHANGES_COMMITTED
event is specific to each individual grammar.
The event is issued when the definition of the grammar is
changed, when its enabled property is changed, or both.
The enabledChanged and definitionChanged
flags are set accordingly.
A GRAMMAR_CHANGES_COMMITTED event can triggered without
an explicit call to commitChanges - there is usually an
implicit commitChanges at the completion of
result finalization event processing. If any syntactic or
logical errors are detected for a Grammar during the
commit, the generated GrammarException is included with
this event. If no problem is found the value is null.
public static final int GRAMMAR_ACTIVATED
GRAMMAR_ACTIVATED event is issued when a
grammar changes state from deactivated to activated. The
isActive method of the Grammar
will now return true.
Grammar activation changes follow one of two RecognizerEvents:
(1) a CHANGES_COMMITTED event in which a grammar's
enabled flag is set true or (2) a
FOCUS_GAINED event. The full details of the
activation conditions under which a
Grammar is activated are described in the documentation
for the Grammar interface.
public static final int GRAMMAR_DEACTIVATED
GRAMMAR_DEACTIVATED event is issued when a
grammar changes state from activated to deactivated.
The isActive method of the Grammar
will now return false.
Grammar deactivation changes follow one of two RecognizerEvents:
(1) a CHANGES_COMMITTED event in which a grammar's
enabled flag is set false or (2) a
FOCUS_LOST event. The full details of the
activation conditions under which a
Grammar is deactivated are described in the documentation
for the Grammar interface.
protected boolean enabledChanged
enabled property has changed with a
GRAMMAR_CHANGES_COMMITTED event. False for other
event types.
protected boolean definitionChanged
GRAMMAR_CHANGES_COMMITTED event. False for other
event types.
protected GrammarException grammarException
GRAMMAR_CHANGES_COMMITTED event.
null for other event types.
| Constructor Detail |
public GrammarEvent(Grammar source,
int id,
boolean enabledChanged,
boolean definitionChanged,
GrammarException grammarException)
GrammarEvent event with a specified
event identifier plus state change and exception values.
For a GRAMMAR_CHANGES_COMMITTED event, the
enabledChanged and definitionChanged
parameters should indicate what properties of the Grammar
has changed, otherwise they should be false.
For a GRAMMAR_CHANGES_COMMITTED event, the
grammarException parameter should be non-null
only if an error is encountered in the grammar definition.
source
- the object that issued the event
id
- the identifier for the event type
enabledChanged
- true if the grammar's enabled property changed
definitionChanged
- true if the grammar's definition has changed
grammarException
- non-null if an error is detected in a grammar's definition
public GrammarEvent(Grammar source,
int id)
GrammarEvent event with a specified
event identifier. The enabledChanged and
definitionChanged fields are set to false.
The grammarException field is set to null.
source
- the object that issued the event
id
- the identifier for the event type| Method Detail |
public boolean getEnabledChanged()
true for a GRAMMAR_CHANGES_COMMITTED
event if the enabled property of the Grammar changed.public boolean getDefinitionChanged()
true for a GRAMMAR_CHANGES_COMMITTED
event if the definition of the source Grammar
has changed.public GrammarException getGrammarException()
GRAMMAR_CHANGES_COMMITTED
event if an error is found in the grammar definition.public String paramString()
| 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