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