org.apache.directory.shared.asn1.ber.grammar
Class AbstractGrammar

java.lang.Object
  extended by org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar
All Implemented Interfaces:
IGrammar
Direct Known Subclasses:
EntryChangeControlGrammar, GracefulDisconnectGrammar, GracefulShutdownGrammar, LdapMessageGrammar, PSearchControlGrammar, SubEntryControlGrammar

public abstract class AbstractGrammar
extends Object
implements IGrammar

The abstract IGrammar 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  IStates statesEnum
          The grammar's states
protected  GrammarTransition[][] transitions
          Table of transitions.
 
Constructor Summary
AbstractGrammar()
          Default constructor
 
Method Summary
 void executeAction(IAsn1Container container)
          The main function.
 String getName()
          Return the grammar's name
 IStates getStatesEnum()
          Get the states of the current grammar
 GrammarTransition getTransition(int state, int tag)
          Get the transition associated with the state and tag
 void setName(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 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 String name
The grammar name


statesEnum

protected IStates statesEnum
The grammar's states

Constructor Detail

AbstractGrammar

public AbstractGrammar()
Default constructor

Method Detail

getName

public String getName()
Return the grammar's name

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

setName

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

Specified by:
setName in interface IGrammar
Parameters:
name - The new grammar name

getTransition

public GrammarTransition getTransition(int state,
                                       int 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.

executeAction

public void executeAction(IAsn1Container container)
                   throws DecoderException,
                          NamingException
The main function. This is where an action is executed. If the action is null, nothing is done.

Specified by:
executeAction in interface IGrammar
Parameters:
container - The Asn1Container
Throws:
DecoderException - Thrown if anything went wrong
NamingException

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.


Copyright © 2004-2012. All Rights Reserved.