org.biojava.bio.program.tagvalue
Class StateMachine.BasicState

java.lang.Object
  extended by org.biojava.bio.program.tagvalue.StateMachine.BasicState
All Implemented Interfaces:
StateMachine.State
Enclosing class:
StateMachine

public class StateMachine.BasicState
extends Object
implements StateMachine.State

Implementation of a State in a state machine


Constructor Summary
StateMachine.BasicState(String label)
          This is the default constructor
StateMachine.BasicState(String label, TagValueListener listener)
          when this constructor is used, a fixed listener is used with this state.
 
Method Summary
 String getLabel()
          return the label of this class.
 TagValueListener getListener()
          return the TagValueListener assigned to this State.
 StateMachine.TransitionTable getTransitionTable()
          retrieve the TransitionTable for this State.
 void setDefaultTransitions(StateMachine.TransitionTable defaultTransitions)
          specify fallback TransitionTable for this State
 void setListener(TagValueListener listener)
          set a TagValueListener for this State.
 void setTransition(Object tag, StateMachine.State destination)
          set a Transition for this State setting notifyOnExit to false.
 void setTransition(Object tag, StateMachine.State destination, boolean notifyOnExit)
          set a Transition for this State
 void transit(Object tag)
          Find the destination State when the specified tag is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMachine.BasicState

public StateMachine.BasicState(String label)
This is the default constructor


StateMachine.BasicState

public StateMachine.BasicState(String label,
                               TagValueListener listener)
when this constructor is used, a fixed listener is used with this state. When setListener is called on this class, it is the listener of this fixed listener that is changed.

Method Detail

getLabel

public String getLabel()
return the label of this class.

Specified by:
getLabel in interface StateMachine.State

getListener

public TagValueListener getListener()
return the TagValueListener assigned to this State.

Specified by:
getListener in interface StateMachine.State

setListener

public void setListener(TagValueListener listener)
set a TagValueListener for this State.


setTransition

public void setTransition(Object tag,
                          StateMachine.State destination,
                          boolean notifyOnExit)
                   throws ParserException
set a Transition for this State

Throws:
ParserException

setTransition

public void setTransition(Object tag,
                          StateMachine.State destination)
                   throws ParserException
set a Transition for this State setting notifyOnExit to false.

Throws:
ParserException

getTransitionTable

public StateMachine.TransitionTable getTransitionTable()
retrieve the TransitionTable for this State.


setDefaultTransitions

public void setDefaultTransitions(StateMachine.TransitionTable defaultTransitions)
specify fallback TransitionTable for this State


transit

public void transit(Object tag)
             throws ParserException
Find the destination State when the specified tag is encountered. If the destination is successfully obtained, the listener is also notified of exit if required.

Specified by:
transit in interface StateMachine.State
Throws:
ParserException