added more simple methods
This commit is contained in:
parent
1e95c4bdc7
commit
666280cdf6
1 changed files with 21 additions and 7 deletions
|
|
@ -25,12 +25,10 @@ public class NFAImpl implements NFA {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getStates() {
|
public Set<String> getStates() {
|
||||||
|
|
||||||
return this.states;
|
return this.states;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Collection<Transition> getTransitions() {
|
public Collection<Transition> getTransitions() {
|
||||||
|
|
||||||
return this.transitions;
|
return this.transitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,62 +46,78 @@ public class NFAImpl implements NFA {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTransition(Transition transition) throws FinalizedStateException {
|
public void addTransition(Transition transition) throws FinalizedStateException {
|
||||||
|
if (this.isFinalized) {
|
||||||
|
throw new FinalizedStateException();
|
||||||
|
} else {
|
||||||
|
this.transitions.add(transition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAcceptingState(String state) throws FinalizedStateException {
|
public void addAcceptingState(String state) throws FinalizedStateException {
|
||||||
|
if (this.isFinalized) {
|
||||||
|
throw new FinalizedStateException();
|
||||||
|
} else {
|
||||||
|
this.acceptingStates.add(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #TODO later
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA union(NFA other) throws FinalizedStateException {
|
public NFA union(NFA other) throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #TODO later
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA intersection(NFA other) throws FinalizedStateException {
|
public NFA intersection(NFA other) throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA concatenation(NFA other) throws FinalizedStateException {
|
public NFA concatenation(NFA other) throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA kleeneStar() throws FinalizedStateException {
|
public NFA kleeneStar() throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA plusOperator() throws FinalizedStateException {
|
public NFA plusOperator() throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public NFA complement() throws FinalizedStateException {
|
public NFA complement() throws FinalizedStateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinalized() {
|
public boolean isFinalized() {
|
||||||
|
|
||||||
return isFinalized;
|
return isFinalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public void finalizeAutomaton() {
|
public void finalizeAutomaton() {
|
||||||
this.isFinalized = true;
|
this.isFinalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public boolean isFinite() {
|
public boolean isFinite() {
|
||||||
|
//check if finite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #TODO
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptsWord(String word) {
|
public boolean acceptsWord(String word) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Reference in a new issue