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