1 package org.opentrafficsim.road.gtu.lane.tactical;
2
3 import java.io.Serializable;
4
5 import org.djunits.unit.LengthUnit;
6 import org.djunits.value.vdouble.scalar.Length;
7 import org.opentrafficsim.base.parameters.ParameterException;
8 import org.opentrafficsim.base.parameters.ParameterSet;
9 import org.opentrafficsim.base.parameters.ParameterTypes;
10 import org.opentrafficsim.base.parameters.Parameters;
11 import org.opentrafficsim.core.gtu.GTUException;
12 import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
13 import org.opentrafficsim.road.gtu.lane.tactical.following.GTUFollowingModelOld;
14
15
16
17
18
19
20
21
22
23
24
25
26 public class LaneBasedGTUFollowingTacticalPlannerFactory
27 implements LaneBasedTacticalPlannerFactory<LaneBasedGTUFollowingTacticalPlanner>, Serializable
28 {
29
30
31 private static final long serialVersionUID = 20160811L;
32
33
34 private GTUFollowingModelOld carFollowingModel;
35
36
37
38
39
40 public LaneBasedGTUFollowingTacticalPlannerFactory(final GTUFollowingModelOld carFollowingModel)
41 {
42 this.carFollowingModel = carFollowingModel;
43 }
44
45
46 @Override
47 public final Parameters getParameters()
48 {
49 Parameters params = new ParameterSet().setDefaultParameters(ParameterTypes.class);
50 try
51 {
52 params.setParameter(ParameterTypes.LOOKAHEAD, new Length(250, LengthUnit.SI));
53 }
54 catch (ParameterException pe)
55 {
56 throw new RuntimeException("Parameter type 'LOOKAHEAD' could not be set.", pe);
57 }
58 return params;
59 }
60
61
62 @Override
63 public final LaneBasedGTUFollowingTacticalPlanner create(final LaneBasedGTU gtu) throws GTUException
64 {
65 return new LaneBasedGTUFollowingTacticalPlanner(this.carFollowingModel, gtu);
66 }
67
68
69 @Override
70 public final String toString()
71 {
72 return "LaneBasedGTUFollowingTacticalPlanner [car-following=" + this.carFollowingModel + "]";
73 }
74
75 }