added more simple methods

This commit is contained in:
Walcher 2024-01-05 15:33:41 +01:00
parent 1e95c4bdc7
commit 666280cdf6

View file

@ -25,12 +25,10 @@ public class NFAImpl implements NFA {
@Override
public Set<String> getStates() {
return this.states;
}
@Override
public Collection<Transition> getTransitions() {
return this.transitions;
}
@ -48,62 +46,78 @@ public class NFAImpl implements NFA {
@Override
public void addTransition(Transition transition) throws FinalizedStateException {
if (this.isFinalized) {
throw new FinalizedStateException();
} else {
this.transitions.add(transition);
}
}
@Override
public void addAcceptingState(String state) throws FinalizedStateException {
if (this.isFinalized) {
throw new FinalizedStateException();
} else {
this.acceptingStates.add(state);
}
}
// #TODO later
// #TODO
@Override
public NFA union(NFA other) throws FinalizedStateException {
return null;
}
// #TODO later
// #TODO
@Override
public NFA intersection(NFA other) throws FinalizedStateException {
return null;
}
// #TODO
@Override
public NFA concatenation(NFA other) throws FinalizedStateException {
return null;
}
// #TODO
@Override
public NFA kleeneStar() throws FinalizedStateException {
return null;
}
// #TODO
@Override
public NFA plusOperator() throws FinalizedStateException {
return null;
}
// #TODO
@Override
public NFA complement() throws FinalizedStateException {
return null;
}
// #TODO
@Override
public boolean isFinalized() {
return isFinalized;
}
// #TODO
@Override
public void finalizeAutomaton() {
this.isFinalized = true;
}
// #TODO
@Override
public boolean isFinite() {
//check if finite
return false;
}
// #TODO
@Override
public boolean acceptsWord(String word) {
return false;