Class Definitions
java.lang.Object
org.opentrafficsim.core.definitions.Definitions
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 Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends HierarchicalType<T,
?>>
voidAdd a type (e.g. a GtuType instance).<T extends HierarchicalType<T,
?>>
TObtain a type by its id.<T extends HierarchicalType<T,
?>>
org.djutils.immutablecollections.ImmutableMap<String,T> Obtain all present type of given type type.
-
Constructor Details
-
Definitions
public Definitions()
-
-
Method Details
-
add
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
Obtain a type by its id. Returnsnull
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.
-