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

LearnLib / automatalib / 8208485978

03 Mar 2024 10:58PM UTC coverage: 89.882% (-0.03%) from 89.915%
8208485978

push

github

mtf90
allow non-deterministic targets in FSABuilder

0 of 10 new or added lines in 2 files covered. (0.0%)

2 existing lines in 1 file now uncovered.

15813 of 17593 relevant lines covered (89.88%)

1.66 hits per line

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

61.9
/util/src/main/java/net/automatalib/util/automaton/builder/FSABuilderImpl.java
1
/* Copyright (C) 2013-2024 TU Dortmund University
2
 * This file is part of AutomataLib, http://www.automatalib.net/.
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 net.automatalib.util.automaton.builder;
17

18
import de.learnlib.tooling.annotation.DocGenType;
19
import de.learnlib.tooling.annotation.edsl.Action;
20
import de.learnlib.tooling.annotation.edsl.GenerateEDSL;
21
import net.automatalib.automaton.fsa.MutableFSA;
22

23
/**
24
 * A fluent builder for {@link net.automatalib.automaton.fsa.FiniteStateAcceptor}s.
25
 *
26
 * @param <S>
27
 *         state type
28
 * @param <I>
29
 *         input symbol type
30
 * @param <A>
31
 *         concrete automaton type
32
 */
33
@GenerateEDSL(name = "FSABuilder",
34
              syntax = "(((from (on (loop|to)+)+)+)|withAccepting|withInitial)* create",
35
              constructorPublic = false,
36
              docGenType = DocGenType.COPY)
37
class FSABuilderImpl<S, I, A extends MutableFSA<S, ? super I>> extends AutomatonBuilderImpl<S, I, S, Boolean, Void, A> {
38

39
    /**
40
     * Constructs a new builder with the given (mutable) automaton to write to.
41
     *
42
     * @param automaton
43
     *         the automaton to write to
44
     */
45
    @Action
46
    FSABuilderImpl(A automaton) {
47
        super(automaton);
2✔
48
    }
2✔
49

50
    /**
51
     * Sets the target states of the current transition definition(s).
52
     *
53
     * @param firstStateId
54
     *         the mandatory object to identify the first state
55
     * @param otherStateIds
56
     *         the optional objects to identify additional states
57
     */
58
    @Action
59
    void to(Object firstStateId, Object... otherStateIds) {
NEW
60
        for (S src : currentStates) {
×
NEW
61
            for (I input : currentInputs) {
×
NEW
62
                for (S tgt : getStates(firstStateId, otherStateIds)) {
×
NEW
63
                    automaton.addTransition(src, input, tgt, currentTransProp);
×
NEW
64
                }
×
NEW
65
            }
×
NEW
66
        }
×
NEW
67
    }
×
68

69
    /**
70
     * Marks the given states as initial.
71
     *
72
     * @param stateId
73
     *         the object to identify the mandatory state
74
     * @param stateIds
75
     *         the objects to identify the additional states
76
     */
77
    @Action
78
    void withInitial(Object stateId, Object... stateIds) {
79
        for (S s : getStates(stateId, stateIds)) {
2✔
80
            automaton.setInitial(s, true);
2✔
81
        }
2✔
82
    }
2✔
83

84
    /**
85
     * Marks the given state as accepting.
86
     *
87
     * @param stateId
88
     *         the object to identify the state
89
     */
90
    @Action
91
    void withAccepting(Object stateId) {
92
        S state = getState(stateId);
2✔
93
        automaton.setAccepting(state, true);
2✔
94
    }
2✔
95

96
    /**
97
     * Marks the given states as accepting.
98
     *
99
     * @param stateId
100
     *         the object to identify the mandatory state
101
     * @param stateIds
102
     *         the objects to identify the additional states
103
     */
104
    @Action
105
    void withAccepting(Object stateId, Object... stateIds) {
106
        for (S s : getStates(stateId, stateIds)) {
2✔
107
            automaton.setAccepting(s, true);
2✔
108
        }
2✔
109
    }
2✔
110
}
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