View Javadoc
1   package org.opentrafficsim.sim0mq.kpi;
2   
3   /**
4    * <p>
5    * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
6    * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
7    * </p>
8    * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
9    * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
10   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
11   */
12  public class RouteData
13  {
14      /** Route name. */
15      private final String routeName;
16  
17      /** Route start. */
18      private final String startNode;
19  
20      /** Route end. */
21      private final String endNode;
22  
23      /**
24       * @param routeName name of the route
25       * @param startNode data of the start node of the route
26       * @param endNode data of the end node of the route
27       */
28      public RouteData(final String routeName, final String startNode, final String endNode)
29      {
30          this.routeName = routeName;
31          this.startNode = startNode;
32          this.endNode = endNode;
33      }
34  
35      /**
36       * @return routeName
37       */
38      public final String getRouteName()
39      {
40          return this.routeName;
41      }
42  
43      /**
44       * @return startNode
45       */
46      public final String getStartNode()
47      {
48          return this.startNode;
49      }
50  
51      /**
52       * @return endNode
53       */
54      public final String getEndNode()
55      {
56          return this.endNode;
57      }
58  
59      /**
60       * @return id
61       */
62      public String getId()
63      {
64          return this.routeName;
65      }
66  
67      @Override
68      public int hashCode()
69      {
70          final int prime = 31;
71          int result = 1;
72          result = prime * result + ((this.routeName == null) ? 0 : this.routeName.hashCode());
73          return result;
74      }
75  
76      @Override
77      public boolean equals(final Object obj)
78      {
79          if (this == obj)
80              return true;
81          if (obj == null)
82              return false;
83          if (getClass() != obj.getClass())
84              return false;
85          RouteData other = (RouteData) obj;
86          if (this.routeName == null)
87          {
88              if (other.routeName != null)
89                  return false;
90          }
91          else if (!this.routeName.equals(other.routeName))
92              return false;
93          return true;
94      }
95  
96      @Override
97      public String toString()
98      {
99          return "RouteData [routeName=" + this.routeName + ", startNode=" + this.startNode + ", endNode=" + this.endNode + "]";
100     }
101 
102 }