-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
DependecyGraph.java
66 lines (51 loc) · 1.78 KB
/
DependecyGraph.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package io.quarkus.arc.deployment.devconsole;
import java.util.Objects;
import java.util.Set;
public class DependecyGraph {
public final Set<DevBeanInfo> nodes;
public final Set<Link> links;
public DependecyGraph(Set<DevBeanInfo> nodes, Set<Link> links) {
this.nodes = nodes;
this.links = links;
}
public static class Link {
static Link dependent(boolean direct, String source, String target) {
return new Link(source, target, direct ? "directDependent" : "dependency");
}
static Link dependency(boolean direct, String source, String target) {
return new Link(source, target, direct ? "directDependency" : "dependency");
}
static Link lookup(String source, String target) {
return new Link(source, target, "lookup");
}
static Link producer(String source, String target) {
return new Link(source, target, "producer");
}
public final String source;
public final String target;
public final String type;
public Link(String source, String target, String type) {
this.source = source;
this.target = target;
this.type = type;
}
@Override
public int hashCode() {
return Objects.hash(source, target);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Link other = (Link) obj;
return Objects.equals(source, other.source) && Objects.equals(target, other.target);
}
}
}