1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rblasch.convert.graph;
17
18 public final class Connection {
19 private final Vertex start, end;
20 private final Edge edge;
21
22 public Connection(final Vertex start, final Edge edge, final Vertex end) {
23 this.start = start;
24 this.edge = edge;
25 this.end = end;
26 }
27
28 public Vertex getStart() {
29 return start;
30 }
31
32 public Edge getEdge() {
33 return edge;
34 }
35
36 public Vertex getEnd() {
37 return end;
38 }
39
40 public String toString() {
41 return start + " " + edge + " " + end;
42 }
43
44
45 public boolean equals(final Object o) {
46 if (this == o) return true;
47 if (!(o instanceof Connection)) return false;
48
49 final Connection connection = (Connection) o;
50
51 if (!edge.equals(connection.edge)) return false;
52 if (!end.equals(connection.end)) return false;
53 if (!start.equals(connection.start)) return false;
54
55 return true;
56 }
57
58 public int hashCode() {
59 int result;
60 result = start.hashCode();
61 result = 29 * result + end.hashCode();
62 result = 29 * result + edge.hashCode();
63 return result;
64 }
65 }