1 package org.opentrafficsim.imb.kpi;
2
3 import org.opentrafficsim.kpi.interfaces.NodeDataInterface;
4
5 import nl.tudelft.simulation.language.d3.CartesianPoint;
6
7
8
9
10
11
12
13
14
15
16
17 public class NodeData implements NodeDataInterface
18 {
19
20
21 private final String nodeName;
22
23
24 private final CartesianPoint position;
25
26
27
28
29
30 public NodeData(final String nodeName, final CartesianPoint position)
31 {
32 this.nodeName = nodeName;
33 this.position = position;
34 }
35
36
37
38
39 public final String getNodeName()
40 {
41 return this.nodeName;
42 }
43
44
45
46
47 public final CartesianPoint getPosition()
48 {
49 return this.position;
50 }
51
52
53 @Override
54 public int hashCode()
55 {
56 final int prime = 31;
57 int result = 1;
58 result = prime * result + ((this.nodeName == null) ? 0 : this.nodeName.hashCode());
59 result = prime * result + ((this.position == null) ? 0 : this.position.hashCode());
60 return result;
61 }
62
63
64 @Override
65 public boolean equals(Object obj)
66 {
67 if (this == obj)
68 return true;
69 if (obj == null)
70 return false;
71 if (getClass() != obj.getClass())
72 return false;
73 NodeData other = (NodeData) obj;
74 if (this.nodeName == null)
75 {
76 if (other.nodeName != null)
77 return false;
78 }
79 else if (!this.nodeName.equals(other.nodeName))
80 return false;
81 if (this.position == null)
82 {
83 if (other.position != null)
84 return false;
85 }
86 else if (!this.position.equals(other.position))
87 return false;
88 return true;
89 }
90
91
92 @Override
93 public String toString()
94 {
95 return "NodeData [nodeName=" + this.nodeName + ", position=" + this.position + "]";
96 }
97
98 }