Class Definitions

java.lang.Object
org.opentrafficsim.core.definitions.Definitions

public class Definitions extends Object
The Definitions interface contains access to the core definitions that can be used to interpret the Network and the PerceivableContext. Example interfaces allow the retrieval of GtuTypes and LinkTypes.

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
  • Constructor Details

    • Definitions

      public Definitions()
  • Method Details

    • add

      public <T extends HierarchicalType<T, ?>> void add(Class<T> typeClass, T t)
      Add a type (e.g. a GtuType instance).
      Type Parameters:
      T - type type (e.g. GtuType).
      Parameters:
      typeClass - Class<T>; class of type (e.g. GtuType.class).
      t - T; type instance (e.g DefaultsNl.CAR).
    • get

      public <T extends HierarchicalType<T, ?>> T get(Class<T> typeClass, String id)
      Obtain a type by its id. Returns null if it is not present.
      Type Parameters:
      T - type type (e.g. GtuType).
      Parameters:
      typeClass - typeClass Class<T>; class of type (e.g. GtuType.class).
      id - String; id of the class.
      Returns:
      T; instance with given id, or null if it is not present.
    • getAll

      public <T extends HierarchicalType<T, ?>> org.djutils.immutablecollections.ImmutableMap<String,T> getAll(Class<T> typeClass)
      Obtain all present type of given type type.
      Type Parameters:
      T - type type (e.g. GtuType).
      Parameters:
      typeClass - typeClass Class<T>; class of type (e.g. GtuType.class).
      Returns:
      ImmutableMap<String, T>; map of all types of give type type, empty if there are no types of the type type.