public class IlrBRLParserManager extends java.lang.Object implements IlrBRLParserService, ilog.rules.brl.parsing.IlrBRLParserServiceExtension
IlrBRLParserManager is used to create a BRL parser manager.
This parser manager depends on a vocabulary manager instance in order to:
IlrBRLParserService interface. It
provides methods for parsing a BRL input.| Constructor and Description |
|---|
IlrBRLParserManager(IlrVocabulary vocabulary)
Creates a BRL parser manager that can be used with a unique immutable vocabulary.
|
IlrBRLParserManager(IlrVocabularyManager vocabularyManager)
Creates a BRL parser manager.
|
IlrBRLParserManager(IlrVocabularyManager vocabularyManager,
java.lang.Object lock)
Creates a BRL parser manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
This method should be called when the parser manager is not useful anymore.
|
IlrBRLDefinition |
getDefinition(java.lang.String definitionName,
java.util.Locale locale)
This method returns the BRL Definition associated to the given language and the given locale.
|
IlrBRLGrammarGeneratorErrorReporter |
getGrammarGeneratorErrorReporter()
Returns the grammar generator error reporter.
|
java.lang.Object |
getSyncLock()
Returns the mutex used to synchronize manipulation of the
parsers managed by this parser manager.
|
IlrVocabulary |
getVocabulary(IlrBRLDefinition definition,
java.util.Locale locale)
This method returns the vocabulary of the parser managed by this parser manager
corresponding to the given language and the given locale.
|
IlrVocabulary |
getVocabulary(java.util.Locale locale)
Deprecated.
use getVocabulary(IlrBRLDefinition definition, Locale locale)
|
IlrVocabularyManager |
getVocabularyManager()
This method returns the vocabulary manager associated to this parser
manager.
|
boolean |
isLexicalCheckerEnabled()
Returns
true if the lexical checker is enabled. |
IlrSyntaxTree |
parse(IlrBRLParserInput input,
IlrBRLParserConfiguration configuration)
Deprecated.
use parse(rule, configuration, predictionConfiguration)
|
IlrSyntaxTree |
parse(IlrBRLParserInput input,
IlrBRLParserConfigurationDef configuration,
IlrBRLPredictionConfigurationDef predictionConfiguration)
Parse a BRL input to retrieve a representation of this input as a syntax tree.
|
void |
setGrammarGeneratorErrorReporter(IlrBRLGrammarGeneratorErrorReporter grammarGeneratorErrorReporter)
Sets the grammar generator error reporter that will handle grammar
generator errors.
|
void |
setLexicalCheckerEnabled(boolean lexicalChecker)
Enables or disables the lexical checker.
|
public IlrBRLParserManager(IlrVocabulary vocabulary)
The parser manager is created from the given vocabulary. The parser manager created by this constructor can only be used for the Locale of this vocabulary and becomes invalid when this vocabulary is changed. If a multi-locale support is required or if the vocabulary can be changed, use the other constructors of this class.
vocabulary - a non-null Vocabulary objectpublic IlrBRLParserManager(IlrVocabularyManager vocabularyManager)
The parser manager depends on a vocabulary manager able to return a vocabulary from a locale and provide notification when a vocabulary has been modified. A parser manager is able to create and retrieve BRL parsers.
vocabularyManager - The vocabulary manager.IlrVocabularyManagerpublic IlrBRLParserManager(IlrVocabularyManager vocabularyManager, java.lang.Object lock)
The parser manager depends on a vocabulary manager able to return a vocabulary from a locale and provide notification when a vocabulary has been modified. A parser manager is able to create and retrieve BRL parsers. A lock can be passed to this parser manager. If null the parser itself will be used to control MT access to the parsing session.
vocabularyManager - The vocabulary manager.lock - A preferred lock object used to synchronize manipulations of the
parsers.IlrVocabularyManagerpublic IlrVocabularyManager getVocabularyManager()
public IlrVocabulary getVocabulary(IlrBRLDefinition definition, java.util.Locale locale)
getVocabulary in interface IlrBRLParserServicedefinition - the languagelocale - the localepublic IlrVocabulary getVocabulary(java.util.Locale locale)
getVocabulary in interface IlrBRLParserjava.lang.IllegalArgumentExceptionlocale - The locale to check.public boolean isLexicalCheckerEnabled()
true if the lexical checker is enabled.true Lexical checker is enabled.public void setLexicalCheckerEnabled(boolean lexicalChecker)
The lexical checker can detect conflict in generated grammar that may generate erroneous lexical interpretations during interpretation of rules. Errors are reported by the grammar generator error reporter.
lexicalChecker - IlrBRLGrammarGeneratorErrorReporterpublic IlrBRLGrammarGeneratorErrorReporter getGrammarGeneratorErrorReporter()
public void setGrammarGeneratorErrorReporter(IlrBRLGrammarGeneratorErrorReporter grammarGeneratorErrorReporter)
grammarGeneratorErrorReporter - The grammar generator error reporter.IlrBRLGrammarGeneratorErrorpublic IlrBRLDefinition getDefinition(java.lang.String definitionName, java.util.Locale locale)
definitionName - locale - public IlrSyntaxTree parse(IlrBRLParserInput input, IlrBRLParserConfiguration configuration)
The rule is parsed according to the BRL parser configuration given as an
argument (configuration).
input - The rule to parse.configuration - The configuration of parser to parse the rule.IlrSyntaxTree,
IlrBRLParserConfigurationpublic IlrSyntaxTree parse(IlrBRLParserInput input, IlrBRLParserConfigurationDef configuration, IlrBRLPredictionConfigurationDef predictionConfiguration)
The input is parsed according to the BRL parser configuration and the prediction configuration given as arguments.
parse in interface IlrBRLParserinput - The BRL input to parse.configuration - The configuration of parser to parse the input.predictionConfiguration - The prediction configuration of parser to use this method to compute predictions. This argument can be null.IlrSyntaxTree,
IlrBRLParserInput,
IlrBRLParserConfigurationDef,
IlrBRLPredictionConfigurationDefpublic void dispose()
public java.lang.Object getSyncLock()
© Copyright IBM Corp. 1987, 2017