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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
16   * </p>
17   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
19   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
20   */
21  public class HeadwayBusStop extends AbstractHeadwayLaneBasedObject
22  {
23  
24      /** */
25      private static final long serialVersionUID = 20170127L;
26  
27      /** Relative lane. */
28      private final RelativeLane relativeLane;
29  
30      /** Lines. */
31      private final ImmutableSet<String> lines;
32  
33      /** Conflicts downstream of the bus stop. */
34      private final Set<String> conflictIds;
35  
36      /**
37       * @param busStop BusStop; bus stop
38       * @param distance Length; distance
39       * @param relativeLane RelativeLane; relative lane
40       * @param conflictIds Set&lt;String&gt;; conflicts downstream of the bus stop
41       * @param lane Lane; lane
42       * @throws GtuException when id is null, or parameters are inconsistent
43       */
44      public HeadwayBusStop(final BusStop busStop, final Length distance, final RelativeLane relativeLane,
45              final Set<String> conflictIds, final Lane lane) throws GtuException
46      {
47          super(ObjectType.BUSSTOP, busStop.getId(), distance, lane);
48          this.relativeLane = relativeLane;
49          this.lines = busStop.getLines();
50          this.conflictIds = conflictIds;
51      }
52  
53      /**
54       * @return relativeLane.
55       */
56      public final RelativeLane getRelativeLane()
57      {
58          return this.relativeLane;
59      }
60  
61      /**
62       * @return lines.
63       */
64      public final ImmutableSet<String> getLines()
65      {
66          return this.lines;
67      }
68  
69      /**
70       * @return conflictIds.
71       */
72      public final Set<String> getConflictIds()
73      {
74          return this.conflictIds;
75      }
76  
77      /** {@inheritDoc} */
78      @Override
79      public final String toString()
80      {
81          return "HeadwayBusStop [relativeLane=" + this.relativeLane + ", lines=" + this.lines + ", conflictIds="
82                  + this.conflictIds + "]";
83      }
84  
85  }