documentation. cleanup. your turn daniel
This commit is contained in:
parent
31badb9da5
commit
d52ca6e7f8
2 changed files with 23 additions and 19 deletions
11
.idea/workspace.xml
generated
11
.idea/workspace.xml
generated
|
|
@ -6,7 +6,6 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="f5e08808-a5af-4c89-a1ee-21b3bcb9ae3e" name="Changes" comment="documentation. cleanup. your turn daniel">
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/ab1/impl/gruppe10_aigensberger_dworski_walcher/NFAImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ab1/impl/gruppe10_aigensberger_dworski_walcher/NFAImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/ab1/tests/GRUPPE/betterSimpleTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/ab1/tests/GRUPPE/betterSimpleTests.java" afterDir="false" />
|
||||
</list>
|
||||
<list id="39d4ccb3-eae9-4ed4-996a-5a13f44678fa" name="Changes by carol" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
|
@ -292,7 +291,15 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1704915995807</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="13" />
|
||||
<task id="LOCAL-00013" summary="documentation. cleanup. your turn daniel">
|
||||
<option name="closed" value="true" />
|
||||
<created>1704916397835</created>
|
||||
<option name="number" value="00013" />
|
||||
<option name="presentableId" value="LOCAL-00013" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1704916397835</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="14" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package ab1.impl.gruppe10_aigensberger_dworski_walcher;
|
|||
import ab1.FinalizedStateException;
|
||||
import ab1.NFA;
|
||||
import ab1.Transition;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
|
@ -17,7 +18,8 @@ public class NFAImpl implements NFA {
|
|||
private final String initialState;
|
||||
private final Set<String> acceptingStates;
|
||||
|
||||
private Set<Character> alphabet;
|
||||
@Getter
|
||||
private final Set<Character> alphabet;
|
||||
|
||||
private final Set<Character> completeAlphabet;
|
||||
private boolean isFinalized;
|
||||
|
|
@ -57,15 +59,10 @@ public class NFAImpl implements NFA {
|
|||
return this.initialState;
|
||||
}
|
||||
|
||||
public Set<Character> getAlphabet() {
|
||||
return this.alphabet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new transition to the automaton. If the automaton is already finalized, a FinalizedStateException is thrown.
|
||||
* @param transition The transition to add
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the automaton is already finalized
|
||||
*/
|
||||
@Override
|
||||
public void addTransition(Transition transition) throws FinalizedStateException {
|
||||
|
|
@ -88,7 +85,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Adds all transitions to the automaton. If the automaton is already finalized, a FinalizedStateException is thrown.
|
||||
* @param transitions The Set of transitions to add
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the automaton is already finalized
|
||||
*/
|
||||
public void addAllTransitions(Set<Transition> transitions) throws FinalizedStateException {
|
||||
if (this.isFinalized) {
|
||||
|
|
@ -102,7 +99,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Adds a new accepting state to the automaton. If the automaton is already finalized, a FinalizedStateException is thrown.
|
||||
* @param state The state to add as accepting state
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the automaton is already finalized
|
||||
*/
|
||||
@Override
|
||||
public void addAcceptingState(String state) throws FinalizedStateException {
|
||||
|
|
@ -119,7 +116,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Adds all accepting states to the automaton. If the automaton is already finalized, a FinalizedStateException is thrown.
|
||||
* @param states The Set of states to add as accepting states
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the automaton is already finalized
|
||||
*/
|
||||
public void addAllAcceptingStates(Set<String> states) throws FinalizedStateException {
|
||||
if (this.isFinalized) {
|
||||
|
|
@ -156,7 +153,7 @@ public class NFAImpl implements NFA {
|
|||
* Creates a new NFA that is the union of this NFA and the other NFA. If either of the NFAs is not finalized, a FinalizedStateException is thrown.
|
||||
* @param other The other NFA to union with
|
||||
* @return The union of this NFA and the other NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If either of the NFAs is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA union(NFA other) throws FinalizedStateException {
|
||||
|
|
@ -231,7 +228,7 @@ public class NFAImpl implements NFA {
|
|||
* Creates a new NFA that is the intersection of this NFA and the other NFA. If either of the NFAs is not finalized, a FinalizedStateException is thrown.
|
||||
* @param other The other NFA to intersect with
|
||||
* @return The intersection of this NFA and the other NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If either of the NFAs is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA intersection(NFA other) throws FinalizedStateException {
|
||||
|
|
@ -248,7 +245,7 @@ public class NFAImpl implements NFA {
|
|||
* Creates a new NFA that is the concatenation of this NFA and the other NFA. If either of the NFAs is not finalized, a FinalizedStateException is thrown.
|
||||
* @param other The other NFA to concatenate with
|
||||
* @return The concatenation of this NFA and the other NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If either of the NFAs is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA concatenation(NFA other) throws FinalizedStateException {
|
||||
|
|
@ -295,7 +292,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Creates a new NFA that is the Kleene star of this NFA. If the NFA is not finalized, a FinalizedStateException is thrown.
|
||||
* @return The Kleene star of this NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the NFA is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA kleeneStar() throws FinalizedStateException {
|
||||
|
|
@ -324,7 +321,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Creates a new NFA that is the plus operator of this NFA. If the NFA is not finalized, a FinalizedStateException is thrown.
|
||||
* @return The plus operator of this NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the NFA is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA plusOperator() throws FinalizedStateException {
|
||||
|
|
@ -353,7 +350,7 @@ public class NFAImpl implements NFA {
|
|||
/**
|
||||
* Creates a new NFA that is the complement of this NFA. If the NFA is not finalized, a FinalizedStateException is thrown.
|
||||
* @return The complement of this NFA
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the NFA is not finalized
|
||||
*/
|
||||
@Override
|
||||
public NFA complement() throws FinalizedStateException {
|
||||
|
|
@ -597,7 +594,7 @@ public class NFAImpl implements NFA {
|
|||
* Returns whether the automaton accepts the given word. If the automaton is not finalized, a FinalizedStateException is thrown.
|
||||
* @param word word to check, can be empty
|
||||
* @return Whether the automaton accepts the given word
|
||||
* @throws FinalizedStateException
|
||||
* @throws FinalizedStateException If the automaton is not finalized
|
||||
*/
|
||||
@Override
|
||||
public boolean acceptsWord(String word) throws FinalizedStateException {
|
||||
|
|
|
|||
Reference in a new issue