1 package org.opentrafficsim.road.gtu.lane.perception.object;
2
3 import java.util.Objects;
4
5 import org.djunits.value.vdouble.scalar.Length;
6 import org.djutils.exceptions.Throw;
7 import org.opentrafficsim.core.gtu.GtuType;
8
9
10
11
12
13
14
15
16
17
18
19 public class PerceivedGtuBase extends PerceivedGtuSimple
20 {
21
22
23 private final Behavior behavior;
24
25
26
27
28
29
30
31
32
33
34
35
36
37 @SuppressWarnings("parameternumber")
38 public PerceivedGtuBase(final String id, final GtuType gtuType, final Length length, final Length width,
39 final Kinematics kinematics, final Signals signals, final Maneuver maneuver, final Behavior behavior)
40 {
41 super(id, gtuType, length, width, kinematics, signals, maneuver);
42 this.behavior = Throw.whenNull(behavior, "behavior");
43 }
44
45 @Override
46 public Behavior getBehavior()
47 {
48 return this.behavior;
49 }
50
51
52 @Override
53 public int hashCode()
54 {
55 final int prime = 31;
56 int result = super.hashCode();
57 result = prime * result + Objects.hash(this.behavior);
58 return result;
59 }
60
61
62 @Override
63 public boolean equals(final Object obj)
64 {
65 if (this == obj)
66 {
67 return true;
68 }
69 if (!super.equals(obj))
70 {
71 return false;
72 }
73 if (getClass() != obj.getClass())
74 {
75 return false;
76 }
77 PerceivedGtuBase other = (PerceivedGtuBase) obj;
78 return Objects.equals(this.behavior, other.behavior);
79 }
80
81
82 @Override
83 public String toString()
84 {
85 return "PerceivedGtuBase [id=" + getId() + ", gtuType=" + getGtuType() + "]";
86 }
87
88 }