View Javadoc
1   package org.opentrafficsim.road.network.sampling;
2   
3   import org.opentrafficsim.core.network.Node;
4   import org.opentrafficsim.kpi.interfaces.NodeDataInterface;
5   
6   /**
7    * <p>
8    * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
10   * <p>
11   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 13 okt. 2016 <br>
12   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
14   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
15   */
16  public class NodeData implements NodeDataInterface
17  {
18  
19      /** Node. */
20      private final Node node;
21  
22      /**
23       * @param node node
24       */
25      public NodeData(final Node node)
26      {
27          this.node = node;
28      }
29  
30      /**
31       * @return node.
32       */
33      public final Node getNode()
34      {
35          return this.node;
36      }
37  
38      /** {@inheritDoc} */
39      @Override
40      public final int hashCode()
41      {
42          final int prime = 31;
43          int result = 1;
44          result = prime * result + ((this.node == null) ? 0 : this.node.hashCode());
45          return result;
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public final boolean equals(final Object obj)
51      {
52          if (this == obj)
53          {
54              return true;
55          }
56          if (obj == null)
57          {
58              return false;
59          }
60          if (getClass() != obj.getClass())
61          {
62              return false;
63          }
64          NodeData other = (NodeData) obj;
65          if (this.node == null)
66          {
67              if (other.node != null)
68              {
69                  return false;
70              }
71          }
72          else if (!this.node.equals(other.node))
73          {
74              return false;
75          }
76          return true;
77      }
78  
79      /** {@inheritDoc} */
80      @Override
81      public final String toString()
82      {
83          return "NodeData [node=" + this.node + "]";
84      }
85      
86  }