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

LearnLib / automatalib / 6618813592

23 Oct 2023 08:42PM UTC coverage: 89.4% (+0.1%) from 89.282%
6618813592

push

github

mtf90
cleanup VisualizationHelpers

* do not make the decision whether to render a node/edge depend on the parent (in most cases DefaultVisualizationHelper) because the helpers themselves make this decision.
* remove unused NodeAttrs.ACCEPTING

57 of 57 new or added lines in 18 files covered. (100.0%)

15325 of 17142 relevant lines covered (89.4%)

1.65 hits per line

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

16.67
/api/src/main/java/net/automatalib/visualization/VisualizationHelper.java
1
/* Copyright (C) 2013-2023 TU Dortmund
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.visualization;
17

18
import java.util.Map;
19

20
/**
21
 * Helper interface for providing additional styling properties for plotting graphs.
22
 *
23
 * @param <N>
24
 *         node class
25
 * @param <E>
26
 *         edge class
27
 */
28
public interface VisualizationHelper<N, E> {
29

30
    default void getGlobalNodeProperties(Map<String, String> properties) {}
1✔
31

32
    default void getGlobalEdgeProperties(Map<String, String> properties) {}
1✔
33

34
    /**
35
     * Retrieves the properties for rendering a single node. Additionally, the return value allows to control whether to
36
     * omit this node from rendering. If {@code false} is returned, the node will not be rendered. Consequently, any
37
     * modifications to the properties map will have no effect.
38
     * <p>
39
     * The properties are stored in the {@link Map} argument. Note that if an implementation of a base class is
40
     * overridden, it is probably a good idea to call {@code super.getNodeProperties(node, properties);} at the
41
     * beginning of the method.
42
     *
43
     * @param node
44
     *         the node to be rendered
45
     * @param properties
46
     *         the property map
47
     *
48
     * @return whether this node should be rendered
49
     */
50
    boolean getNodeProperties(N node, Map<String, String> properties);
51

52
    /**
53
     * Retrieves the properties for rendering a single edge. Additionally, the return value allows to control whether to
54
     * omit this edge from rendering. If {@code false} is returned, the edge will not be rendered. Consequently, any
55
     * modifications to the properties map will have no effect.
56
     * <p>
57
     * The properties are stored in the {@link Map} argument. Note that if an implementation of a base class is
58
     * overridden, it is probably a good idea to call {@code super.getEdgeProperties(node, properties);} at the
59
     * beginning of the method.
60
     *
61
     * @param edge
62
     *         the edge to be rendered
63
     * @param properties
64
     *         the property map
65
     *
66
     * @return whether this edge should be rendered
67
     */
68
    boolean getEdgeProperties(N src, E edge, N tgt, Map<String, String> properties);
69

70
    class CommonAttrs {
71

72
        public static final String LABEL = "label";
73
        public static final String COLOR = "color";
74
        public static final String TEXLBL = "texlbl";
75
        public static final String STYLE = "style";
76

77
        private CommonAttrs() {
78
            // prevent instantiation
79
        }
80
    }
81

82
    final class NodeAttrs extends CommonAttrs {
83

84
        public static final String SHAPE = "shape";
85
        public static final String WIDTH = "width";
86
        public static final String HEIGHT = "height";
87
        public static final String FIXEDSIZE = "fixedsize";
88

89
        public static final String INITIAL = "initial";
90

91
        private NodeAttrs() {
×
92
            // prevent instantiation
93
        }
×
94
    }
95

96
    class EdgeAttrs extends CommonAttrs {
97

98
        public static final String PENWIDTH = "penwidth";
99
        public static final String ARROWHEAD = "arrowhead";
100

101
        private EdgeAttrs() {
×
102
            // prevent instantiation
103
        }
×
104
    }
105

106
    final class NodeShapes {
107

108
        public static final String NONE = "none";
109

110
        public static final String OVAL = "oval";
111
        public static final String DOUBLEOVAL = "doubleoval";
112

113
        public static final String CIRCLE = "circle";
114
        public static final String DOUBLECIRCLE = "doublecircle";
115

116
        public static final String OCTAGON = "octagon";
117
        public static final String DOUBLEOCTAGON = "doubleoctagon";
118

119
        public static final String BOX = "box";
120

121
        private NodeShapes() {
122
            // prevent instantiation
123
        }
124
    }
125

126
    class CommonStyles {
127

128
        public static final String DASHED = "dashed";
129
        public static final String DOTTED = "dotted";
130
        public static final String SOLID = "solid";
131
        public static final String BOLD = "bold";
132

133
        private CommonStyles() {
134
            // prevent instantiation
135
        }
136
    }
137

138
    final class NodeStyles extends CommonStyles {
139

140
        public static final String FILLED = "filled";
141
        public static final String INVISIBLE = "invisible";
142
        public static final String DIAGONALS = "diagonals";
143
        public static final String ROUNDED = "rounded";
144

145
        private NodeStyles() {
×
146
            // prevent instantiation
147
        }
×
148
    }
149

150
    final class EdgeStyles extends CommonStyles {
151

152
        private EdgeStyles() {
×
153
            // prevent instantiation
154
        }
×
155
    }
156

157
    class MTSEdgeAttrs extends EdgeAttrs {
158

159
        public static final String MODALITY = "modality";
160

161
        private MTSEdgeAttrs() {
×
162
            // prevent instantiation
163
        }
×
164
    }
165
}
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