Class DefaultsRoad

java.lang.Object
org.opentrafficsim.core.definitions.Defaults
org.opentrafficsim.road.definitions.DefaultsRoad
Direct Known Subclasses:
DefaultsRoadNl

public abstract class DefaultsRoad extends Defaults
This class houses defaults instances for different types, specific for road, such as lane types. The static fields should only be accessed in the setup of a simulation. The simulation itself should be fed the relevant types, and not assume any specific or more generic super type. Only in this way can simulations be run with entirely different type structures.

Copyright (c) 2022-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
  • Field Details

    • NL

      public static final DefaultsRoadNl NL
      Defaults for locale nl_NL.
  • Constructor Details

    • DefaultsRoad

      protected DefaultsRoad(Locale locale)
      Constructor.
      Parameters:
      locale - Locale; locale.
  • Method Details

    • getByName

      public static <T> T getByName(Class<T> clazz, String name)
      Returns a default value of a type, indicated by its name. This should only be used by parsers. Simulations defined in code should access the relevant static fields directly for code maintainability.
      Type Parameters:
      T - type of the value.
      Parameters:
      clazz - Class<T>; class instance of type T.
      name - String; name referring to a default through static field names, e.g. "NL.FREEWAY".
      Returns:
      T; returned default value, null if the default could not be found.