1 package org.opentrafficsim.sim0mq.kpi;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.djunits.value.vdouble.scalar.Length;
7 import org.opentrafficsim.kpi.interfaces.LinkData;
8
9
10
11
12
13
14
15
16
17
18 public class LinkDataSim0 implements LinkData<LaneDataSim0>
19 {
20
21
22 private final String linkName;
23
24
25 final String startNode;
26
27
28 final String endNode;
29
30
31 private final List<LaneDataSim0> laneDataList = new ArrayList<>();
32
33
34 private final Length length;
35
36
37
38
39
40
41
42 public LinkDataSim0(final String linkName, final String startNode, final String endNode, final Length length)
43 {
44 this.linkName = linkName;
45 this.length = length;
46 this.startNode = startNode;
47 this.endNode = endNode;
48 }
49
50
51
52
53
54 public void addLaneData(final LaneDataSim0 laneData)
55 {
56 this.laneDataList.add(laneData);
57 }
58
59
60 @Override
61 public final List<LaneDataSim0> getLaneDatas()
62 {
63 return this.laneDataList;
64 }
65
66
67 @Override
68 public final Length getLength()
69 {
70 return this.length;
71 }
72
73
74
75
76 public final String getStartNode()
77 {
78 return this.startNode;
79 }
80
81
82
83
84 public final String getEndNode()
85 {
86 return this.endNode;
87 }
88
89
90
91
92 public final String getLinkName()
93 {
94 return this.linkName;
95 }
96
97
98 @Override
99 public String getId()
100 {
101 return this.linkName;
102 }
103
104
105 @Override
106 public int hashCode()
107 {
108 final int prime = 31;
109 int result = 1;
110 result = prime * result + ((this.endNode == null) ? 0 : this.endNode.hashCode());
111 result = prime * result + ((this.length == null) ? 0 : this.length.hashCode());
112 result = prime * result + ((this.linkName == null) ? 0 : this.linkName.hashCode());
113 result = prime * result + ((this.startNode == null) ? 0 : this.startNode.hashCode());
114 return result;
115 }
116
117
118 @Override
119 public boolean equals(final Object obj)
120 {
121 if (this == obj)
122 return true;
123 if (obj == null)
124 return false;
125 if (getClass() != obj.getClass())
126 return false;
127 LinkDataSim0 other = (LinkDataSim0) obj;
128 if (this.linkName == null)
129 {
130 if (other.linkName != null)
131 return false;
132 }
133 else if (!this.linkName.equals(other.linkName))
134 return false;
135 return true;
136 }
137
138
139 @Override
140 public String toString()
141 {
142 return "LinkData [linkName=" + this.linkName + ", startNode=" + this.startNode + ", endNode=" + this.endNode
143 + ", length=" + this.length + ", laneDataList.size()=" + this.laneDataList.size() + "]";
144 }
145
146 }