View Javadoc
1   package org.opentrafficsim.demo.carFollowing;
2   
3   import java.lang.reflect.Field;
4   import java.util.Set;
5   
6   import nl.tudelft.simulation.language.reflection.ClassUtil;
7   
8   import org.djunits.unit.LengthUnit;
9   import org.djunits.value.vdouble.scalar.Length;
10  import org.opentrafficsim.core.gtu.behavioralcharacteristics.BehavioralCharacteristics;
11  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterException;
12  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterType;
13  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypeBoolean;
14  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypeDouble;
15  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypeInteger;
16  import org.opentrafficsim.core.gtu.behavioralcharacteristics.ParameterTypes;
17  
18  /**
19   * Factory for defaults in demos.
20   * <p>
21   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
22   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
23   * </p>
24   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
25   * initial version Apr 8, 2016 <br>
26   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
27   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
28   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
29   */
30  public final class DefaultsFactory
31  {
32  
33      /**
34       * Do not create instance.
35       */
36      private DefaultsFactory()
37      {
38          //
39      }
40      
41      /**
42       * Returns a default set of behavioral characteristics.
43       * @return Default set of behavioral characteristics.
44       */
45      public static BehavioralCharacteristics getDefaultBehavioralCharacteristics()
46      {
47          
48          BehavioralCharacteristics bc = new BehavioralCharacteristics().setDefaultParameters(ParameterTypes.class);
49  
50          // demos use different value from default LMRS value
51          try
52          {
53              bc.setParameter(ParameterTypes.LOOKAHEAD, new Length(250, LengthUnit.SI));
54          }
55          catch (ParameterException pe)
56          {
57              throw new RuntimeException("Parameter type 'LOOKAHEAD' could not be set.", pe);
58          }
59  
60          return bc;
61          
62      }
63  
64  }