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

LearnLib / automatalib / 6673214172

27 Oct 2023 11:30PM UTC coverage: 89.166% (-0.6%) from 89.796%
6673214172

push

github

mtf90
cleanup release configuration

15399 of 17270 relevant lines covered (89.17%)

1.67 hits per line

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

58.0
/core/src/main/java/net/automatalib/visualization/Visualization.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.Arrays;
19
import java.util.Collection;
20
import java.util.Collections;
21
import java.util.Map;
22

23
import net.automatalib.AutomataLibProperty;
24
import net.automatalib.AutomataLibSettings;
25
import net.automatalib.automaton.Automaton;
26
import net.automatalib.automaton.graph.TransitionEdge;
27
import net.automatalib.graph.Graph;
28
import net.automatalib.graph.concept.GraphViewable;
29
import org.slf4j.Logger;
30
import org.slf4j.LoggerFactory;
31

32
public final class Visualization {
33

34
    private static final Logger LOGGER = LoggerFactory.getLogger(Visualization.class);
1✔
35

36
    private static final Visualization INSTANCE = new Visualization();
1✔
37
    private final VisualizationProvider provider;
38

39
    private Visualization() {
1✔
40
        AutomataLibSettings settings = AutomataLibSettings.getInstance();
1✔
41

42
        String providerId = settings.getProperty(AutomataLibProperty.VISUALIZATION_PROVIDER);
1✔
43
        VisualizationProvider vp = null;
1✔
44

45
        VPManager manager = new VPManager();
1✔
46
        manager.load();
1✔
47

48
        if (providerId != null) {
1✔
49
            vp = manager.getProviderById(providerId);
×
50
            if (vp == null) {
×
51
                LOGGER.error("No provider found with id '{}'. Defaulting to dummy provider...", providerId);
×
52
            }
53
        }
54

55
        if (vp == null) {
1✔
56
            vp = manager.getBestProvider();
1✔
57
        }
58

59
        provider = vp;
1✔
60
    }
1✔
61

62
    public static <N, E> void visualize(Graph<N, E> graph) {
63
        visualize(graph, true);
×
64
    }
×
65

66
    @SafeVarargs
67
    public static <N, E> void visualize(Graph<N, E> graph, VisualizationHelper<N, ? super E>... additionalHelpers) {
68
        visualize(graph, true, additionalHelpers);
×
69
    }
×
70

71
    public static <N, E> void visualize(Graph<N, E> graph, boolean modal) {
72
        visualize(graph, modal, Collections.emptyMap());
1✔
73
    }
1✔
74

75
    @SafeVarargs
76
    public static <N, E> void visualize(Graph<N, E> graph,
77
                                        boolean modal,
78
                                        VisualizationHelper<N, ? super E>... additionalHelpers) {
79
        visualize(graph, modal, Collections.emptyMap(), additionalHelpers);
1✔
80
    }
1✔
81

82
    public static <N, E> void visualize(Graph<N, E> graph, boolean modal, Map<String, String> options) {
83
        INSTANCE.visualizeInternal(graph, modal, options);
1✔
84
    }
1✔
85

86
    @SafeVarargs
87
    public static <N, E> void visualize(Graph<N, E> graph,
88
                                        boolean modal,
89
                                        Map<String, String> options,
90
                                        VisualizationHelper<N, ? super E>... additionalHelpers) {
91
        INSTANCE.visualizeInternal(graph, modal, options, additionalHelpers);
1✔
92
    }
1✔
93

94
    public static void visualize(GraphViewable gv) {
95
        visualize(gv, true);
×
96
    }
×
97

98
    public static void visualize(GraphViewable gv, boolean modal) {
99
        visualize(gv, modal, Collections.emptyMap());
1✔
100
    }
1✔
101

102
    public static void visualize(GraphViewable gv, boolean modal, Map<String, String> options) {
103
        visualize(gv.graphView(), modal, options);
1✔
104
    }
1✔
105

106
    public static <S, I, T> void visualize(Automaton<S, I, T> graph, Collection<? extends I> inputs) {
107
        visualize(graph, inputs, true);
×
108
    }
×
109

110
    @SafeVarargs
111
    public static <S, I, T> void visualize(Automaton<S, I, T> graph,
112
                                           Collection<? extends I> inputs,
113
                                           VisualizationHelper<S, ? super TransitionEdge<I, T>>... additionalHelpers) {
114
        visualize(graph, inputs, true, additionalHelpers);
×
115
    }
×
116

117
    public static <S, I, T> void visualize(Automaton<S, I, T> graph, Collection<? extends I> inputs, boolean modal) {
118
        visualize(graph, inputs, modal, Collections.emptyMap());
×
119
    }
×
120

121
    @SafeVarargs
122
    public static <S, I, T> void visualize(Automaton<S, I, T> graph,
123
                                           Collection<? extends I> inputs,
124
                                           boolean modal,
125
                                           VisualizationHelper<S, ? super TransitionEdge<I, T>>... additionalHelpers) {
126
        visualize(graph, inputs, modal, Collections.emptyMap(), additionalHelpers);
×
127
    }
×
128

129
    public static <S, I, T> void visualize(Automaton<S, I, T> graph,
130
                                           Collection<? extends I> inputs,
131
                                           boolean modal,
132
                                           Map<String, String> options) {
133
        INSTANCE.visualizeInternal(graph.transitionGraphView(inputs), modal, options);
×
134
    }
×
135

136
    @SafeVarargs
137
    public static <S, I, T> void visualize(Automaton<S, I, T> graph,
138
                                           Collection<? extends I> inputs,
139
                                           boolean modal,
140
                                           Map<String, String> options,
141
                                           VisualizationHelper<S, ? super TransitionEdge<I, T>>... additionalHelpers) {
142
        INSTANCE.visualizeInternal(graph.transitionGraphView(inputs), modal, options, additionalHelpers);
×
143
    }
×
144

145
    private <N, E> void visualizeInternal(Graph<N, E> graph, boolean modal, Map<String, String> options) {
146
        provider.visualize(graph, Collections.emptyList(), modal, options);
1✔
147
    }
1✔
148

149
    @SafeVarargs
150
    private final <N, E> void visualizeInternal(Graph<N, E> graph,
151
                                                boolean modal,
152
                                                Map<String, String> options,
153
                                                VisualizationHelper<N, ? super E>... additionalHelpers) {
154
        provider.visualize(graph, Arrays.asList(additionalHelpers), modal, options);
1✔
155
    }
1✔
156

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