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://tudelft.nl/staff/p.knoppers-1">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 String; name of the route
25       * @param startNode String; data of the start node of the route
26       * @param endNode String; 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      /** {@inheritDoc} */
68      @Override
69      public int hashCode()
70      {
71          final int prime = 31;
72          int result = 1;
73          result = prime * result + ((this.routeName == null) ? 0 : this.routeName.hashCode());
74          return result;
75      }
76  
77      /** {@inheritDoc} */
78      @Override
79      public boolean equals(final Object obj)
80      {
81          if (this == obj)
82              return true;
83          if (obj == null)
84              return false;
85          if (getClass() != obj.getClass())
86              return false;
87          RouteData other = (RouteData) obj;
88          if (this.routeName == null)
89          {
90              if (other.routeName != null)
91                  return false;
92          }
93          else if (!this.routeName.equals(other.routeName))
94              return false;
95          return true;
96      }
97  
98      /** {@inheritDoc} */
99      @Override
100     public String toString()
101     {
102         return "RouteData [routeName=" + this.routeName + ", startNode=" + this.startNode + ", endNode=" + this.endNode + "]";
103     }
104 
105 }