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.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-2017 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      /** Route. */
30      private final Route route;
31  
32      /** The maximum speed of the GTU. */
33      private final Speed speed;
34  
35      /** The initial lanes, positions and direction of the GTU. */
36      private final Set<DirectedLanePosition> initialLongitudinalPositions;
37  
38      /**
39       * Construct a new set of lane based GTU characteristics.
40       * @param gtuCharacteristics GTUCharacteristics; characteristics of the super GTU type to be used for the GTU
41       * @param laneBasedStrategicalPlannerFactory LaneBasedStrategicalPlannerFactory; the strategical planner for the GTU
42       * @param route route
43       * @param speed Speed; the initial speed of the GTU
44       * @param initialLongitudinalPositions Set&lt;DirectedLanePosition&gt;; the lane, initial position and direction of the GTU
45       */
46      public LaneBasedGTUCharacteristics(final GTUCharacteristics gtuCharacteristics,
47              final LaneBasedStrategicalPlannerFactory<?> laneBasedStrategicalPlannerFactory, final Route route,
48              final Speed speed, final Set<DirectedLanePosition> initialLongitudinalPositions)
49      {
50          super(gtuCharacteristics.getGTUType(), gtuCharacteristics.getIdGenerator(), gtuCharacteristics.getLength(),
51                  gtuCharacteristics.getWidth(), gtuCharacteristics.getMaximumSpeed(), gtuCharacteristics.getSimulator(),
52                  gtuCharacteristics.getNetwork());
53          this.strategicalPlannerFactory = laneBasedStrategicalPlannerFactory;
54          this.route = route;
55          this.speed = speed;
56          this.initialLongitudinalPositions = initialLongitudinalPositions;
57      }
58  
59      /**
60       * @return LaneBasedStrategicalPlannerFactory; the strategical planner factory for the GTU
61       */
62      public final LaneBasedStrategicalPlannerFactory<?> getStrategicalPlannerFactory()
63      {
64          return this.strategicalPlannerFactory;
65      }
66  
67      /**
68       * @return Route; route
69       */
70      public final Route getRoute()
71      {
72          return this.route;
73      }
74  
75      /**
76       * @return Speed; the maximum speed of the GTU
77       */
78      public final Speed getSpeed()
79      {
80          return this.speed;
81      }
82  
83      /**
84       * @return Set&lt;DirectedLanePosition&gt;; the position and direction on each lane that the GTU will initially be on
85       */
86      public final Set<DirectedLanePosition> getInitialLongitudinalPositions()
87      {
88          return this.initialLongitudinalPositions;
89      }
90  
91  }