1 package org.opentrafficsim.road.network.sampling;
2
3 import org.opentrafficsim.core.network.route.Route;
4 import org.opentrafficsim.kpi.interfaces.RouteDataInterface;
5
6 /**
7 * <p>
8 * Copyright (c) 2013-2017 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 RouteData implements RouteDataInterface
17 {
18
19 /** Route. */
20 private final Route route;
21
22 /**
23 * @param route route
24 */
25 public RouteData(final Route route)
26 {
27 this.route = route;
28 }
29
30 /**
31 * @return route.
32 */
33 public final Route getRoute()
34 {
35 return this.route;
36 }
37
38 /** {@inheritDoc} */
39 @Override
40 public String getId()
41 {
42 return this.route.getId();
43 }
44
45 /** {@inheritDoc} */
46 @Override
47 public final int hashCode()
48 {
49 final int prime = 31;
50 int result = 1;
51 result = prime * result + ((this.route == null) ? 0 : this.route.hashCode());
52 return result;
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public final boolean equals(final Object obj)
58 {
59 if (this == obj)
60 {
61 return true;
62 }
63 if (obj == null)
64 {
65 return false;
66 }
67 if (getClass() != obj.getClass())
68 {
69 return false;
70 }
71 RouteData other = (RouteData) obj;
72 if (this.route == null)
73 {
74 if (other.route != null)
75 {
76 return false;
77 }
78 }
79 else if (!this.route.equals(other.route))
80 {
81 return false;
82 }
83 return true;
84 }
85
86 /** {@inheritDoc} */
87 @Override
88 public final String toString()
89 {
90 return "RouteData [route=" + this.route + "]";
91 }
92
93 }