|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgate.fsm.FSM
public class FSM
This class implements a standard Finite State Machine. It is used for both deterministic and non-deterministic machines.
Field Summary | |
---|---|
protected State |
currentState
Two members used by forEachState(). |
protected Transition |
currentTransition
|
protected State |
finalState
The final state of this FSM (usually only valid during construction). |
HashMap<String,String> |
ruleHash
|
Fields inherited from interface gate.jape.JapeConstants |
---|
ALL_STYLE, APPELT_STYLE, BRILL_STYLE, DEFAULT_PRIORITY, FIRST_STYLE, INDENT_PADDING, KLEENE_PLUS, KLEENE_QUERY, KLEENE_STAR, MULTI_SPAN_BINDING, NO_BINDING, NO_KLEENE_OP, ONCE_STYLE, SINGLE_SPAN_BINDING |
Constructor Summary | |
---|---|
protected |
FSM()
The constructor that all the other constructors should call. |
protected |
FSM(ComplexPatternElement cpe)
Builds a FSM starting from a ComplexPatternElement. |
|
FSM(Rule rule)
Builds a FSM starting from a rule. |
|
FSM(SinglePhaseTransducer spt)
Builds a standalone FSM starting from a single phase transducer. |
Method Summary | |
---|---|
protected void |
addRules(PrioritisedRuleList rules)
Do the work involved in creating an FSM from a PrioritisedRuleList. |
String |
asGraphViz(boolean includeConstraints)
Returns a representation of this FSM in the GraphViz graph-visualization language. |
void |
eliminateVoidTransitions()
Converts this FSM from a non-deterministic to a deterministic one by eliminating all the unrestricted transitions. |
protected void |
forEachState(Runnable r)
Iterates over all the states in this FSM, setting currentState and currentTransition, then calling the given Runnable callback. |
Map<State,SimpleArraySet<Transition>> |
getAllStates()
|
String |
getGML()
Returns a GML (Graph Modelling Language) representation of the transition graph of this FSM. |
State |
getInitialState()
Gets the initial state of this FSM |
ArrayList<RuleTime> |
getRuleTimes()
|
protected void |
setRule(Rule rule)
Do the work involved in creating an FSM from a Rule. |
protected FSM |
spawn(ComplexPatternElement currentPattern)
A factory method for new FSMs like this one, given a ComplexPatternElement object. |
protected FSM |
spawn(Rule r)
A factory method for new FSMs like this one, given a Rule object. |
String |
toString()
Returns a textual description of this FSM. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected State currentState
protected Transition currentTransition
protected State finalState
public HashMap<String,String> ruleHash
Constructor Detail |
---|
protected FSM()
public FSM(SinglePhaseTransducer spt)
spt
- the single phase transducer to be used for building this FSM.public FSM(Rule rule)
rule
- the rule to be used for the building process.protected FSM(ComplexPatternElement cpe)
cpe
- the ComplexPatternElement to be used for the building process.Method Detail |
---|
public ArrayList<RuleTime> getRuleTimes()
protected void addRules(PrioritisedRuleList rules)
protected void setRule(Rule rule)
protected FSM spawn(Rule r)
protected FSM spawn(ComplexPatternElement currentPattern)
public State getInitialState()
public void eliminateVoidTransitions()
protected void forEachState(Runnable r)
public Map<State,SimpleArraySet<Transition>> getAllStates()
public String asGraphViz(boolean includeConstraints)
includeConstraints
- whether to include a stringified representation of each transition
object as part of its label. The default is false.public String getGML()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |