public final class BasicCommandFactory extends Object implements CommandFactory
Constructor and Description |
---|
BasicCommandFactory() |
Modifier and Type | Method and Description |
---|---|
Command |
create(String commandKeyword)
Create a Command that starts with the keyword.
|
Factory |
getFactory() |
void |
registerCommandAnalyzer(String keyword,
CommandAnalyzer analyzer)
Register a new command analyzer that the factory will use to analyze a
line.
|
void |
setFactory(Factory factory)
When a factory creates an instance of a class implementing this interface
this method is called to register the factory that created the instance.
|
public Factory getFactory()
public void setFactory(Factory factory)
FactoryManaged
setFactory
in interface FactoryManaged
factory
- the factory that manages the instance.public void registerCommandAnalyzer(String keyword, CommandAnalyzer analyzer)
CommandFactory
keyword
.registerCommandAnalyzer
in interface CommandFactory
keyword
- the keyword the line should start when this command is to be
analyzed or null
if this analyzer analyzes a line that
does not start with a specific keywordanalyzer
- the command analyzer for the specific keywordpublic Command create(String commandKeyword) throws AnalysisException
CommandFactory
create
in interface CommandFactory
commandKeyword
- the command keyword lexeme or null
in case the command
does not start with a keyword (e.g. procedure call or
assignment)AnalysisException
- is there is a lexical or syntax exception
if there is some error with the command factory itself and it
can not analyze the line and does not know what the error is.
(probably the syntax of the line is totally wrong)Copyright © 2013 Verhas and Verhas Software Craftsmen. All Rights Reserved.