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

LearnLib / learnlib / 6433387082

06 Oct 2023 03:10PM UTC coverage: 92.296% (-0.007%) from 92.303%
6433387082

push

github

mtf90
update Falk's developer id

11573 of 12539 relevant lines covered (92.3%)

1.67 hits per line

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

92.31
/algorithms/passive/rpni/src/main/java/de/learnlib/algorithms/rpni/BlueFringeRPNIDFA.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.algorithms.rpni;
17

18
import java.util.Collection;
19

20
import de.learnlib.api.algorithm.PassiveLearningAlgorithm;
21
import de.learnlib.api.algorithm.PassiveLearningAlgorithm.PassiveDFALearner;
22
import de.learnlib.api.query.DefaultQuery;
23
import de.learnlib.datastructure.pta.PTAUtil;
24
import de.learnlib.datastructure.pta.pta.BlueFringePTA;
25
import net.automatalib.automata.fsa.DFA;
26
import net.automatalib.automata.fsa.impl.compact.CompactDFA;
27
import net.automatalib.words.Alphabet;
28

29
/**
30
 * A Blue Fringe version of RPNI for learning DFAs.
31
 * <p>
32
 * <b>Implementation note:</b> This implementation does not support repeated calls to {@link
33
 * PassiveLearningAlgorithm#computeModel()}.
34
 *
35
 * @param <I>
36
 *         input symbol type
37
 */
38
public class BlueFringeRPNIDFA<I> extends AbstractBlueFringeRPNI<I, Boolean, Boolean, Void, DFA<?, I>>
39
        implements PassiveDFALearner<I> {
40

41
    private final BlueFringePTA<Boolean, Void> pta;
42
    private boolean merged;
43

44
    /**
45
     * Constructor.
46
     *
47
     * @param alphabet
48
     *         the alphabet
49
     */
50
    public BlueFringeRPNIDFA(Alphabet<I> alphabet) {
51
        super(alphabet);
2✔
52
        this.pta = new BlueFringePTA<>(alphabetSize);
2✔
53
        this.merged = false;
2✔
54
    }
2✔
55

56
    @Override
57
    public void addSamples(Collection<? extends DefaultQuery<I, Boolean>> samples) {
58
        for (DefaultQuery<I, Boolean> query : samples) {
2✔
59
            pta.addSample(query.getInput().asIntSeq(alphabet), query.getOutput());
2✔
60
        }
2✔
61
    }
2✔
62

63
    @Override
64
    protected BlueFringePTA<Boolean, Void> fetchPTA() {
65
        if (merged) {
2✔
66
            throw new IllegalStateException(
×
67
                    "A model has already been computed once. This learner does not support repeated model constructions");
68
        }
69
        merged = true;
2✔
70

71
        return this.pta;
2✔
72
    }
73

74
    @Override
75
    protected CompactDFA<I> ptaToModel(BlueFringePTA<Boolean, Void> pta) {
76
        return PTAUtil.toDFA(pta, alphabet);
2✔
77
    }
78

79
}
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