|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.mff.ksi.jinfer.base.automaton.Automaton<T>
public class Automaton<T>
Class representing deterministic finite automaton. Can simplify itself when given mergingCondition Automaton can be non-deterministic for algorithmic reasons. Of course, there is no constraint that each state has to have transition on each symbol. But what more, there can be multiple transitions from one step on same symbol, pointing to different states (real non-determinism) or to same state (just non-canonical form). When merging occurs, this deviations can appear. Non-canonical form, when there are two-or-more steps on same symbol between two states, is solved (and collapsed to only one step) automatically by merging procedure. Non-deterministic form is not solved by automaton itself. The merging algorithm has to deal with this opportunity is it gives bad order of merging states. But it can let it non-deterministic by design.
Field Summary | |
---|---|
protected Map<State<T>,Set<Step<T>>> |
delta
Transition function of automaton. |
protected State<T> |
initialState
Initial state of automaton, entry point. |
protected Map<State<T>,State<T>> |
mergedStates
Merged states - when state X is merged into state Y, we say, X is being merged out (from automaton). |
protected Map<Integer,State<T>> |
nameMap
TODO anti comment |
protected int |
newStateName
New state name is an integer that is assigned to any new state created by createNewState. |
protected Map<State<T>,Set<Step<T>>> |
reverseDelta
Transition function of automaton, mathematically the same as delta. |
protected Map<State<T>,Set<State<T>>> |
reverseMergedStates
As in mergedStates, but in opposing direction. |
Constructor Summary | |
---|---|
Automaton()
Constructor which doesn't create initialState |
|
Automaton(Automaton<T> anotherAutomaton)
|
|
Automaton(boolean createInitialState)
|
Method Summary | |
---|---|
void |
buildPTAOnRegexp(Regexp<T> regexp)
|
void |
buildPTAOnSymbol(List<T> symbolString)
Given symbolString, iterates through it and follows steps in automaton. |
protected State<T> |
createNewState()
Creates new state and return it. |
Map<State<T>,Set<Step<T>>> |
getDelta()
|
State<T> |
getInitialState()
|
Map<State<T>,State<T>> |
getMergedStates()
|
protected Integer |
getNewStateName()
|
Step<T> |
getOutStepOnSymbol(State<T> state,
T symbol)
Returns first step from state, which accepts given symbol. |
protected State<T> |
getRealState(State<T> state)
|
Map<State<T>,Set<Step<T>>> |
getReverseDelta()
|
Map<State<T>,Set<State<T>>> |
getReverseMergedStates()
|
void |
mergeStates(List<State<T>> lst)
|
void |
mergeStates(State<T> _mainState,
State<T> _mergedState)
|
String |
toString()
|
String |
toTestString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected State<T> initialState
protected final Map<State<T>,Set<Step<T>>> delta
protected final Map<State<T>,Set<Step<T>>> reverseDelta
protected int newStateName
protected final Map<State<T>,State<T>> mergedStates
protected final Map<State<T>,Set<State<T>>> reverseMergedStates
protected final Map<Integer,State<T>> nameMap
Constructor Detail |
---|
public Automaton()
public Automaton(boolean createInitialState)
createInitialState
- - true= create initial state, false- as default constructorpublic Automaton(Automaton<T> anotherAutomaton)
Method Detail |
---|
protected final State<T> createNewState()
public Step<T> getOutStepOnSymbol(State<T> state, T symbol)
state
- symbol
-
public void buildPTAOnSymbol(List<T> symbolString)
symbolString
- - list of symbols (one word from accepting language)public void buildPTAOnRegexp(Regexp<T> regexp)
protected State<T> getRealState(State<T> state)
public void mergeStates(List<State<T>> lst)
public void mergeStates(State<T> _mainState, State<T> _mergedState)
public String toString()
toString
in class Object
public String toTestString()
public State<T> getInitialState()
public Map<State<T>,Set<Step<T>>> getDelta()
public Map<State<T>,Set<Step<T>>> getReverseDelta()
protected Integer getNewStateName()
public Map<State<T>,State<T>> getMergedStates()
public Map<State<T>,Set<State<T>>> getReverseMergedStates()
|
jInfer | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |