• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / learnlib / 6611855081

23 Oct 2023 10:13AM UTC coverage: 93.275% (-0.003%) from 93.278%
6611855081

push

github

mtf90
partially revert f4f47b4

Make the (Base)PTA Integer-based again and instead use explicit wrapper classes to interpret it as a DFA/MealyMachine/etc.. This simplifies the internals of the (Base)PTA class and allows for more flexible usage (e.g., using the same PTA for different contexts). Performance-wise the number of symbol-to-index transformations should remain identical for the common use-cases (e.g., RPNI-based learning, etc.).

98 of 98 new or added lines in 13 files covered. (100.0%)

11553 of 12386 relevant lines covered (93.27%)

1.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/datastructures/pta/src/main/java/de/learnlib/datastructure/pta/wrapper/MealyWrapper.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of LearnLib, http://www.learnlib.de/.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package de.learnlib.datastructure.pta.wrapper;
17

18
import java.util.Collection;
19

20
import de.learnlib.datastructure.pta.AbstractBasePTAState;
21
import de.learnlib.datastructure.pta.BasePTA;
22
import de.learnlib.datastructure.pta.PTATransition;
23
import net.automatalib.alphabet.Alphabet;
24
import net.automatalib.automaton.FiniteAlphabetAutomaton;
25
import net.automatalib.automaton.transducer.MealyMachine;
26
import org.checkerframework.checker.nullness.qual.Nullable;
27

28
public class MealyWrapper<S extends AbstractBasePTAState<S, Void, O>, I, O>
1✔
29
        implements MealyMachine<S, I, PTATransition<S>, O>, FiniteAlphabetAutomaton<S, I, PTATransition<S>> {
30

31
    private final Alphabet<I> alphabet;
32
    private final BasePTA<S, Void, O> pta;
33

34
    public MealyWrapper(Alphabet<I> alphabet, BasePTA<S, Void, O> pta) {
1✔
35
        assert alphabet.size() == pta.getInputAlphabet().size();
1✔
36
        this.alphabet = alphabet;
1✔
37
        this.pta = pta;
1✔
38
    }
1✔
39

40
    @Override
41
    public Alphabet<I> getInputAlphabet() {
42
        return this.alphabet;
×
43
    }
44

45
    @Override
46
    public O getTransitionOutput(PTATransition<S> transition) {
47
        return pta.getTransitionProperty(transition);
1✔
48
    }
49

50
    @Override
51
    public Collection<S> getStates() {
52
        return pta.getStates();
×
53
    }
54

55
    @Override
56
    public @Nullable PTATransition<S> getTransition(S state, I input) {
57
        return pta.getTransition(state, alphabet.getSymbolIndex(input));
1✔
58
    }
59

60
    @Override
61
    public S getSuccessor(PTATransition<S> transition) {
62
        return pta.getSuccessor(transition);
1✔
63
    }
64

65
    @Override
66
    public S getInitialState() {
67
        return pta.getInitialState();
1✔
68
    }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc