fr.umlv.tatoo.runtime.regex
Class CharRegexTable

java.lang.Object
  extended by fr.umlv.tatoo.runtime.regex.CharRegexTable
All Implemented Interfaces:
RegexTable

public class CharRegexTable
extends Object
implements RegexTable

A RegexTable implementation for DFA which uses all unicode characters. Transitions are represented coding characters intervals using arrays: if the array is {a,b,c,d}, it means to from character a to c, DFA goes to state b; from character c to '￿', DFA goes to d. Going to state -1 means no transition.

Author:
Julien

Constructor Summary
CharRegexTable(int firstState, int[][] transitions, boolean[] accepts)
          Build a RegexTable with firstState as first state, transitions as transition table as explained in CharRegexTable, and accepts which gives accepting states
 
Method Summary
 boolean accept(int i)
          Tests if the state is or not an accept state.
 int getStart()
          Returns the index of the start state.
 int getStateNumber()
          Returns the number of state of the whole automaton.
 int getTransition(int state, int next)
          Returns the index of the following state from the state state with the letter next.
 boolean noOut(int currentState)
          Returns if the state pass as srgument is a sink state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharRegexTable

public CharRegexTable(int firstState,
                      int[][] transitions,
                      boolean[] accepts)
Build a RegexTable with firstState as first state, transitions as transition table as explained in CharRegexTable, and accepts which gives accepting states

Parameters:
firstState - the first state
transitions - transition table as explained in CharRegexTable
accepts - accepting states
Method Detail

accept

public boolean accept(int i)
Description copied from interface: RegexTable
Tests if the state is or not an accept state.

Specified by:
accept in interface RegexTable
Parameters:
i - the state
Returns:
true if the state is an accept state

getStart

public int getStart()
Description copied from interface: RegexTable
Returns the index of the start state.

Specified by:
getStart in interface RegexTable
Returns:
the index of the start state.

getStateNumber

public int getStateNumber()
Description copied from interface: RegexTable
Returns the number of state of the whole automaton.

Specified by:
getStateNumber in interface RegexTable
Returns:
the number of state of the whole automaton.

getTransition

public int getTransition(int state,
                         int next)
Description copied from interface: RegexTable
Returns the index of the following state from the state state with the letter next.

Specified by:
getTransition in interface RegexTable
Parameters:
state - previous state
next - letter to read
Returns:
next state or -1 if undefined

noOut

public boolean noOut(int currentState)
Description copied from interface: RegexTable
Returns if the state pass as srgument is a sink state.

Specified by:
noOut in interface RegexTable
Parameters:
currentState - the state
Returns:
true if state is a sink state