LaneBasedTacticalPlannerFactory.java

  1. package org.opentrafficsim.road.gtu.lane.tactical;

  2. import org.djunits.value.vdouble.scalar.Length;
  3. import org.djunits.value.vdouble.scalar.Speed;
  4. import org.opentrafficsim.base.parameters.Parameters;
  5. import org.opentrafficsim.core.gtu.GtuException;
  6. import org.opentrafficsim.core.gtu.GtuType;
  7. import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;

  8. /**
  9.  * A factory class is used to generate tactical planners as the tactical planner is state-full.
  10.  * <p>
  11.  * Copyright (c) 2013-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.  * @param <T> class of the tactical planner generated
  18.  */
  19. public interface LaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner> extends ModelComponentFactory
  20. {

  21.     /**
  22.      * Creates a new tactical planner for the given GTU.
  23.      * @param gtu GTU
  24.      * @return tactical planner for the given GTU
  25.      * @throws GtuException if the gtu is not suitable in any way for the creation of the tactical planner
  26.      */
  27.     T create(LaneBasedGtu gtu) throws GtuException;

  28.     /**
  29.      * Peek to see the desired speed of the next GTU to be generated at the given location. The default implementation returns
  30.      * {@code null}, at which point the GTU generator will use some other speed.
  31.      * @param gtuType GTU type
  32.      * @param speedLimit speed limit
  33.      * @param maxGtuSpeed maximum GTU speed
  34.      * @param parameters parameters for the next GTU
  35.      * @return desired speed of the next GTU to be generated at the given location, may be {@code null} at which point the GTU
  36.      *         generator will use some other speed
  37.      * @throws GtuException on any exception
  38.      */
  39.     default Speed peekDesiredSpeed(GtuType gtuType, Speed speedLimit, Speed maxGtuSpeed, Parameters parameters)
  40.             throws GtuException
  41.     {
  42.         return null;
  43.     }

  44.     /**
  45.      * Peek to see the desired headway of the next GTU to be generated at the given speed. The default implementation returns
  46.      * {@code null}, at which point the GTU generator will only generate GTU's at fixed locations.
  47.      * @param gtuType GTU type
  48.      * @param speed speed the GTU might be generated at
  49.      * @param parameters parameters for the next GTU
  50.      * @return desired headway of the next GTU to be generated at the given speed, may be {@code null} at which point the GTU
  51.      *         generator will only generate GTU's at fixed locations
  52.      * @throws GtuException on any exception
  53.      */
  54.     default Length peekDesiredHeadway(GtuType gtuType, Speed speed, Parameters parameters) throws GtuException
  55.     {
  56.         return null;
  57.     }

  58. }