Skip to content

Commit

Permalink
adjust to AutomataLib refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
mtf90 committed Jan 9, 2024
1 parent 5a3303d commit 41f7555
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import de.learnlib.util.MQUtil;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.transducer.MealyMachine;
import net.automatalib.common.util.Pair;
import net.automatalib.word.Word;
Expand Down Expand Up @@ -383,7 +382,7 @@ public boolean isTransitionDefined(ADTState<I, O> state, I input) {
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

this.hypothesis.addAlphabetSymbol(symbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import de.learnlib.tooling.annotation.builder.GenerateBuilder;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.transducer.impl.CompactMealy;
import net.automatalib.common.util.mapping.MapMapping;
import net.automatalib.common.util.mapping.MutableMapping;
Expand Down Expand Up @@ -252,7 +251,7 @@ public CompactMealy<I, O> getHypothesisModel() {
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

if (!this.splitters.contains(Word.fromLetter(symbol))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import de.learnlib.tooling.annotation.builder.GenerateBuilder;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.fsa.DFA;
import net.automatalib.automaton.fsa.impl.CompactDFA;
import net.automatalib.common.smartcollection.ArrayStorage;
Expand Down Expand Up @@ -299,7 +298,7 @@ private List<StateInfo<I, Boolean>> sift(List<AbstractWordBasedDTNode<I, Boolean
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

this.hypothesis.addAlphabetSymbol(symbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import de.learnlib.util.mealy.MealyUtil;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.impl.CompactTransition;
import net.automatalib.automaton.transducer.MealyMachine;
import net.automatalib.automaton.transducer.impl.CompactMealy;
Expand Down Expand Up @@ -317,7 +316,7 @@ private List<StateInfo<I, Word<O>>> sift(List<AbstractWordBasedDTNode<I, Word<O>
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

this.hypothesis.addAlphabetSymbol(symbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import de.learnlib.util.MQUtil;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.concept.SuffixOutput;
import net.automatalib.word.Word;

Expand Down Expand Up @@ -227,7 +226,7 @@ public ObservationTable<I, D> getObservationTable() {
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

final List<List<Row<I>>> unclosed = this.table.addAlphabetSymbol(symbol, oracle);
Expand Down
4 changes: 0 additions & 4 deletions algorithms/active/observation-pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ limitations under the License.
<groupId>net.automatalib</groupId>
<artifactId>automata-api</artifactId>
</dependency>
<dependency>
<groupId>net.automatalib</groupId>
<artifactId>automata-core</artifactId>
</dependency>
<dependency>
<groupId>net.automatalib</groupId>
<artifactId>automata-commons-smartcollections</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import de.learnlib.util.MQUtil;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.concept.SuffixOutput;
import net.automatalib.word.Word;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -231,7 +230,7 @@ public OPLearnerHypothesis<I, D, SP, TP> getHypothesisDS() {
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

this.hypothesis.addAlphabetSymbol(symbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import de.learnlib.AccessSequenceTransformer;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.UniversalDeterministicAutomaton;
import net.automatalib.automaton.concept.StateIDs;
import net.automatalib.graph.Graph;
Expand Down Expand Up @@ -141,7 +140,7 @@ public HState<I, O, SP, TP> getSuccessor(HTransition<I, O, SP, TP> trans) {
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

final int newAlphabetSize = this.alphabet.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
requires de.learnlib.datastructure.discriminationtree;
requires net.automatalib.api;
requires net.automatalib.common.smartcollection;
requires net.automatalib.core;
requires org.checkerframework.checker.qual;

requires static de.learnlib.tooling.annotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import de.learnlib.query.DefaultQuery;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.concept.InputAlphabetHolder;
import net.automatalib.word.Word;

Expand Down Expand Up @@ -97,7 +96,7 @@ public boolean refineHypothesis(DefaultQuery<I, D> counterexample) {
@Override
public void addAlphabetSymbol(I symbol) {
if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

// check if symbol is already part of ptree/hypothesis
Expand Down
4 changes: 0 additions & 4 deletions algorithms/active/ttt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ limitations under the License.
<groupId>net.automatalib</groupId>
<artifactId>automata-commons-smartcollections</artifactId>
</dependency>
<dependency>
<groupId>net.automatalib</groupId>
<artifactId>automata-core</artifactId>
</dependency>

<dependency>
<groupId>org.checkerframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import java.util.Map;

import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.GrowingAlphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.automaton.DeterministicAutomaton;
import net.automatalib.automaton.FiniteAlphabetAutomaton;
import net.automatalib.automaton.fsa.DFA;
Expand Down Expand Up @@ -178,13 +176,11 @@ public DeterministicAutomaton.FullIntAbstraction<T> fullIntAbstraction(Alphabet<

@Override
public void addAlphabetSymbol(I symbol) {
final GrowingAlphabet<I> growingAlphabet = Alphabets.toGrowingAlphabetOrThrowException(this.alphabet);

if (!growingAlphabet.containsSymbol(symbol)) {
growingAlphabet.addSymbol(symbol);
if (!this.alphabet.containsSymbol(symbol)) {
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

final int newAlphabetSize = growingAlphabet.size();
final int newAlphabetSize = this.alphabet.size();

if (alphabetSize < newAlphabetSize) {
for (TTTState<I, D> s : this.getStates()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import de.learnlib.query.DefaultQuery;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.common.smartcollection.ElementReference;
import net.automatalib.common.smartcollection.UnorderedCollection;
import net.automatalib.word.Word;
Expand Down Expand Up @@ -940,7 +939,7 @@ protected final AbstractBaseDTNode<I, D>.SplitResult split(AbstractBaseDTNode<I,
public void addAlphabetSymbol(I symbol) {

if (!this.alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(this.alphabet).addSymbol(symbol);
this.alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

this.hypothesis.addAlphabetSymbol(symbol);
Expand Down
1 change: 0 additions & 1 deletion algorithms/active/ttt/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
requires de.learnlib.datastructure.list;
requires net.automatalib.api;
requires net.automatalib.common.smartcollection;
requires net.automatalib.core;
requires org.checkerframework.checker.qual;
requires org.slf4j;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import de.learnlib.oracle.MembershipOracle;
import de.learnlib.query.DefaultQuery;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.word.Word;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand Down Expand Up @@ -532,7 +531,7 @@ private boolean isCanonical(Row<I> row) {
public List<List<Row<I>>> addAlphabetSymbol(I symbol, MembershipOracle<I, D> oracle) {

if (!alphabet.containsSymbol(symbol)) {
Alphabets.toGrowingAlphabetOrThrowException(alphabet).addSymbol(symbol);
alphabet.asGrowingAlphabetOrThrowException().addSymbol(symbol);
}

final int newAlphabetSize = alphabet.size();
Expand Down

0 comments on commit 41f7555

Please sign in to comment.