Debian Codegraph @

src/com/google/javascript/jscomp/graph/GraphvizGraph.java

raw symbols SCIP
1 /*
2 * Copyright 2008 The Closure Compiler Authors.
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
17 package com.google.javascript.jscomp.graph;
18
19 import java.util.List;
20
21 /**
22 * A graph that can be dumped to a Graphviz DOT file.
23 * <p>
24 * An object which can be visualized as a graph should implement this interface.
25 * The <code>DotFormatter.toDot</code> function can be used to get a
26 * visualization of the object for debugging purpose.
27 *
28 */
29 public interface GraphvizGraph {
30
31 /**
32 * Name of the graph.
33 *
34 * @return Name of the graph.
35 */
36 String getName();
37
38 /**
39 * Graph type.
40 *
41 * @return True if the graph is a directed graph.
42 */
43 boolean isDirected();
44
45 /**
46 * Retrieve a list of nodes in the graph.
47 *
48 * @return A list of nodes in the graph.
49 */
50 List<GraphvizNode> getGraphvizNodes();
51
52 /**
53 * Retrieve a list of edges in the graph.
54 *
55 * @return A list of edges in the graph.
56 */
57 List<GraphvizEdge> getGraphvizEdges();
58
59
60 /**
61 * A Graphviz node.
62 */
63 interface GraphvizNode {
64
65 /**
66 * Retrieves the unique ID.
67 *
68 * @return A the unique ID of the node.
69 */
70 String getId();
71
72 /**
73 * Retrieves color of the node.
74 *
75 * @return The color of the node.
76 */
77 String getColor();
78
79 /**
80 * Retrieves the label of the node.
81 *
82 * @return Label of the node.
83 */
84 String getLabel();
85 }
86
87
88 /**
89 * A Graphviz edge.
90 */
91 interface GraphvizEdge {
92
93 /**
94 * Get the first node in the edge. In a directed node, this will be the
95 * source node.
96 *
97 * @return First node in the edge.
98 */
99 String getNode1Id();
100
101 /**
102 * Get the second node in the edge. In a directed node, this will be the
103 * destination node.
104 *
105 * @return First node in the edge.
106 */
107 String getNode2Id();
108
109 /**
110 * Retrieves color of the edge.
111 *
112 * @return The color of the edge.
113 */
114 String getColor();
115
116 /**
117 * Retrieves the label of the edge.
118 *
119 * @return Label of the edge.
120 */
121 String getLabel();
122 }
123 }