View Javadoc
1   package org.opentrafficsim.road.gtu.perception.object;
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.road.gtu.perception.RelativeLane;
8   import org.opentrafficsim.road.network.Lane;
9   import org.opentrafficsim.road.network.object.BusStop;
10  
11  /**
12   * Perceived bus stop.
13   * <p>
14   * Copyright (c) 2013-2026 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 Alexander Verbraeck
18   * @author Peter Knoppers
19   * @author Wouter Schakel
20   */
21  public class PerceivedBusStop extends PerceivedLaneBasedObjectBase
22  {
23  
24      /** Relative lane. */
25      private final RelativeLane relativeLane;
26  
27      /** Lines. */
28      private final ImmutableSet<String> lines;
29  
30      /** Conflicts downstream of the bus stop. */
31      private final Set<String> conflictIds;
32  
33      /**
34       * Constructor.
35       * @param busStop bus stop
36       * @param distance distance
37       * @param relativeLane relative lane
38       * @param conflictIds conflicts downstream of the bus stop
39       * @param lane lane
40       */
41      public PerceivedBusStop(final BusStop busStop, final Length distance, final RelativeLane relativeLane,
42              final Set<String> conflictIds, final Lane lane)
43      {
44          super(busStop.getId(), ObjectType.BUSSTOP, Length.ZERO, Kinematics.staticAhead(distance), lane);
45          this.relativeLane = relativeLane;
46          this.lines = busStop.getLines();
47          this.conflictIds = conflictIds;
48      }
49  
50      /**
51       * Returns relative lane.
52       * @return relativeLane.
53       */
54      public final RelativeLane getRelativeLane()
55      {
56          return this.relativeLane;
57      }
58  
59      /**
60       * Returns lines.
61       * @return lines.
62       */
63      public final ImmutableSet<String> getLines()
64      {
65          return this.lines;
66      }
67  
68      /**
69       * Returns conflict ids.
70       * @return conflictIds.
71       */
72      public final Set<String> getConflictIds()
73      {
74          return this.conflictIds;
75      }
76  
77      @Override
78      public final String toString()
79      {
80          return "PerceivedBusStop [relativeLane=" + this.relativeLane + ", lines=" + this.lines + ", conflictIds="
81                  + this.conflictIds + "]";
82      }
83  
84  }