org.apache.directory.shared.dsmlv2
Class AbstractGrammar

java.lang.Object
  extended by org.apache.directory.shared.dsmlv2.AbstractGrammar
All Implemented Interfaces:
IGrammar
Direct Known Subclasses:
Dsmlv2Grammar, Dsmlv2ResponseGrammar

public abstract class AbstractGrammar
extends java.lang.Object
implements IGrammar

The abstract IGrammar which is the Mother of all the grammars. It contains the transitions table.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
protected  java.lang.String name
          The grammar name
protected  IStates statesEnum
          The grammar's states
protected  java.util.HashMap<Tag,GrammarTransition>[] transitions
          Table of transitions.
 
Constructor Summary
AbstractGrammar()
           
 
Method Summary
 void executeAction(Dsmlv2Container container)
          This method, when called, execute an action on the current data stored in the container.
 java.lang.String getName()
          Return the grammar's name
 IStates getStatesEnum()
          Get the states of the current grammar
 GrammarTransition getTransition(int state, Tag tag)
          Get the transition associated with the state and tag
 void setName(java.lang.String name)
          Set the grammar's name
 void setStatesEnum(IStates 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 java.util.HashMap<Tag,GrammarTransition>[] transitions
Table of transitions. It's a two dimension array, the first dimension indice the states, the second dimension indices the Tag value, so it is 256 wide.


name

protected java.lang.String name
The grammar name


statesEnum

protected IStates statesEnum
The grammar's states

Constructor Detail

AbstractGrammar

public AbstractGrammar()
Method Detail

getName

public java.lang.String getName()
Return the grammar's name

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

setName

public void setName(java.lang.String name)
Set the grammar's name

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

getTransition

public GrammarTransition getTransition(int state,
                                       Tag tag)
Get 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 IStates getStatesEnum()
Get the states of the current grammar

Specified by:
getStatesEnum in interface IGrammar
Returns:
Returns the statesEnum.

setStatesEnum

public void setStatesEnum(IStates statesEnum)
Set the states for this grammar

Parameters:
statesEnum - The statesEnum to set.

executeAction

public void executeAction(Dsmlv2Container container)
                   throws org.xmlpull.v1.XmlPullParserException,
                          java.io.IOException
Description copied from interface: IGrammar
This method, when called, execute an action on the current data stored in the container.

Specified by:
executeAction in interface IGrammar
Parameters:
container - the DSML container
Throws:
org.xmlpull.v1.XmlPullParserException - Thrown when an unrecoverable error occurs.
java.io.IOException


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.