View Javadoc
1   package org.opentrafficsim.road.gtu.lane;
2   
3   import org.opentrafficsim.core.gtu.GTUType;
4   
5   /**
6    * Factory for vehicle models.
7    * <p>
8    * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
10   * <p>
11   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 8 jan. 2019 <br>
12   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
14   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
15   */
16  public interface VehicleModelFactory
17  {
18  
19      /** No vehicle model. */
20      VehicleModelFactory NONE = fixed(VehicleModel.NONE);
21  
22      /** Acceleration bounded vehicle model. */
23      VehicleModelFactory MINMAX = fixed(VehicleModel.MINMAX);
24  
25      /**
26       * Factory returning the same instance always.
27       * @param vehicleModel VehicleModel; vehicle model
28       * @return fixed vehicle model
29       */
30      static VehicleModelFactory fixed(final VehicleModel vehicleModel)
31      {
32          return new VehicleModelFactory()
33          {
34              @Override
35              public VehicleModel create(final GTUType gtuType)
36              {
37                  return vehicleModel;
38              }
39          };
40      }
41  
42      /**
43       * Create next vehicle model for given GTU type.
44       * @param gtuType GTUType; GTU type
45       * @return next vehicle model for given GTU type
46       */
47      VehicleModel create(GTUType gtuType);
48  
49  }