org.apache.directory.api.dsmlv2
Class AbstractGrammar

java.lang.Object
  extended by 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
protected  String name
          The grammar name
protected  Enum<Dsmlv2StatesEnum>[] statesEnum
          The grammar's states
protected  HashMap<Tag,GrammarTransition>[] transitions
          Table of transitions.
 
Constructor Summary
AbstractGrammar()
           
 
Method Summary
 void executeAction(Dsmlv2Container container)
          This method, when called, executes an action on the current data stored in the container.
 String getName()
          Returns the grammar's name
 Enum<Dsmlv2StatesEnum>[] getStatesEnum()
          Gets the states of the current grammar
 GrammarTransition getTransition(Enum<Dsmlv2StatesEnum> state, Tag tag)
          Gets the transition associated with the state and tag
 void setName(String name)
          Sets the grammar's name
 void setStatesEnum(Enum<Dsmlv2StatesEnum>[] statesEnum)
          Set the states for this grammar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


statesEnum

protected Enum<Dsmlv2StatesEnum>[] statesEnum
The grammar's states

Constructor Detail

AbstractGrammar

public AbstractGrammar()
Method Detail

getName

public String getName()
Returns the grammar's name

Specified by:
getName in interface Grammar
Returns:
The grammar name

setName

public void setName(String name)
Sets the grammar's name

Specified by:
setName in interface Grammar
Parameters:
name - the name to set

getTransition

public GrammarTransition getTransition(Enum<Dsmlv2StatesEnum> state,
                                       Tag tag)
Gets the transition associated with the state and tag

Parameters:
state - The current state
tag - 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:
getStatesEnum in interface Grammar
Returns:
Returns the statesEnum.

setStatesEnum

public void setStatesEnum(Enum<Dsmlv2StatesEnum>[] statesEnum)
Set the states for this grammar

Parameters:
statesEnum - The statesEnum to set.

executeAction

public void executeAction(Dsmlv2Container container)
                   throws org.xmlpull.v1.XmlPullParserException,
                          IOException
This method, when called, executes an action on the current data stored in the container.

Specified by:
executeAction in interface Grammar
Parameters:
container - the DSML container
Throws:
org.xmlpull.v1.XmlPullParserException - when an unrecoverable error occurs
IOException - when an IO error occurs


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.