Interface ModelComponentFactory
- All Known Subinterfaces:
CarFollowingModelFactory<T>,LaneBasedTacticalPlannerFactory<T>,ModelComponentSupplier<T>,PerceptionFactory
- All Known Implementing Classes:
AbstractIdmFactory,AbstractLaneBasedTacticalPlannerFactory,DefaultLmrsPerceptionFactory,IdmFactory,IdmPlusFactory,IdmPlusMultiFactory,LmrsFactory,LmrsFactoryOld
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for factories of model components, such as strategical planners, tactical planners and car-following models. This
interface defines no method to obtain the model component. This is because different factories may require different input.
For all cases that require no input
ModelComponentSupplier defines an additional get() method.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Method Summary
Modifier and TypeMethodDescriptiongetParameters(GtuType gtuType) Returns parameters for the given component.
-
Method Details
-
getParameters
Returns parameters for the given component. These parameters should contain, and possibly overwrite, parameters from sub-components. A parameter factory at the highest level (strategical planner) may overwrite any parameter. This combination allows that for sub-components, default factories can be used, while the parameter factory only overwrites parameters different for specific GTU types. The default implementation returns all default parameter values declared at the class.
Conventional use is:
Parameters parameters = this.subComponent1Factory.getParameters(); this.subComponent2Factory.getParameters().setAllIn(parameters); parameters.setDefaultParameters(componentClass); parameters.setDefaultParameters(staticUtilityClass); return parameters;
where all parameters used incomponentClassare defined or forwarded incomponentClass.
// forwarded public static final ParameterTypeAcceleration A = ParameterTypes.A; // defined public static final ParameterTypeDouble FACTOR = new ParameterTypeDouble("factor", "factor on response", 1.0);The same holds for static utilities that are used. Parameters should be defined at the utility class, and parameters of used utilities should be included.
Because high-level model components might determine what low-level components to use depending on GTU type, and hence which parameters might be required, the GTU type is given as input. Many components will however not need it to return the required parameters.
- Parameters:
gtuType- GTU type- Returns:
- parameters for the given component
- Throws:
ParameterException- on parameter exception
-