Question
How to convert to a DFA from an NFA and How to find what places you can move with epsilon free move public class NFA
How to convert to a DFA from an NFA and How to find what places you can move with epsilon "free" move
public class NFA implements NFAInterface, FAInterface {
private Set
private Set
private HashMap
private NFAState startState;
private Set
public NFA() {
states = new LinkedHashSet<>();
finalstate = new LinkedHashSet<>();
alphabet = new LinkedHashSet<>();
}
public void addFinalState(String finalStateName) {
NFAState fin = new NFAState(finalStateName);
finalstate.add(fin);
states.add(fin);
}
public void addStartState(String startStateName) {
startState = new NFAState(startStateName);
startState.getName();
states.add(startState);
}
public void addState(String stateName) {
NFAState state = new NFAState(stateName);
states.add(state);
}
public void addTransition(String fromState, char onSymb, String toState) {
NFAState from = getStates(fromState);
NFAState to = getStates(toState);
from.addTrans(onSymb,to);
alphabet.add(onSymb);
}
public NFAState getStates(String Name){
for (NFAState s: states){
if (s.getName() == Name){
return s;
}
}
NFAState s = new NFAState(Name);
return s;
}
public DFA getDFA() {
// TODO Auto-generated method stub
return null;
}
@Override
public Set extends State> getStates() {
return states;
}
@Override
public Set extends State> getFinalStates() {
return finalstate;
}
@Override
public State getStartState() {
return startState;
}
@Override
public Set
return alphabet;
}
@Override
public Set
return (Set
}
@Override
public Set
// TODO Auto-generated method stub
return null;
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started