org.jvoicexml.implementation
Class DocumentGrammarImplementation

java.lang.Object
  extended by org.jvoicexml.implementation.DocumentGrammarImplementation
All Implemented Interfaces:
GrammarImplementation<GrammarDocument>

public final class DocumentGrammarImplementation
extends Object
implements GrammarImplementation<GrammarDocument>

A grammar implementation that simply represents a grammar document. This may be suitable for all cases where there is no specific grammar implementation but an implementation that is simply based on documents.

Since:
0.7.3
Version:
$Revision: 2592 $
Author:
Dirk Schnelle-Walka

Constructor Summary
DocumentGrammarImplementation(GrammarDocument doc)
          Constructs a new object.
 
Method Summary
 boolean accepts(RecognitionResult result)
          Checks, if this grammar covers the given recognition result.
 boolean equals(GrammarImplementation<GrammarDocument> other)
          Checks if this grammar implementation is equal to the given grammar implementation.
 GrammarDocument getGrammar()
          Retrieves the grammar object.
 GrammarType getMediaType()
          Returns the declared media type of the external grammar.
 ModeType getModeType()
          Returns the mode type of the grammar.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentGrammarImplementation

public DocumentGrammarImplementation(GrammarDocument doc)
Constructs a new object.

Parameters:
doc - the grammar document.
Method Detail

hashCode

public int hashCode()

Overrides:
hashCode in class Object

accepts

public boolean accepts(RecognitionResult result)
Checks, if this grammar covers the given recognition result.

It is not legal to check if the result is accepted using RecognitionResult.isAccepted(). Implementations should assume that it is a valid input result.

Implementations can use the GrammarChecker.

Specified by:
accepts in interface GrammarImplementation<GrammarDocument>
Parameters:
result - the result to check.
Returns:
true if the utterance is valid for this grammar

equals

public boolean equals(GrammarImplementation<GrammarDocument> other)
Checks if this grammar implementation is equal to the given grammar implementation.

Specified by:
equals in interface GrammarImplementation<GrammarDocument>
Parameters:
other - the grammar implementation to compare with.
Returns:
true if the grammar implementations are equal.

getGrammar

public GrammarDocument getGrammar()
Retrieves the grammar object.

Specified by:
getGrammar in interface GrammarImplementation<GrammarDocument>
Returns:
the grammar.

getMediaType

public GrammarType getMediaType()
Returns the declared media type of the external grammar.

Specified by:
getMediaType in interface GrammarImplementation<GrammarDocument>
Returns:
The media type of the grammar file.

getModeType

public ModeType getModeType()
Returns the mode type of the grammar.

Specified by:
getModeType in interface GrammarImplementation<GrammarDocument>
Returns:
mode type of the grammar.


Copyright © 2005-2010JVoiceXML group.