added basic methods, added basic variables
This commit is contained in:
parent
b418c37417
commit
1e95c4bdc7
16 changed files with 255 additions and 10 deletions
|
|
@ -5,27 +5,45 @@ import ab1.NFA;
|
|||
import ab1.Transition;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class NFAImpl implements NFA {
|
||||
@Override
|
||||
public Set<String> getStates() {
|
||||
return null;
|
||||
private Set<String> states;
|
||||
private Set<Transition> transitions;
|
||||
private String initialState;
|
||||
private Set<String> acceptingStates;
|
||||
private boolean isFinalized;
|
||||
|
||||
public NFAImpl(String startState) {
|
||||
this.initialState = startState;
|
||||
this.states = new HashSet<>();
|
||||
this.transitions = new HashSet<>();
|
||||
this.acceptingStates = new HashSet<>();
|
||||
this.isFinalized = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Transition> getTransitions() {
|
||||
return null;
|
||||
public Set<String> getStates() {
|
||||
|
||||
return this.states;
|
||||
}
|
||||
@Override
|
||||
public Collection<Transition> getTransitions() {
|
||||
|
||||
return this.transitions;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<String> getAcceptingStates() {
|
||||
return null;
|
||||
|
||||
return this.acceptingStates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitialState() {
|
||||
return null;
|
||||
return this.initialState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -38,11 +56,13 @@ public class NFAImpl implements NFA {
|
|||
|
||||
}
|
||||
|
||||
// #TODO later
|
||||
@Override
|
||||
public NFA union(NFA other) throws FinalizedStateException {
|
||||
return null;
|
||||
}
|
||||
|
||||
// #TODO later
|
||||
@Override
|
||||
public NFA intersection(NFA other) throws FinalizedStateException {
|
||||
return null;
|
||||
|
|
@ -70,12 +90,13 @@ public class NFAImpl implements NFA {
|
|||
|
||||
@Override
|
||||
public boolean isFinalized() {
|
||||
return false;
|
||||
|
||||
return isFinalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeAutomaton() {
|
||||
|
||||
this.isFinalized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Reference in a new issue