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

LearnLib / automatalib / 13138848026

04 Feb 2025 02:53PM UTC coverage: 92.108% (+2.2%) from 89.877%
13138848026

push

github

mtf90
[maven-release-plugin] prepare release automatalib-0.12.0

16609 of 18032 relevant lines covered (92.11%)

1.7 hits per line

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

94.74
/api/src/main/java/net/automatalib/graph/visualization/CFMPSVisualizationHelper.java
1
/* Copyright (C) 2013-2025 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

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

31
public class CFMPSVisualizationHelper<N, L, E> extends DefaultVisualizationHelper<Pair<L, N>, Pair<L, E>> {
32

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

36
    // cast is fine, because we make sure to only query nodes/edges belonging to the respective procedures
37
    @SuppressWarnings("unchecked")
38
    public CFMPSVisualizationHelper(Map<L, ? extends ProceduralModalProcessGraph<? extends N, L, ? extends E, ?, ?>> pmpgs) {
1✔
39

40
        this.visualizers = new HashMap<>(HashUtil.capacity(pmpgs.size()));
1✔
41
        this.initialNodes = new ArrayList<>(pmpgs.size());
1✔
42

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

48
            this.visualizers.put(e.getKey(), new PMPGVisualizationHelper<>(value));
1✔
49

50
            if (initialNode != null) {
1✔
51
                this.initialNodes.add(Pair.of(e.getKey(), initialNode));
1✔
52
            }
53
        }
1✔
54
    }
1✔
55

56
    @Override
57
    protected Collection<Pair<L, N>> initialNodes() {
58
        return this.initialNodes;
×
59
    }
60

61
    @Override
62
    public boolean getNodeProperties(Pair<L, N> node, Map<String, String> properties) {
63

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

68
        return visualizer.getNodeProperties(node.getSecond(), properties);
1✔
69
    }
70

71
    @Override
72
    public boolean getEdgeProperties(Pair<L, N> src, Pair<L, E> edge, Pair<L, N> tgt, Map<String, String> properties) {
73

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

78
        return visualizer.getEdgeProperties(src.getSecond(), edge.getSecond(), tgt.getSecond(), properties);
1✔
79
    }
80

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

© 2025 Coveralls, Inc