1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.eclipse.jetty.deploy.graph;
17
18
19
20
21 public final class Edge
22 {
23 private Node _from;
24 private Node _to;
25
26 public Edge(Node from, Node to)
27 {
28 if (from==null || to==null || from==to)
29 throw new IllegalArgumentException("from "+from+" to "+to);
30 _from = from;
31 _to = to;
32 }
33
34 @Override
35 public int hashCode()
36 {
37 return _from.hashCode() ^ _to.hashCode();
38 }
39
40 @Override
41 public boolean equals(Object obj)
42 {
43 if (this == obj)
44 return true;
45 if (obj == null)
46 return false;
47 if (getClass() != obj.getClass())
48 return false;
49 Edge other = (Edge)obj;
50 if (_from == null)
51 {
52 if (other._from != null)
53 return false;
54 }
55 else if (!_from.equals(other._from))
56 return false;
57 if (_to == null)
58 {
59 if (other._to != null)
60 return false;
61 }
62 else if (!_to.equals(other._to))
63 return false;
64 return true;
65 }
66
67 public Node getFrom()
68 {
69 return _from;
70 }
71
72 public Node getTo()
73 {
74 return _to;
75 }
76
77 @Override
78 public String toString()
79 {
80 return _from+"->"+_to;
81 }
82 }