Package org.apache.directory.api.dsmlv2
Class AbstractGrammar
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.AbstractGrammar
-
- All Implemented Interfaces:
Grammar
- Direct Known Subclasses:
Dsmlv2Grammar,Dsmlv2ResponseGrammar
public abstract class AbstractGrammar extends Object implements Grammar
The abstract Grammar which is the Mother of all the grammars. It contains the transitions table.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description protected StringnameThe grammar nameprotected HashMap<Tag,GrammarTransition>[]transitionsTable of transitions.
-
Constructor Summary
Constructors Constructor Description AbstractGrammar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecuteAction(Dsmlv2Container container)This method, when called, executes an action on the current data stored in the container.StringgetName()Returns the grammar's nameEnum<Dsmlv2StatesEnum>[]getStatesEnum()Gets the states of the current grammarGrammarTransitiongetTransition(Enum<Dsmlv2StatesEnum> state, Tag tag)Gets the transition associated with the state and tagvoidsetName(String name)Sets the grammar's name
-
-
-
Field Detail
-
transitions
protected HashMap<Tag,GrammarTransition>[] transitions
Table of transitions. It's a two dimension array, the first dimension indexes the states, the second dimension indexes the Tag value, so it is 256 wide.
-
name
protected String name
The grammar name
-
-
Method Detail
-
getName
public String getName()
Returns the grammar's name
-
setName
public void setName(String name)
Sets the grammar's name
-
getTransition
public GrammarTransition getTransition(Enum<Dsmlv2StatesEnum> state, Tag tag)
Gets the transition associated with the state and tag- Parameters:
state- The current statetag- The current tag- Returns:
- A valid transition if any, or null.
-
getStatesEnum
public Enum<Dsmlv2StatesEnum>[] getStatesEnum()
Gets the states of the current grammar- Specified by:
getStatesEnumin interfaceGrammar- Returns:
- Returns the statesEnum.
-
executeAction
public void executeAction(Dsmlv2Container container) throws XmlPullParserException, IOException
This method, when called, executes an action on the current data stored in the container.- Specified by:
executeActionin interfaceGrammar- Parameters:
container- the DSML container- Throws:
XmlPullParserException- when an unrecoverable error occursIOException- when an IO error occurs
-
-