1 package org.opentrafficsim.road.gtu.lane;
2
3 import java.util.Map;
4
5 import nl.tudelft.simulation.dsol.SimRuntimeException;
6
7 import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface;
8 import org.opentrafficsim.core.gtu.GTUException;
9 import org.opentrafficsim.core.gtu.GTUType;
10 import org.opentrafficsim.core.gtu.TemplateGTUType;
11 import org.opentrafficsim.core.network.NetworkException;
12 import org.opentrafficsim.road.gtu.following.GTUFollowingModel;
13 import org.opentrafficsim.road.network.lane.Lane;
14 import org.opentrafficsim.road.network.route.CompleteLaneBasedRouteNavigator;
15
16
17
18
19
20
21
22
23
24
25
26 public abstract class AbstractLaneBasedTemplateGTU extends AbstractLaneBasedGTU
27 {
28
29 private static final long serialVersionUID = 20140822L;
30
31
32 private TemplateGTUType templateGTUType;
33
34
35
36
37
38
39
40
41
42
43
44
45 public AbstractLaneBasedTemplateGTU(final String id, final TemplateGTUType templateGTUType,
46 final GTUFollowingModel gtuFollowingModel, final Map<Lane, Length.Rel> initialLongitudinalPositions,
47 final Speed.Abs initialSpeed, final CompleteLaneBasedRouteNavigator routeNavigator) throws
48 NetworkException, SimRuntimeException, GTUException
49 {
50 super(id, templateGTUType.getGtuType(), gtuFollowingModel, null , initialLongitudinalPositions,
51 initialSpeed, routeNavigator, templateGTUType.getSimulator());
52 this.templateGTUType = templateGTUType;
53 }
54
55
56 @SuppressWarnings("checkstyle:designforextension")
57 @Override
58 public GTUType getGTUType()
59 {
60 return super.getGTUType();
61 }
62
63
64 @Override
65 public final Length.Rel getLength()
66 {
67 return this.templateGTUType.getLength();
68 }
69
70
71 @Override
72 public final Length.Rel getWidth()
73 {
74 return this.templateGTUType.getWidth();
75 }
76
77
78 @Override
79 public final Speed.Abs getMaximumVelocity()
80 {
81 return this.templateGTUType.getMaximumVelocity();
82 }
83
84
85 @Override
86 public final OTSDEVSSimulatorInterface getSimulator()
87 {
88 return this.templateGTUType.getSimulator();
89 }
90
91 }