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
53 @Override
54 public final LaneBasedCfLcTacticalPlanner create(final LaneBasedGtu gtu) throws GtuException
55 {
56 return new LaneBasedCfLcTacticalPlanner(this.carFollowingModel, this.laneChangeModel, gtu);
57 }
58
59
60 @Override
61 public final Parameters getParameters()
62 {
63 Parameters params = new ParameterSet().setDefaultParameters(ParameterTypes.class);
64 try
65 {
66 params.setParameter(ParameterTypes.LOOKAHEAD, new Length(250, LengthUnit.SI));
67 }
68 catch (ParameterException pe)
69 {
70 throw new RuntimeException("Parameter type 'LOOKAHEAD' could not be set.", pe);
71 }
72 return params;
73 }
74
75
76 @Override
77 public final String toString()
78 {
79 return "LaneBasedCFLCTacticalPlannerFactory [car-following=" + this.carFollowingModel + ", lane changing="
80 + this.laneChangeModel + "]";
81 }
82
83 }