concat GEHT
This commit is contained in:
parent
3571f542ff
commit
b879aed6ea
1 changed files with 8 additions and 9 deletions
|
|
@ -3,21 +3,18 @@ package ab1.impl.GRUPPE;
|
||||||
import ab1.FinalizedStateException;
|
import ab1.FinalizedStateException;
|
||||||
import ab1.NFA;
|
import ab1.NFA;
|
||||||
import ab1.Transition;
|
import ab1.Transition;
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class NFAImpl implements NFA {
|
public class NFAImpl implements NFA {
|
||||||
private Set<String> states;
|
private final Set<String> states;
|
||||||
private Set<Transition> transitions;
|
private final Set<Transition> transitions;
|
||||||
|
|
||||||
private String initialState;
|
private final String initialState;
|
||||||
private Set<String> acceptingStates;
|
private final Set<String> acceptingStates;
|
||||||
|
|
||||||
private Set<Character> alphabet;
|
private Set<Character> alphabet;
|
||||||
|
|
||||||
private Set<Character> completeAlphabet;
|
|
||||||
|
|
||||||
private boolean isFinalized;
|
private boolean isFinalized;
|
||||||
|
|
||||||
public NFAImpl(String startState) {
|
public NFAImpl(String startState) {
|
||||||
|
|
@ -27,9 +24,9 @@ public class NFAImpl implements NFA {
|
||||||
this.transitions = new HashSet<>();
|
this.transitions = new HashSet<>();
|
||||||
this.acceptingStates = new HashSet<>();
|
this.acceptingStates = new HashSet<>();
|
||||||
this.alphabet = new HashSet<>();
|
this.alphabet = new HashSet<>();
|
||||||
this.completeAlphabet = new HashSet<>();
|
Set<Character> completeAlphabet = new HashSet<>();
|
||||||
for (char ch = 'a'; ch <= 'z'; ch++) {
|
for (char ch = 'a'; ch <= 'z'; ch++) {
|
||||||
this.completeAlphabet.add(ch);
|
completeAlphabet.add(ch);
|
||||||
}
|
}
|
||||||
this.isFinalized = false;
|
this.isFinalized = false;
|
||||||
|
|
||||||
|
|
@ -40,11 +37,13 @@ public class NFAImpl implements NFA {
|
||||||
return this.states;
|
return this.states;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public void safeAddStates(Set<String> states, Set<String> toCheck, NFAImpl nfa) {
|
public void safeAddStates(Set<String> states, Set<String> toCheck, NFAImpl nfa) {
|
||||||
for (String state : states) {
|
for (String state : states) {
|
||||||
nfa.states.add(changeIfNecessary(state, toCheck));
|
nfa.states.add(changeIfNecessary(state, toCheck));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Transition> getTransitions() {
|
public Collection<Transition> getTransitions() {
|
||||||
|
|
|
||||||
Reference in a new issue