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.core.gtu.GTUException;
8 import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
9 import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
10 import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypes;
11 import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
12 import org.opentrafficsim.road.gtu.lane.tactical.following.GTUFollowingModelOld;
13 import org.opentrafficsim.road.gtu.lane.tactical.lanechangemobil.AbstractLaneChangeModel;
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class LaneBasedCFLCTacticalPlannerFactory implements LaneBasedTacticalPlannerFactory<LaneBasedCFLCTacticalPlanner>, Serializable
28 {
29
30
31 private static final long serialVersionUID = 20160811L;
32
33
34 private GTUFollowingModelOld carFollowingModel;
35
36
37 private AbstractLaneChangeModel laneChangeModel;
38
39
40
41
42
43
44 public LaneBasedCFLCTacticalPlannerFactory(final GTUFollowingModelOld carFollowingModel,
45 final AbstractLaneChangeModel laneChangeModel)
46 {
47 this.carFollowingModel = carFollowingModel;
48 this.laneChangeModel = laneChangeModel;
49 }
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
59 @Override
60 public final BehavioralCharacteristics getDefaultBehavioralCharacteristics()
61 {
62 BehavioralCharacteristics bc = new BehavioralCharacteristics().setDefaultParameters(ParameterTypes.class);
63 try
64 {
65 bc.setParameter(ParameterTypes.LOOKAHEAD, new Length(250, LengthUnit.SI));
66 }
67 catch (ParameterException pe)
68 {
69 throw new RuntimeException("Parameter type 'LOOKAHEAD' could not be set.", pe);
70 }
71 return bc;
72 }
73
74
75 public final String toString()
76 {
77 return "LaneBasedCFLCTacticalPlannerFactory [car-following=" + this.carFollowingModel + ", lane changing="
78 + this.laneChangeModel + "]";
79 }
80
81 }