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 import org.opentrafficsim.road.gtu.lane.tactical.lanechangemobil.LaneChangeModel;
15
16
17
18
19
20
21
22
23
24
25
26
27 public class LaneBasedCfLcTacticalPlannerFactory
28 implements LaneBasedTacticalPlannerFactory<LaneBasedCfLcTacticalPlanner>, Serializable
29 {
30
31
32 private static final long serialVersionUID = 20160811L;
33
34
35 private GtuFollowingModelOld carFollowingModel;
36
37
38 private LaneChangeModel laneChangeModel;
39
40
41
42
43
44
45 public LaneBasedCfLcTacticalPlannerFactory(final GtuFollowingModelOld carFollowingModel,
46 final LaneChangeModel laneChangeModel)
47 {
48 this.carFollowingModel = carFollowingModel;
49 this.laneChangeModel = laneChangeModel;
50 }
51
52 @Override
53 public final LaneBasedCfLcTacticalPlanner create(final LaneBasedGtu gtu) throws GtuException
54 {
55 return new LaneBasedCfLcTacticalPlanner(this.carFollowingModel, this.laneChangeModel, gtu);
56 }
57
58 @Override
59 public final Parameters getParameters()
60 {
61 Parameters params = new ParameterSet().setDefaultParameters(ParameterTypes.class);
62 try
63 {
64 params.setParameter(ParameterTypes.LOOKAHEAD, new Length(250, LengthUnit.SI));
65 }
66 catch (ParameterException pe)
67 {
68 throw new RuntimeException("Parameter type 'LOOKAHEAD' could not be set.", pe);
69 }
70 return params;
71 }
72
73 @Override
74 public final String toString()
75 {
76 return "LaneBasedCFLCTacticalPlannerFactory [car-following=" + this.carFollowingModel + ", lane changing="
77 + this.laneChangeModel + "]";
78 }
79
80 }