View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.toledo;
2   
3   import org.opentrafficsim.core.gtu.GTUException;
4   import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
5   import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
6   import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypes;
7   import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
8   import org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlannerFactory;
9   
10  /**
11   * Factory for tactical planner using Toledo's model and car-following model.
12   * <p>
13   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
15   * <p>
16   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Aug 2, 2016 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
20   */
21  
22  public class ToledoFactory implements LaneBasedTacticalPlannerFactory<Toledo>
23  {
24  
25      /** {@inheritDoc} */
26      @Override
27      public final BehavioralCharacteristics getDefaultBehavioralCharacteristics()
28      {
29          BehavioralCharacteristics behavioralCharacteristics = new BehavioralCharacteristics();
30          try
31          {
32              behavioralCharacteristics.setDefaultParameter(ParameterTypes.LOOKAHEAD);
33              // TODO remove LOOKBACKOLD and insert LOOKBACK once NeighborsPerception uses LOOKBACK
34              behavioralCharacteristics.setDefaultParameter(ParameterTypes.LOOKBACKOLD);
35          }
36          catch (ParameterException exception)
37          {
38              // should not happen for these 2 parameters
39              throw new RuntimeException(exception);
40          }
41          behavioralCharacteristics.setDefaultParameters(ToledoLaneChangeParameters.class);
42          behavioralCharacteristics.setDefaultParameters(ToledoCarFollowing.class);
43          behavioralCharacteristics.setDefaultParameters(Toledo.class);
44          return behavioralCharacteristics;
45      }
46  
47      /** {@inheritDoc} */
48      @Override
49      public final Toledo create(final LaneBasedGTU gtu) throws GTUException
50      {
51          return new Toledo(new ToledoCarFollowing(), gtu);
52      }
53      
54      /** {@inheritDoc} */
55      public final String toString()
56      {
57          return "ToledoFactory";
58      }
59      
60  }