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

LearnLib / learnlib / 24312053666

12 Apr 2026 05:15PM UTC coverage: 95.129% (+0.06%) from 95.073%
24312053666

push

github

mtf90
make most regular learners implement AccessSequenceTransformer

144 of 145 new or added lines in 25 files covered. (99.31%)

2 existing lines in 2 files now uncovered.

14667 of 15418 relevant lines covered (95.13%)

1.74 hits per line

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

92.0
/algorithms/active/ttt/src/main/java/de/learnlib/algorithm/ttt/dfa/TTTLearnerDFA.java
1
/* Copyright (C) 2013-2026 TU Dortmund University
2
 * This file is part of LearnLib <https://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.algorithm.ttt.dfa;
17

18
import java.util.function.Supplier;
19

20
import de.learnlib.acex.AcexAnalyzer;
21
import de.learnlib.acex.OutInconsPrefixTransformAcex;
22
import de.learnlib.algorithm.LearningAlgorithm.DFALearner;
23
import de.learnlib.algorithm.ttt.base.AbstractBaseDTNode;
24
import de.learnlib.algorithm.ttt.base.AbstractTTTLearner;
25
import de.learnlib.algorithm.ttt.base.BaseTTTDiscriminationTree;
26
import de.learnlib.algorithm.ttt.base.OutputInconsistency;
27
import de.learnlib.algorithm.ttt.base.TTTState;
28
import de.learnlib.algorithm.ttt.base.TTTTransition;
29
import de.learnlib.oracle.MembershipOracle;
30
import de.learnlib.tooling.annotation.builder.GenerateBuilder;
31
import net.automatalib.alphabet.Alphabet;
32
import net.automatalib.automaton.fsa.DFA;
33
import net.automatalib.word.Word;
34

35
/**
36
 * A {@link DFA}-based specialization of {@link AbstractTTTLearner}.
37
 *
38
 * @param <I>
39
 *         input symbol type
40
 */
41
public class TTTLearnerDFA<I> extends AbstractTTTLearner<DFA<?, I>, I, Boolean> implements DFALearner<I> {
2✔
42

43
    public TTTLearnerDFA(Alphabet<I> alphabet, MembershipOracle<I, Boolean> oracle) {
44
        this(alphabet, oracle, AbstractTTTLearner.BuilderDefaults.analyzer());
2✔
45
    }
2✔
46

47
    @GenerateBuilder(defaults = AbstractTTTLearner.BuilderDefaults.class)
48
    public TTTLearnerDFA(Alphabet<I> alphabet, MembershipOracle<I, Boolean> oracle, AcexAnalyzer analyzer) {
49
        this(alphabet, oracle, analyzer, TTTDTNodeDFA::new);
2✔
50
    }
2✔
51

52
    protected TTTLearnerDFA(Alphabet<I> alphabet,
53
                            MembershipOracle<I, Boolean> oracle,
54
                            AcexAnalyzer analyzer,
55
                            Supplier<? extends AbstractBaseDTNode<I, Boolean>> rootSupplier) {
56
        super(alphabet,
2✔
57
              oracle,
58
              new TTTHypothesisDFA<>(alphabet),
59
              new BaseTTTDiscriminationTree<>(oracle, rootSupplier),
60
              analyzer);
61

62
        dtree.getRoot().split(Word.epsilon(), false, true);
2✔
63
    }
2✔
64

65
    @Override
66
    @SuppressWarnings("unchecked")
67
    public DFA<?, I> getHypothesisModel() {
68
        return (TTTHypothesisDFA<I>) hypothesis;
2✔
69
    }
70

71
    @Override
72
    protected void initializeState(TTTState<I, Boolean> state) {
73
        super.initializeState(state);
2✔
74

75
        TTTStateDFA<I> dfaState = (TTTStateDFA<I>) state;
2✔
76
        Boolean aBoolean = dtree.getRoot().subtreeLabel(dfaState.getDTLeaf());
2✔
77
        assert aBoolean != null;
2✔
78
        dfaState.accepting = aBoolean;
2✔
79
    }
2✔
80

81
    @Override
82
    protected OutInconsPrefixTransformAcex<I, Boolean> deriveAcex(OutputInconsistency<I, Boolean> outIncons) {
83
        OutInconsPrefixTransformAcex<I, Boolean> acex = super.deriveAcex(outIncons);
2✔
84
        acex.setEffect(acex.getLength() - 1, !outIncons.targetOut);
2✔
85
        return acex;
2✔
86
    }
87

88
    @Override
89
    protected Boolean succEffect(Boolean effect) {
90
        return effect;
2✔
91
    }
92

93
    @Override
94
    protected Boolean predictSuccOutcome(TTTTransition<I, Boolean> trans,
95
                                         AbstractBaseDTNode<I, Boolean> succSeparator) {
96
        return succSeparator.subtreeLabel(trans.getDTTarget());
2✔
97
    }
98

99
    @Override
100
    protected Boolean computeHypothesisOutput(TTTState<I, Boolean> state, Word<I> suffix) {
101
        TTTState<I, Boolean> endState = getAnySuccessor(state, suffix);
2✔
102
        return ((TTTStateDFA<I>) endState).accepting;
2✔
103
    }
104

105
    @Override
106
    @SuppressWarnings("unchecked")
107
    public TTTHypothesisDFA<I> getHypothesisDS() {
NEW
108
        requireLearningProcessStarted();
×
UNCOV
109
        return (TTTHypothesisDFA<I>) hypothesis;
×
110
    }
111

112
    @Override
113
    protected AbstractBaseDTNode<I, Boolean> createNewNode(AbstractBaseDTNode<I, Boolean> parent,
114
                                                           Boolean parentOutput) {
115
        return new TTTDTNodeDFA<>(parent, parentOutput);
2✔
116
    }
117
}
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

© 2026 Coveralls, Inc