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