• 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

90.48
/oracles/filters/reuse/src/main/java/de/learnlib/filter/reuse/tree/ReuseTreeDotHelper.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.filter.reuse.tree;
17

18
import java.util.Map;
19

20
import net.automatalib.visualization.DefaultVisualizationHelper;
21
import net.automatalib.visualization.VisualizationHelper;
22
import org.checkerframework.checker.nullness.qual.Nullable;
23

24
/**
25
 * {@link VisualizationHelper} implementation for the {@link ReuseTree} that renders nodes as white circles (if no
26
 * system state is available on the node) or black diamonds (otherwise). Edges are labeled with input / output
27
 * behavior.
28
 *
29
 * @param <S>
30
 *         system state class
31
 * @param <I>
32
 *         input symbol class
33
 * @param <O>
34
 *         output symbol class
35
 */
36
class ReuseTreeDotHelper<S, I, O>
2✔
37
        extends DefaultVisualizationHelper<@Nullable ReuseNode<S, I, O>, @Nullable ReuseEdge<S, I, O>> {
38

39
    @Override
40
    public boolean getNodeProperties(@Nullable ReuseNode<S, I, O> node, Map<String, String> properties) {
41
        if (node == null) {
2✔
42
            return false;
×
43
        }
44

45
        super.getNodeProperties(node, properties);
2✔
46
        if (node.hasSystemStates()) {
2✔
47
            properties.put(NodeAttrs.COLOR, "black");
2✔
48
            properties.put(NodeAttrs.STYLE, "filled");
2✔
49
            properties.put(NodeAttrs.SHAPE, "diamond");
2✔
50
            properties.put("fontcolor", "white");
2✔
51
        }
52
        properties.put(NodeAttrs.LABEL, String.valueOf(node.getId()));
2✔
53
        return true;
2✔
54
    }
55

56
    @Override
57
    public boolean getEdgeProperties(@Nullable ReuseNode<S, I, O> src,
58
                                     @Nullable ReuseEdge<S, I, O> edge,
59
                                     @Nullable ReuseNode<S, I, O> tgt,
60
                                     Map<String, String> properties) {
61

62
        if (src == null || edge == null || tgt == null) {
2✔
63
            return false;
×
64
        }
65

66
        super.getEdgeProperties(src, edge, tgt, properties);
2✔
67

68
        final StringBuilder labelBuilder = new StringBuilder();
2✔
69
        labelBuilder.append(edge.getInput()).append(" / ");
2✔
70
        O output = edge.getOutput();
2✔
71
        if (output != null) {
2✔
72
            labelBuilder.append(output);
2✔
73
        }
74
        properties.put(EdgeAttrs.LABEL, labelBuilder.toString());
2✔
75
        return true;
2✔
76
    }
77
}
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