HeadwayBusStop.java

  1. package org.opentrafficsim.road.gtu.lane.perception.headway;

  2. import java.util.Set;

  3. import org.djunits.value.vdouble.scalar.Length;
  4. import org.djutils.immutablecollections.ImmutableSet;
  5. import org.opentrafficsim.core.gtu.GTUException;
  6. import org.opentrafficsim.road.gtu.lane.perception.RelativeLane;
  7. import org.opentrafficsim.road.network.lane.Lane;
  8. import org.opentrafficsim.road.network.lane.object.BusStop;

  9. /**
  10.  * <p>
  11.  * Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  12.  * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
  13.  * <p>
  14.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version 27 jan. 2017 <br>
  15.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  16.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  17.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  18.  */
  19. public class HeadwayBusStop extends AbstractHeadwayLaneBasedObject
  20. {

  21.     /** */
  22.     private static final long serialVersionUID = 20170127L;

  23.     /** Relative lane. */
  24.     private final RelativeLane relativeLane;

  25.     /** Lines. */
  26.     private final ImmutableSet<String> lines;

  27.     /** Conflicts downstream of the bus stop. */
  28.     private final Set<String> conflictIds;

  29.     /**
  30.      * @param busStop BusStop; bus stop
  31.      * @param distance Length; distance
  32.      * @param relativeLane RelativeLane; relative lane
  33.      * @param conflictIds Set&lt;String&gt;; conflicts downstream of the bus stop
  34.      * @param lane Lane; lane
  35.      * @throws GTUException when id is null, or parameters are inconsistent
  36.      */
  37.     public HeadwayBusStop(final BusStop busStop, final Length distance, final RelativeLane relativeLane,
  38.             final Set<String> conflictIds, final Lane lane) throws GTUException
  39.     {
  40.         super(ObjectType.BUSSTOP, busStop.getId(), distance, lane);
  41.         this.relativeLane = relativeLane;
  42.         this.lines = busStop.getLines();
  43.         this.conflictIds = conflictIds;
  44.     }

  45.     /**
  46.      * @return relativeLane.
  47.      */
  48.     public final RelativeLane getRelativeLane()
  49.     {
  50.         return this.relativeLane;
  51.     }

  52.     /**
  53.      * @return lines.
  54.      */
  55.     public final ImmutableSet<String> getLines()
  56.     {
  57.         return this.lines;
  58.     }

  59.     /**
  60.      * @return conflictIds.
  61.      */
  62.     public final Set<String> getConflictIds()
  63.     {
  64.         return this.conflictIds;
  65.     }

  66.     /** {@inheritDoc} */
  67.     @Override
  68.     public final String toString()
  69.     {
  70.         return "HeadwayBusStop [relativeLane=" + this.relativeLane + ", lines=" + this.lines + ", conflictIds="
  71.                 + this.conflictIds + "]";
  72.     }

  73. }