View Javadoc
1   package org.opentrafficsim.road.gtu.lane;
2   
3   import java.util.Set;
4   
5   import org.djunits.value.vdouble.scalar.Speed;
6   import org.opentrafficsim.core.gtu.GTUCharacteristics;
7   import org.opentrafficsim.road.gtu.strategical.LaneBasedStrategicalPlanner;
8   import org.opentrafficsim.road.gtu.strategical.LaneBasedStrategicalPlannerFactory;
9   import org.opentrafficsim.road.network.lane.DirectedLanePosition;
10  
11  /**
12   * Characteristics for a lane base GTU. This class is used to store all characteristics of a (not-yet constructed) LaneBasedGTU.
13   * <p>
14   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
16   * <p>
17   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Mar 8, 2016 <br>
18   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20   */
21  public class LaneBasedGTUCharacteristics extends GTUCharacteristics
22  {
23      /** */
24      private static final long serialVersionUID = 1L;
25  
26      /** The strategical planner factory. */
27      private final LaneBasedStrategicalPlannerFactory<?> strategicalPlannerFactory;
28  
29      /** The maximum speed of the GTU. */
30      private final Speed speed;
31  
32      /** The initial lanes, positions and direction of the GTU. */
33      private final Set<DirectedLanePosition> initialLongitudinalPositions;
34  
35      /**
36       * Construct a new set of lane based GTU characteristics.
37       * @param gtuCharacteristics GTUCharacteristics; characteristics of the super GTU type to be used for the GTU
38       * @param laneBasedStrategicalPlannerFactory LaneBasedStrategicalPlannerFactory; the strategical planner for the GTU
39       * @param speed Speed; the initial speed of the GTU
40       * @param initialLongitudinalPositions Set&lt;DirectedLanePosition&gt;; the lane, initial position and direction of the GTU
41       */
42      public LaneBasedGTUCharacteristics(final GTUCharacteristics gtuCharacteristics, 
43              final LaneBasedStrategicalPlannerFactory<?> laneBasedStrategicalPlannerFactory, final Speed speed,
44              final Set<DirectedLanePosition> initialLongitudinalPositions)
45      {
46          super(gtuCharacteristics.getGTUType(), gtuCharacteristics.getIdGenerator(), gtuCharacteristics.getLength(),
47                  gtuCharacteristics.getWidth(), gtuCharacteristics.getMaximumSpeed(), gtuCharacteristics.getSimulator(),
48                  gtuCharacteristics.getNetwork());
49          this.strategicalPlannerFactory = laneBasedStrategicalPlannerFactory;
50          this.speed = speed;
51          this.initialLongitudinalPositions = initialLongitudinalPositions;
52      }
53  
54      /**
55       * @return LaneBasedStrategicalPlannerFactory; the strategical planner factory for the GTU
56       */
57      public final LaneBasedStrategicalPlannerFactory<?> getStrategicalPlannerFactory()
58      {
59          return this.strategicalPlannerFactory;
60      }
61  
62      /**
63       * @return Speed; the maximum speed of the GTU
64       */
65      public final Speed getSpeed()
66      {
67          return this.speed;
68      }
69  
70      /**
71       * @return Set&lt;DirectedLanePosition&gt;; the position and direction on each lane that the GTU will initially be on
72       */
73      public final Set<DirectedLanePosition> getInitialLongitudinalPositions()
74      {
75          return this.initialLongitudinalPositions;
76      }
77  
78  }