View Javadoc

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