org.apache.directory.shared.asn1.ber.grammar
Class AbstractGrammar<E extends Asn1Container>

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

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

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

Author:
Apache Directory Project

Field Summary
protected  GrammarTransition<E>[][] transitions
          Table of transitions.
 
Constructor Summary
AbstractGrammar()
          Default constructor
 
Method Summary
 void executeAction(E container)
          The main function.
 String getName()
          Return the grammar's name
 GrammarTransition<E> 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<E extends Asn1Container>[][] 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.

Constructor Detail

AbstractGrammar

public AbstractGrammar()
Default constructor

Method Detail

getName

public String getName()
Return the grammar's name

Specified by:
getName in interface Grammar<E extends Asn1Container>
Returns:
The grammar name

setName

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

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

getTransition

public GrammarTransition<E> 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(E container)
                   throws DecoderException
The main function. This is where an action is executed. If the action is null, nothing is done.

Specified by:
executeAction in interface Grammar<E extends Asn1Container>
Parameters:
container - The Asn1Container
Throws:
DecoderException - Thrown if anything went wrong


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