|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.ObjectDFA
public class DFA
Java implementation of deterministic finite state automata.
A trap state is implicit; that is, any unspecified transition is treated as ending in a trap state from which there is no exit.
The transition function is represented as a Map of Maps. The outer map associates a state with its state-specific transition function subset (a transition table row) which is itself represented as a mapping from input symbol to destination state.
Note that unspecified cases have undefined results.
| Constructor Summary | |
|---|---|
DFA(Set<State> states,
Set<String> alphabet,
Map<State,Map<String,State>> transition,
State start,
Set<State> accept)
Fully parameterized constructor for DFA objects. |
|
| Method Summary | |
|---|---|
boolean |
accepts(String input)
Determines whether given string is accepted or rejected by this DFA. |
Set<State> |
acceptStates()
Retrieves the set of accept states. |
Set<String> |
alphabet()
Retrieves the alphabet of this DFA. |
State |
initialState()
Retrieves the initial state of this DFA, if any. |
State |
nextState(State source,
String input)
Lookup transition for specified state and input. |
Set<State> |
states()
Retrieves the set of all states. |
Map<State,Map<String,State>> |
transitionFunction()
Retrieves the transition function of this DFA. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DFA(Set<State> states,
Set<String> alphabet,
Map<State,Map<String,State>> transition,
State start,
Set<State> accept)
states - the set of states of this DFAalphabet - the alphabet of this DFAtransition - the transition function of this DFAstart - the start state of this DFAaccept - the set of accept states of this DFA| Method Detail |
|---|
public boolean accepts(String input)
input - the input string; allows both "" and null to indicate the empty string ε
public Set<State> acceptStates()
public Set<String> alphabet()
public State initialState()
public State nextState(State source,
String input)
source - the source stateinput - the input symbol
public Set<State> states()
public Map<State,Map<String,State>> transitionFunction()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||