gate.creole.tokeniser
Class DFSMState

java.lang.Object
  |
  +--gate.creole.tokeniser.DFSMState
All Implemented Interfaces:
Serializable

class DFSMState
extends Object
implements Serializable

Implements a state of the deterministic finite state machine of the tokeniser. It differs from FSMState by the definition of the transition function which in this case maps character types to other states as oposed to the transition function from FSMState which maps character types to sets of states, hence the nondeterministic character. FSMState


Field Summary
private static boolean DEBUG
          Debug flag
(package private) static int index
          Used to generate unique indices for all the objects of this class
(package private)  int myIndex
          The unique index of this state
(package private)  String rhs
          The string of the RHS of the rule from which the token description is built
(package private)  String[][] tokenDesc
          A table of strings describing an annotation.
(package private)  DFSMState[] transitionFunction
          The transition function of this state.
 
Constructor Summary
DFSMState(SimpleTokeniser owner)
          Constructs a new DFSMState object and adds it to the list of deterministic states of the DefaultTokeniser provided as owner.
 
Method Summary
(package private)  void buildTokenDesc()
          Builds the token description for the token that will be generated when this final state will be reached and the action associated with it will be fired.
(package private)  String getEdgesGML()
          Returns a GML (Graph Modelling Language) representation of the edges emerging from this state
(package private)  int getIndex()
          Returns the unique ID of this state.
(package private)  String getRhs()
          Returns the RHS string
(package private)  String[][] getTokenDesc()
          Returns the token description associated with this state.
(package private)  boolean isFinal()
          Checks whether this state is a final one
(package private)  DFSMState next(int type)
          This method is used to access the transition function of this state.
(package private)  void put(int index, DFSMState state)
          Adds a new mapping using the actual index in the internal array.
(package private)  void put(UnicodeType type, DFSMState state)
          Adds a new mapping in the transition function of this state
(package private)  void setRhs(String rhs)
          Sets the right hand side associated with this state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag

See Also:
Constant Field Values

tokenDesc

String[][] tokenDesc
A table of strings describing an annotation. The first line of the table contains the annotation type on the first position and nothing on the second. Each line after the first one contains a attribute on the first position and its associated value on the second.


transitionFunction

DFSMState[] transitionFunction
The transition function of this state.


rhs

String rhs
The string of the RHS of the rule from which the token description is built


myIndex

int myIndex
The unique index of this state


index

static int index
Used to generate unique indices for all the objects of this class

Constructor Detail

DFSMState

public DFSMState(SimpleTokeniser owner)
Constructs a new DFSMState object and adds it to the list of deterministic states of the DefaultTokeniser provided as owner.

Parameters:
owner - a DefaultTokeniser object
Method Detail

put

void put(UnicodeType type,
         DFSMState state)
Adds a new mapping in the transition function of this state

Parameters:
type - the UnicodeType for this mapping

put

void put(int index,
         DFSMState state)
Adds a new mapping using the actual index in the internal array. This method is for internal use only. Use put(gate.creole.tokeniser.UnicodeType, gate.creole.tokeniser.DFSMState) instead.


next

DFSMState next(int type)
This method is used to access the transition function of this state.

Parameters:
type - the Unicode type identifier as the corresponding static value on Character

getEdgesGML

String getEdgesGML()
Returns a GML (Graph Modelling Language) representation of the edges emerging from this state


buildTokenDesc

void buildTokenDesc()
              throws TokeniserException
Builds the token description for the token that will be generated when this final state will be reached and the action associated with it will be fired. See also setRhs(String).

TokeniserException

setRhs

void setRhs(String rhs)
Sets the right hand side associated with this state. The RHS is represented as a string value that will be parsed by the buildTokenDesc() method being converted in a table of strings with 2 columns and as many lines as necessary.

Parameters:
rhs - the RHS string

getRhs

String getRhs()
Returns the RHS string


isFinal

boolean isFinal()
Checks whether this state is a final one


getIndex

int getIndex()
Returns the unique ID of this state.


getTokenDesc

String[][] getTokenDesc()
Returns the token description associated with this state. This description is built by buildTokenDesc() method and consists of a table of strings having two columns. The first line of the table contains the annotation type on the first position and nothing on the second. Each line after the first one contains a attribute on the first position and its associated value on the second.