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.object.BusStop;
10  
11  /**
12   * <p>
13   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
15   * <p>
16   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 27 jan. 2017 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
20   */
21  public class HeadwayBusStop extends AbstractHeadwayCopy
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       * @throws GTUException when id is null, or parameters are inconsistent
42       */
43      public HeadwayBusStop(final BusStop busStop, final Length distance, final RelativeLane relativeLane,
44              final Set<String> conflictIds) throws GTUException
45      {
46          super(ObjectType.BUSSTOP, busStop.getId(), distance);
47          this.relativeLane = relativeLane;
48          this.lines = busStop.getLines();
49          this.conflictIds = conflictIds;
50      }
51  
52      /**
53       * @return relativeLane.
54       */
55      public final RelativeLane getRelativeLane()
56      {
57          return this.relativeLane;
58      }
59  
60      /**
61       * @return lines.
62       */
63      public final ImmutableSet<String> getLines()
64      {
65          return this.lines;
66      }
67  
68      /**
69       * @return conflictIds.
70       */
71      public final Set<String> getConflictIds()
72      {
73          return this.conflictIds;
74      }
75  
76      /** {@inheritDoc} */
77      @Override
78      public final String toString()
79      {
80          return "HeadwayBusStop [relativeLane=" + this.relativeLane + ", lines=" + this.lines + ", conflictIds="
81                  + this.conflictIds + "]";
82      }
83  
84  }