View Javadoc

1   // ========================================================================
2   // Copyright (c) Webtide LLC
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   //
8   // The Eclipse Public License is available at 
9   // http://www.eclipse.org/legal/epl-v10.html
10  //
11  // The Apache License v2.0 is available at
12  // http://www.apache.org/licenses/LICENSE-2.0.txt
13  //
14  // You may elect to redistribute this code under either of these licenses. 
15  // ========================================================================
16  package org.eclipse.jetty.deploy.graph;
17  
18  /**
19   * Basic Graph Node
20   */
21  public final class Node
22  {
23      private final String _name;
24  
25      public Node(String name)
26      {
27          assert name!=null;
28          this._name = name;
29      }
30  
31      public String getName()
32      {
33          return _name;
34      }
35  
36      @Override
37      public String toString()
38      {
39          return "Node[" + _name + "]";
40      }
41  
42      @Override
43      public int hashCode()
44      {
45          return _name.hashCode();
46      }
47  
48      @Override
49      public boolean equals(Object obj)
50      {
51          if (this == obj)
52              return true;
53          if (obj == null)
54              return false;
55          if (getClass() != obj.getClass())
56              return false;
57          Node other = (Node)obj;
58          if (_name == null)
59          {
60              if (other._name != null)
61                  return false;
62          }
63          else if (!_name.equals(other._name))
64              return false;
65          return true;
66      }
67  }