org.jvoicexml.interpreter.grammar
Class GrammarIdentifierCentral

java.lang.Object
  extended by org.jvoicexml.interpreter.grammar.GrammarIdentifierCentral

public final class GrammarIdentifierCentral
extends Object

The GrammarIdentifierCentral takes control over the process of identifying a grammar. It provides some convenience methods as an entry point for the identification.

Version:
$Revision: 2580 $
Author:
Christoph Buente, Dirk Schnelle-Walka

Constructor Summary
GrammarIdentifierCentral()
          Constructs a new object.
 
Method Summary
 void addIdentifier(GrammarIdentifier id)
          Adds the given grammar identifier.
protected  List<GrammarIdentifier> getAvailableIdentifier(GrammarType type)
          Returns a List of identifiers, that have been registered and are supporting the given type.
 GrammarType identifyGrammar(GrammarDocument grammar, GrammarType expectedType)
          Identifies the given grammar.
 void setIdentifier(List<GrammarIdentifier> grammarIdenifier)
          Adds the given list of idententifiers.
 boolean typeSupported(GrammarType type)
          Checks whether the given type is supported by one of the registered identifiers or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarIdentifierCentral

public GrammarIdentifierCentral()
Constructs a new object.

Method Detail

identifyGrammar

public GrammarType identifyGrammar(GrammarDocument grammar,
                                   GrammarType expectedType)
                            throws UnsupportedFormatError
Identifies the given grammar. If the grammar could not be identified an UnsupportedFormatError is thrown.

Parameters:
grammar - The given grammar which will be identified.
expectedType - the expected grammar type
Returns:
The actual type of the grammar.
Throws:
UnsupportedFormatError - If no identifier is able to identify this grammar.

getAvailableIdentifier

protected List<GrammarIdentifier> getAvailableIdentifier(GrammarType type)
Returns a List of identifiers, that have been registered and are supporting the given type.

Parameters:
type - Required type.
Returns:
List List of available identifiers.

typeSupported

public boolean typeSupported(GrammarType type)
Checks whether the given type is supported by one of the registered identifiers or not. Returns true if type is supported, else false

Parameters:
type - String representing the type
Returns:
boolean true if type is supported, else false.

setIdentifier

public void setIdentifier(List<GrammarIdentifier> grammarIdenifier)
Adds the given list of idententifiers.

Parameters:
grammarIdenifier - List with identifiers to add.
Since:
0.5

addIdentifier

public void addIdentifier(GrammarIdentifier id)
Adds the given grammar identifier.

Parameters:
id - The GrammarIdentifier to add.


Copyright © 2005-2010JVoiceXML group.