GtuGenerator.java

  1. package org.opentrafficsim.core.gtu;

  2. import java.util.Set;

  3. import org.djutils.base.Identifiable;
  4. import org.djutils.draw.line.Polygon2d;
  5. import org.djutils.draw.point.OrientedPoint2d;
  6. import org.opentrafficsim.base.geometry.OtsLocatable;
  7. import org.opentrafficsim.core.object.NonLocatedObject;

  8. /**
  9.  * Gtu generator in its most basic form, which is able to report a queue count at one or more positions.
  10.  * <p>
  11.  * Copyright (c) 2022-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  12.  * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  13.  * </p>
  14.  * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
  15.  * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
  16.  * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
  17.  */
  18. public interface GtuGenerator extends NonLocatedObject
  19. {

  20.     /**
  21.      * Returns the positions.
  22.      * @return set of positions.
  23.      */
  24.     Set<GtuGeneratorPosition> getPositions();

  25.     /**
  26.      * Interface for a position that is reported on. This is a Locatable, with a queue count added to is.
  27.      * <p>
  28.      * Copyright (c) 2022-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
  29.      * <br>
  30.      * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  31.      * </p>
  32.      * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
  33.      * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
  34.      * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
  35.      */
  36.     interface GtuGeneratorPosition extends OtsLocatable, Identifiable
  37.     {
  38.         /**
  39.          * Returns the number of GTUs in the queue.
  40.          * @return number of GTUs in the queue.
  41.          */
  42.         int getQueueCount();

  43.         @Override
  44.         OrientedPoint2d getLocation();

  45.         @Override
  46.         default Polygon2d getContour()
  47.         {
  48.             throw new UnsupportedOperationException(
  49.                     "A GtuGeneratorPosition does not have geometry. Geometry should be defined in animation.");
  50.         }
  51.     }

  52. }