documentation. cleanup. your turn daniel
This commit is contained in:
parent
d88922fee3
commit
61ebad2e84
3 changed files with 9 additions and 20 deletions
|
|
@ -3,6 +3,9 @@ package ab1.impl.gruppe10_aigensberger_dworski_walcher;
|
||||||
import ab1.NFA;
|
import ab1.NFA;
|
||||||
import ab1.NFAFactory;
|
import ab1.NFAFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of NFAFactory
|
||||||
|
*/
|
||||||
public class NFAFactoryImpl implements NFAFactory {
|
public class NFAFactoryImpl implements NFAFactory {
|
||||||
@Override
|
@Override
|
||||||
public NFA buildNFA(String startState) {
|
public NFA buildNFA(String startState) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple tests for the NFA implementation.
|
||||||
|
*/
|
||||||
public class BetterSimpleTests {
|
public class BetterSimpleTests {
|
||||||
private final NFAFactory factory = NFAProvider.provideFactory();
|
private final NFAFactory factory = NFAProvider.provideFactory();
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a test class for the NFA implementation.
|
||||||
|
*/
|
||||||
public class MyTests {
|
public class MyTests {
|
||||||
private final NFAFactory factory = NFAProvider.provideFactory();
|
private final NFAFactory factory = NFAProvider.provideFactory();
|
||||||
|
|
||||||
|
|
@ -24,26 +27,6 @@ public class MyTests {
|
||||||
assertFalse(testInstance.acceptsWord("ba"));
|
assertFalse(testInstance.acceptsWord("ba"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private NFA buildCharStarLanguage(char c) {
|
|
||||||
var instance = factory.buildNFA("START");
|
|
||||||
instance.addTransition(
|
|
||||||
Transition.builder()
|
|
||||||
.fromState("START")
|
|
||||||
.readSymbol(c)
|
|
||||||
.toState("START")
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
instance.addAcceptingState("START");
|
|
||||||
instance.finalizeAutomaton();
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NFA buildCharLanguage(char c) {
|
private NFA buildCharLanguage(char c) {
|
||||||
var instance = factory.buildNFA("START");
|
var instance = factory.buildNFA("START");
|
||||||
instance.addTransition(
|
instance.addTransition(
|
||||||
|
|
|
||||||
Reference in a new issue