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