1 package org.opentrafficsim.sim0mq.kpi;
2
3 import org.opentrafficsim.kpi.interfaces.GtuTypeDataInterface;
4
5 /**
6 * <p>
7 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
8 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
9 * <p>
10 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 13 okt. 2016 <br>
11 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
12 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
13 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
14 */
15 public class GtuTypeData implements GtuTypeDataInterface
16 {
17 /** type name. */
18 private final String gtuTypeName;
19
20 /**
21 * @param gtuTypeName String; gtu type name
22 */
23 public GtuTypeData(final String gtuTypeName)
24 {
25 this.gtuTypeName = gtuTypeName;
26 }
27
28 /**
29 * @return gtuTypeName
30 */
31 public final String getGtuTypeName()
32 {
33 return this.gtuTypeName;
34 }
35
36 /** {@inheritDoc} */
37 @Override
38 public String getId()
39 {
40 return this.gtuTypeName;
41 }
42
43 /** {@inheritDoc} */
44 @Override
45 public int hashCode()
46 {
47 final int prime = 31;
48 int result = 1;
49 result = prime * result + ((this.gtuTypeName == null) ? 0 : this.gtuTypeName.hashCode());
50 return result;
51 }
52
53 /** {@inheritDoc} */
54 @Override
55 public boolean equals(Object obj)
56 {
57 if (this == obj)
58 return true;
59 if (obj == null)
60 return false;
61 if (getClass() != obj.getClass())
62 return false;
63 GtuTypeData other = (GtuTypeData) obj;
64 if (this.gtuTypeName == null)
65 {
66 if (other.gtuTypeName != null)
67 return false;
68 }
69 else if (!this.gtuTypeName.equals(other.gtuTypeName))
70 return false;
71 return true;
72 }
73
74 /** {@inheritDoc} */
75 @Override
76 public String toString()
77 {
78 return "GtuTypeData [gtuTypeName=" + this.gtuTypeName + "]";
79 }
80
81 }