View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception.headway;
2   
3   import java.util.Set;
4   
5   import org.djunits.value.vdouble.scalar.Length;
6   import org.djutils.immutablecollections.ImmutableSet;
7   import org.opentrafficsim.core.gtu.GTUException;
8   import org.opentrafficsim.road.gtu.lane.perception.RelativeLane;
9   import org.opentrafficsim.road.network.lane.Lane;
10  import org.opentrafficsim.road.network.lane.object.BusStop;
11  
12  /**
13   * <p>
14   * Copyright (c) 2013-2020 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/node/13">OpenTrafficSim License</a>.
16   * <p>
17   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 27 jan. 2017 <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   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
21   */
22  public class HeadwayBusStop extends AbstractHeadwayLaneBasedObject
23  {
24  
25      /** */
26      private static final long serialVersionUID = 20170127L;
27  
28      /** Relative lane. */
29      private final RelativeLane relativeLane;
30  
31      /** Lines. */
32      private final ImmutableSet<String> lines;
33  
34      /** Conflicts downstream of the bus stop. */
35      private final Set<String> conflictIds;
36  
37      /**
38       * @param busStop BusStop; bus stop
39       * @param distance Length; distance
40       * @param relativeLane RelativeLane; relative lane
41       * @param conflictIds Set&lt;String&gt;; conflicts downstream of the bus stop
42       * @param lane Lane; lane
43       * @throws GTUException when id is null, or parameters are inconsistent
44       */
45      public HeadwayBusStop(final BusStop busStop, final Length distance, final RelativeLane relativeLane,
46              final Set<String> conflictIds, final Lane lane) throws GTUException
47      {
48          super(ObjectType.BUSSTOP, busStop.getId(), distance, lane);
49          this.relativeLane = relativeLane;
50          this.lines = busStop.getLines();
51          this.conflictIds = conflictIds;
52      }
53  
54      /**
55       * @return relativeLane.
56       */
57      public final RelativeLane getRelativeLane()
58      {
59          return this.relativeLane;
60      }
61  
62      /**
63       * @return lines.
64       */
65      public final ImmutableSet<String> getLines()
66      {
67          return this.lines;
68      }
69  
70      /**
71       * @return conflictIds.
72       */
73      public final Set<String> getConflictIds()
74      {
75          return this.conflictIds;
76      }
77  
78      /** {@inheritDoc} */
79      @Override
80      public final String toString()
81      {
82          return "HeadwayBusStop [relativeLane=" + this.relativeLane + ", lines=" + this.lines + ", conflictIds="
83                  + this.conflictIds + "]";
84      }
85  
86  }