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

LearnLib / automatalib / 29355161923

14 Jul 2026 05:46PM UTC coverage: 93.029%. Remained the same
29355161923

push

github

mtf90
javadoc: disable metainf-services link

17562 of 18878 relevant lines covered (93.03%)

1.73 hits per line

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

95.0
/api/src/main/java/net/automatalib/graph/visualization/CFMPSVisualizationHelper.java
1
/* Copyright (C) 2013-2026 TU Dortmund University
2
 * This file is part of AutomataLib <https://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.graph.visualization;
17

18
import java.util.ArrayList;
19
import java.util.Collection;
20
import java.util.HashMap;
21
import java.util.List;
22
import java.util.Map;
23
import java.util.Map.Entry;
24
import java.util.Objects;
25

26
import net.automatalib.common.util.HashUtil;
27
import net.automatalib.common.util.Pair;
28
import net.automatalib.graph.ProceduralModalProcessGraph;
29
import net.automatalib.visualization.DefaultVisualizationHelper;
30
import org.checkerframework.checker.nullness.qual.NonNull;
31
import org.checkerframework.checker.nullness.qual.Nullable;
32

33
public class CFMPSVisualizationHelper<N, L, E> extends DefaultVisualizationHelper<Pair<L, N>, Pair<L, E>> {
34

35
    private final Map<L, PMPGVisualizationHelper<N, L, E, ?>> visualizers;
36
    private final List<Pair<L, N>> initialNodes;
37

38
    // cast is fine, because we make sure to only query nodes/edges belonging to the respective procedures
39
    @SuppressWarnings("unchecked")
40
    public CFMPSVisualizationHelper(@Nullable L mainProcedure,
41
                                    Map<L, ? extends ProceduralModalProcessGraph<? extends N, L, ? extends E, ?, ?>> pmpgs) {
1✔
42
        this.visualizers = new HashMap<>(HashUtil.capacity(pmpgs.size()));
1✔
43
        this.initialNodes = new ArrayList<>(pmpgs.size());
1✔
44

45
        for (Entry<L, ? extends ProceduralModalProcessGraph<? extends N, L, ? extends E, ?, ?>> e : pmpgs.entrySet()) {
1✔
46
            final ProceduralModalProcessGraph<N, L, E, ?, ?> value =
1✔
47
                    (ProceduralModalProcessGraph<N, L, E, ?, ?>) e.getValue();
1✔
48
            final L key = e.getKey();
1✔
49
            final N initialNode = value.getInitialNode();
1✔
50

51
            this.visualizers.put(key, new PMPGVisualizationHelper<>(key, Objects.equals(key, mainProcedure), value));
1✔
52

53
            if (initialNode != null) {
1✔
54
                this.initialNodes.add(Pair.of(key, initialNode));
1✔
55
            }
56
        }
1✔
57
    }
1✔
58

59
    @Override
60
    protected Collection<Pair<L, N>> initialNodes() {
61
        return this.initialNodes;
×
62
    }
63

64
    @Override
65
    public boolean getNodeProperties(Pair<L, N> node, Map<String, String> properties) {
66

67
        final L process = node.getFirst();
1✔
68
        @SuppressWarnings("assignment") // we only use identifier for which procedures exist
69
        final @NonNull PMPGVisualizationHelper<N, L, E, ?> visualizer = this.visualizers.get(process);
1✔
70

71
        return visualizer.getNodeProperties(node.getSecond(), properties);
1✔
72
    }
73

74
    @Override
75
    public boolean getEdgeProperties(Pair<L, N> src, Pair<L, E> edge, Pair<L, N> tgt, Map<String, String> properties) {
76

77
        final L process = edge.getFirst();
1✔
78
        @SuppressWarnings("assignment") // we only use identifier for which procedures exist
79
        final @NonNull PMPGVisualizationHelper<N, L, E, ?> visualizer = this.visualizers.get(process);
1✔
80

81
        return visualizer.getEdgeProperties(src.getSecond(), edge.getSecond(), tgt.getSecond(), properties);
1✔
82
    }
83

84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc