Class AbstractLaneBasedStrategicalPlannerFactory<T extends LaneBasedStrategicalPlanner>
- java.lang.Object
-
- org.opentrafficsim.road.gtu.strategical.AbstractLaneBasedStrategicalPlannerFactory<T>
-
- Type Parameters:
T- class of the strategical planner generated
- All Implemented Interfaces:
LaneBasedStrategicalPlannerFactory<T>
- Direct Known Subclasses:
LaneBasedStrategicalRoutePlannerFactory
public abstract class AbstractLaneBasedStrategicalPlannerFactory<T extends LaneBasedStrategicalPlanner> extends java.lang.Object implements LaneBasedStrategicalPlannerFactory<T>
Factory for creatingLaneBasedStrategicalRoutePlannerusing anyLaneBasedTacticalPlannerFactory. This abstract class deals with forwarding peeking from the GTU generator to the tactical planner factory. Parameters are set using aParameterFactory, after the methodsetParameters()has been called, which subclasses need to implement.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 12 jan. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description AbstractLaneBasedStrategicalPlannerFactory(LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> tacticalPlannerFactory)Constructor with factory for tactical planners.AbstractLaneBasedStrategicalPlannerFactory(LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> tacticalPlannerFactory, ParameterFactory parametersFactory)Constructor with factory for tactical planners.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ParametersgetParameters()Returns parameters specific to the strategical planner.protected LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner>getTacticalPlannerFactory()Returns the tactical planner factory.protected ParametersnextParameters(GTUType gtuType)Returns the parameters for the next GTU.protected LaneBasedTacticalPlannernextTacticalPlanner(LaneBasedGTU gtu)Returns the next tactical planner.LengthpeekDesiredHeadway(GTUType gtuType, Speed speed)Peek to see the desired headway of the next GTU to be generated at the given speed.SpeedpeekDesiredSpeed(GTUType gtuType, Speed speedLimit, Speed maxGtuSpeed)Peek to see the desired speed of the next GTU to be generated at the given location.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.road.gtu.strategical.LaneBasedStrategicalPlannerFactory
create
-
-
-
-
Constructor Detail
-
AbstractLaneBasedStrategicalPlannerFactory
public AbstractLaneBasedStrategicalPlannerFactory(LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> tacticalPlannerFactory)
Constructor with factory for tactical planners.- Parameters:
tacticalPlannerFactory- LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner>; factory for tactical planners
-
AbstractLaneBasedStrategicalPlannerFactory
public AbstractLaneBasedStrategicalPlannerFactory(LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> tacticalPlannerFactory, ParameterFactory parametersFactory)
Constructor with factory for tactical planners.- Parameters:
tacticalPlannerFactory- LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner>; factory for tactical plannersparametersFactory- ParameterFactory; factory for parameters
-
-
Method Detail
-
peekDesiredSpeed
public final Speed peekDesiredSpeed(GTUType gtuType, Speed speedLimit, Speed maxGtuSpeed) throws GTUException
Peek to see the desired speed of the next GTU to be generated at the given location. The default implementation returnsnull, at which point the GTU generator will use some other speed.- Specified by:
peekDesiredSpeedin interfaceLaneBasedStrategicalPlannerFactory<T extends LaneBasedStrategicalPlanner>- Parameters:
gtuType- GTUType; GTU typespeedLimit- Speed; speed limitmaxGtuSpeed- Speed; maximum GTU speed- Returns:
- desired speed of the next GTU to be generated at the given location, may be
nullat which point the GTU generator will use some other speed - Throws:
GTUException- on parameter exception or network exception
-
peekDesiredHeadway
public final Length peekDesiredHeadway(GTUType gtuType, Speed speed) throws GTUException
Peek to see the desired headway of the next GTU to be generated at the given speed. The default implementation returnsnull, at which point the GTU generator will only generate GTU's at fixed locations.- Specified by:
peekDesiredHeadwayin interfaceLaneBasedStrategicalPlannerFactory<T extends LaneBasedStrategicalPlanner>- Parameters:
gtuType- GTUType; GTU typespeed- Speed; speed the GTU might be generated at- Returns:
- Length; desired headway of the next GTU to be generated at the given speed, may be
nullat which point the GTU generator only generate GTU's at fixed locations - Throws:
GTUException- on parameter exception or network exception
-
getParameters
protected abstract Parameters getParameters()
Returns parameters specific to the strategical planner. The input already contains parameters from the tactical planner. After this method, theParameterFactorysets or overwrites additional parameters. Hence, this method may set default (distributed) values for parameters specific to the strategical planner.- Returns:
- parameters Parameters; parameters for the strategical planner, may be
null
-
nextParameters
protected final Parameters nextParameters(GTUType gtuType) throws GTUException
Returns the parameters for the next GTU.- Parameters:
gtuType- GTUType; GTU type of GTU to be generated- Returns:
- Parameters; parameters for the next GTU
- Throws:
GTUException- on parameter exception
-
nextTacticalPlanner
protected final LaneBasedTacticalPlanner nextTacticalPlanner(LaneBasedGTU gtu) throws GTUException
Returns the next tactical planner.- Parameters:
gtu- LaneBasedGTU; GTU to be generated- Returns:
- T; next tactical planner
- Throws:
GTUException- on exception during tactical planner creation
-
getTacticalPlannerFactory
protected final LaneBasedTacticalPlannerFactory<? extends LaneBasedTacticalPlanner> getTacticalPlannerFactory()
Returns the tactical planner factory.- Returns:
- LaneBasedTacticalPlannerFactory; tactical planner factory
-
-