blob: 367b44628b8429a22d2a3976608458b581b78a3e (
plain) (
blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.deploy.graph;
/**
* Basic Graph Edge
*/
public final class Edge
{
private Node _from;
private Node _to;
public Edge(Node from, Node to)
{
if (from==null || to==null || from==to)
throw new IllegalArgumentException("from "+from+" to "+to);
_from = from;
_to = to;
}
@Override
public int hashCode()
{
return _from.hashCode() ^ _to.hashCode();
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Edge other = (Edge)obj;
if (_from == null)
{
if (other._from != null)
return false;
}
else if (!_from.equals(other._from))
return false;
if (_to == null)
{
if (other._to != null)
return false;
}
else if (!_to.equals(other._to))
return false;
return true;
}
public Node getFrom()
{
return _from;
}
public Node getTo()
{
return _to;
}
@Override
public String toString()
{
return _from+"->"+_to;
}
}
|