LaneBasedStrategicalPlannerFactory.java

  1. package org.opentrafficsim.road.gtu.strategical;

  2. import org.djunits.value.vdouble.scalar.Length;
  3. import org.djunits.value.vdouble.scalar.Speed;
  4. import org.opentrafficsim.core.gtu.GTUException;
  5. import org.opentrafficsim.core.gtu.GTUType;
  6. import org.opentrafficsim.core.network.Node;
  7. import org.opentrafficsim.core.network.route.Route;
  8. import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;

  9. /**
  10.  * A factory class is used to generate strategical planners as the strategical planner is state-full.
  11.  * <p>
  12.  * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  13.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
  14.  * <p>
  15.  * @version $Revision$, $LastChangedDate$, by $Author$, initial version Jul 29, 2016 <br>
  16.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  17.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  18.  * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
  19.  * @param <T> class of the strategical planner generated
  20.  */
  21. public interface LaneBasedStrategicalPlannerFactory<T extends LaneBasedStrategicalPlanner>
  22. {

  23.     /**
  24.      * Creates a new strategical planner for the given GTU. This method should also set the parameters at the GTU.
  25.      * @param gtu GTU
  26.      * @param route route, may be null
  27.      * @param origin origin, may be null
  28.      * @param destination destination, may be null
  29.      * @return strategical planner for the given GTU
  30.      * @throws GTUException if the gtu is not suitable in any way for the creation of the strategical planner
  31.      */
  32.     T create(LaneBasedGTU gtu, Route route, Node origin, Node destination) throws GTUException;

  33.     /**
  34.      * Peek to see the desired speed of the next GTU to be generated at the given location. The default implementation returns
  35.      * {@code null}, at which point the GTU generator will use some other speed.
  36.      * @param gtuType GTUType; GTU type
  37.      * @param speedLimit Speed; speed limit
  38.      * @param maxGtuSpeed Speed; maximum GTU speed
  39.      * @return desired speed of the next GTU to be generated at the given location, may be {@code null} at which point the GTU
  40.      *         generator will use some other speed
  41.      * @throws GTUException on parameter exception or network exception
  42.      */
  43.     default Speed peekDesiredSpeed(final GTUType gtuType, final Speed speedLimit, final Speed maxGtuSpeed) throws GTUException
  44.     {
  45.         return null;
  46.     }

  47.     /**
  48.      * Peek to see the desired headway of the next GTU to be generated at the given speed. The default implementation returns
  49.      * {@code null}, at which point the GTU generator will only generate GTU's at fixed locations.
  50.      * @param gtuType GTUType; GTU type
  51.      * @param speed Speed; speed the GTU might be generated at
  52.      * @return Length; desired headway of the next GTU to be generated at the given speed, may be {@code null} at which point
  53.      *         the GTU generator only generate GTU's at fixed locations
  54.      * @throws GTUException on parameter exception or network exception
  55.      */
  56.     default Length peekDesiredHeadway(final GTUType gtuType, final Speed speed) throws GTUException
  57.     {
  58.         return null;
  59.     }

  60. }