org.opentrafficsim.road.gtu.lane.VehicleModelFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-road Show documentation
Show all versions of ots-road Show documentation
OpenTrafficSim road classes
The newest version!
package org.opentrafficsim.road.gtu.lane;
import org.opentrafficsim.core.gtu.GtuType;
/**
* Factory for vehicle models.
*
* 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
* @author Peter Knoppers
* @author Wouter Schakel
*/
public interface VehicleModelFactory
{
/** No vehicle model. */
VehicleModelFactory NONE = fixed(VehicleModel.NONE);
/** Acceleration bounded vehicle model. */
VehicleModelFactory MINMAX = fixed(VehicleModel.MINMAX);
/**
* Factory returning the same instance always.
* @param vehicleModel VehicleModel; vehicle model
* @return fixed vehicle model
*/
static VehicleModelFactory fixed(final VehicleModel vehicleModel)
{
return new VehicleModelFactory()
{
@Override
public VehicleModel create(final GtuType gtuType)
{
return vehicleModel;
}
};
}
/**
* Create next vehicle model for given GTU type.
* @param gtuType GtuType; GTU type
* @return next vehicle model for given GTU type
*/
VehicleModel create(GtuType gtuType);
}