MCPcopy Create free account
hub / github.com/LFYSec/MScan / AbstractEdge

Class AbstractEdge

src/main/java/pascal/taie/util/graph/AbstractEdge.java:27–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25import pascal.taie.util.Hashes;
26
27public abstract class AbstractEdge<N> implements Edge<N> {
28
29 /**
30 * The source node of the edge.
31 */
32 protected final N source;
33
34 /**
35 * The target node of the edge.
36 */
37 protected final N target;
38
39 protected AbstractEdge(N source, N target) {
40 this.source = source;
41 this.target = target;
42 }
43
44 @Override
45 public N source() {
46 return source;
47 }
48
49 @Override
50 public N target() {
51 return target;
52 }
53
54 @Override
55 public boolean equals(Object o) {
56 if (this == o) {
57 return true;
58 }
59 if (o == null || getClass() != o.getClass()) {
60 return false;
61 }
62 AbstractEdge<?> edge = (AbstractEdge<?>) o;
63 return source.equals(edge.source) && target.equals(edge.target);
64 }
65
66 @Override
67 public int hashCode() {
68 return Hashes.hash(source, target);
69 }
70
71 @Override
72 public String toString() {
73 return getClass().getSimpleName() +
74 "{" + source + " -> " + target + '}';
75 }
76}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected