Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 states;

private Set finalstate;

private HashMap mapState;

private NFAState startState;

private Set alphabet;

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 getStates() {

return states;

}

@Override

public Set getFinalStates() {

return finalstate;

}

@Override

public State getStartState() {

return startState;

}

@Override

public Set getABC() {

return alphabet;

}

@Override

public Set getToState(NFAState from, char onSymb) {

return (Set) from.getState(onSymb);

}

@Override

public Set eClosure(NFAState s) {

// TODO Auto-generated method stub

return null;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Factory Active Database For Enterprise Computing

Authors: Schur, Stephen

1st Edition

0471558443, 9780471558446

More Books

Students also viewed these Databases questions