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

LearnLib / learnlib / 19556545386

21 Nov 2025 01:10AM UTC coverage: 94.471%. First build
19556545386

Pull #155

github

web-flow
Merge d1e6e0721 into 7c236fec9
Pull Request #155: Bump Java Version to 17/25

59 of 83 new or added lines in 25 files covered. (71.08%)

12611 of 13349 relevant lines covered (94.47%)

1.73 hits per line

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

75.76
/algorithms/active/ttt-vpa/src/main/java/de/learnlib/algorithm/ttt/vpa/Splitter.java
1
/* Copyright (C) 2013-2025 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.vpa;
17

18
import de.learnlib.algorithm.observationpack.vpa.hypothesis.ContextPair;
19
import de.learnlib.algorithm.observationpack.vpa.hypothesis.DTNode;
20
import de.learnlib.algorithm.observationpack.vpa.hypothesis.HypLoc;
21
import net.automatalib.word.Word;
22

23
/**
24
 * Data structure for representing a splitter.
25
 * <p>
26
 * A splitter is represented by an input symbol, and a DT node that separates the successors (wrt. the input symbol) of
27
 * the original states. From this, a discriminator can be obtained by prepending the input symbol to the discriminator
28
 * that labels the separating successor.
29
 * <p>
30
 * <b>Note:</b> as the discriminator finalization is applied to the root of a block and affects all nodes, there is no
31
 * need to store references to the source states from which this splitter was obtained.
32
 *
33
 * @param <I>
34
 *         input symbol type
35
 */
36
public final class Splitter<I> {
37

38
    public final I symbol;
39
    public final HypLoc<I> location;
40
    public final I otherSymbol;
41
    public final SplitType type;
42
    public final DTNode<I> succSeparator;
43

44
    public Splitter(I symbol, DTNode<I> succSeparator) {
2✔
45
        this.symbol = symbol;
2✔
46
        this.location = null;
2✔
47
        this.otherSymbol = null;
2✔
48
        this.type = SplitType.INTERNAL;
2✔
49
        this.succSeparator = succSeparator;
2✔
50
    }
2✔
51

52
    public Splitter(I symbol, HypLoc<I> location, I otherSymbol, boolean call, DTNode<I> succSeparator) {
2✔
53
        this.symbol = symbol;
2✔
54
        this.location = location;
2✔
55
        this.otherSymbol = otherSymbol;
2✔
56
        this.type = call ? SplitType.CALL : SplitType.RETURN;
2✔
57
        this.succSeparator = succSeparator;
2✔
58
    }
2✔
59

60
    public ContextPair<I> getDiscriminator() {
61
        return succSeparator.getDiscriminator();
×
62
    }
63

64
    public ContextPair<I> getNewDiscriminator() {
65
        Word<I> prefix = succSeparator.getDiscriminator().getPrefix();
2✔
66
        Word<I> suffix = succSeparator.getDiscriminator().getSuffix();
2✔
67

68
        return switch (type) {
2✔
69
            case INTERNAL -> new ContextPair<>(prefix, suffix.prepend(symbol));
2✔
NEW
70
            case RETURN -> new ContextPair<>(prefix.concat(location.getAccessSequence()).append(otherSymbol),
×
NEW
71
                                             suffix.prepend(symbol));
×
NEW
72
            case CALL -> new ContextPair<>(prefix,
×
NEW
73
                                           location.getAccessSequence()
×
NEW
74
                                                   .prepend(symbol)
×
NEW
75
                                                   .append(otherSymbol)
×
NEW
76
                                                   .concat(suffix));
×
77
        };
78
    }
79

80
    public int getNewDiscriminatorLength() {
81
        if (type == SplitType.INTERNAL) {
2✔
82
            return succSeparator.getDiscriminator().getLength() + 1;
2✔
83
        }
84
        return succSeparator.getDiscriminator().getLength() + location.getAccessSequence().length() + 2;
2✔
85
    }
86

87
    public enum SplitType {
2✔
88
        INTERNAL,
2✔
89
        CALL,
2✔
90
        RETURN
2✔
91
    }
92
}
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