scanner
Class FinaleStateAutomata

java.lang.Object
  extended byscanner.FinaleStateAutomata

public class FinaleStateAutomata
extends java.lang.Object

This class defines finale state automatas.

See Also:
AutomataDefinition

Constructor Summary
FinaleStateAutomata()
          Constructs a new automata.
FinaleStateAutomata(AutomataDefinition def)
          Creates a new automata from the specified definition.
 
Method Summary
 State getCurrentState()
          Returns the current state of this automata.
 AutomataDefinition getDefinition()
          Returns the definition of this automata.
 java.lang.String getReceivedCharacters()
          Returns a string that representes the list of all characters received by this finale state automata.
 State getStartingState()
          Returns the starting state of this automata.
 Transition getTransitionFor(char character)
          Returns the transition that can be activated from this automata's current state with the specified character.
 void initialize()
          Initializes this state machine.
 void sendChar(char character)
          Sends a character to this automata.
 void setDefinition(AutomataDefinition definition)
          Sets the definition of this automata.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FinaleStateAutomata

public FinaleStateAutomata()
Constructs a new automata.


FinaleStateAutomata

public FinaleStateAutomata(AutomataDefinition def)
Creates a new automata from the specified definition.

Parameters:
def - The definition of states and transitions of this automata.
Method Detail

getDefinition

public AutomataDefinition getDefinition()
Returns the definition of this automata.

Returns:
the definition of this automata.

setDefinition

public void setDefinition(AutomataDefinition definition)
Sets the definition of this automata. Changing the definition of this automata will reinitialize it.

See Also:
initialize()

sendChar

public void sendChar(char character)
              throws NoTransitionFoundException
Sends a character to this automata.

Parameters:
character - The character to be sent to this automata.
Throws:
NoTransitionFoundException

getTransitionFor

public Transition getTransitionFor(char character)
Returns the transition that can be activated from this automata's current state with the specified character.

Parameters:
character - A character.
Returns:
The transition that can be activated from this automata's current state. null is returned if no transition can be activated with this character from the current state.
See Also:
getCurrentState()

getStartingState

public State getStartingState()
Returns the starting state of this automata.

Returns:
The starting state of this automata.

getCurrentState

public State getCurrentState()
Returns the current state of this automata.

Returns:
The current state of this automata.

getReceivedCharacters

public java.lang.String getReceivedCharacters()
Returns a string that representes the list of all characters received by this finale state automata.


initialize

public void initialize()
Initializes this state machine. The current state is back to the starting state and the received characters are initialized to none.


toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
A string representation of this object.