org.apache.directory.api.asn1.ber.grammar
Class AbstractGrammar<C extends Asn1Container>

java.lang.Object
  extended by org.apache.directory.api.asn1.ber.grammar.AbstractGrammar<C>
All Implemented Interfaces:
Grammar<C>

public abstract class AbstractGrammar<C extends Asn1Container>
extends Object
implements Grammar<C>

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

Author:
Apache Directory Project

Field Summary
protected  GrammarTransition<C>[][] transitions
          Table of transitions.
 
Constructor Summary
AbstractGrammar()
          Default constructor
 
Method Summary
 void executeAction(C container)
          This method, when called, execute an action on the current data stored in the container.
 String getName()
          Get the grammar name
 GrammarTransition<C> getTransition(Enum<?> state, int tag)
          Get the transition associated with the state and tag
 void setName(String name)
          Set the grammar's name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transitions

protected GrammarTransition<C extends Asn1Container>[][] transitions
Table of transitions. It's a two dimension array, the first dimension indices the states, the second dimension indices the Tag value, so it is 256 wide.

Constructor Detail

AbstractGrammar

public AbstractGrammar()
Default constructor

Method Detail

getName

public String getName()
Get the grammar name

Specified by:
getName in interface Grammar<C extends Asn1Container>
Returns:
Return the grammar's name

setName

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

Specified by:
setName in interface Grammar<C extends Asn1Container>
Parameters:
name - The grammar name

getTransition

public GrammarTransition<C> getTransition(Enum<?> 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(C container)
                   throws org.apache.directory.api.asn1.DecoderException
This method, when called, execute an action on the current data stored in the container.

Specified by:
executeAction in interface Grammar<C extends Asn1Container>
Parameters:
container - Store the data being processed.
Throws:
org.apache.directory.api.asn1.DecoderException - Thrown when an unrecoverable error occurs.


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