1 package org.opentrafficsim.core.perception;
2
3 import java.util.Set;
4
5 import org.opentrafficsim.base.Identifiable;
6 import org.opentrafficsim.core.gtu.Gtu;
7
8 /**
9 * The Model package guarantees that objects that are used in an OTS study such as GTUs are retrievable. In a spatial model, for
10 * instance, objects need to be able to find each other. The model interface guarantees access to a number of important objects
11 * in the study.
12 * <p>
13 * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15 * </p>
16 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
17 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
18 */
19 public interface PerceivableContext extends Identifiable
20 {
21 /**
22 * Get a descriptive Id of the perceivable context (e.g., useful for debugging purposes).
23 * @return the id of the context
24 */
25 @Override
26 String getId();
27
28 /**
29 * Get an overview of the GTUs in the model. The set returned is a defensive copy.
30 * @return a set of GTUs as registered in the current model.
31 */
32 Set<Gtu> getGTUs();
33
34 /**
35 * Get a GTU in the model.
36 * @param gtuId String; the id of the GTU
37 * @return a GTU as registered in the current model, or null when the id could not be found.
38 */
39 Gtu getGTU(String gtuId);
40
41 /**
42 * Add a GTU to the network.
43 * @param gtu Gtu; the GTU to add
44 */
45 void addGTU(Gtu gtu);
46
47 /**
48 * Remove a GTU from the network.
49 * @param gtu Gtu; the GTU to remove
50 */
51 void removeGTU(Gtu gtu);
52
53 /**
54 * Test whether a GTU is registered in the network.
55 * @param gtu Gtu; the GTU to search for
56 * @return whether the network contains this GTU
57 */
58 boolean containsGTU(Gtu gtu);
59
60 /**
61 * Test whether a GTU ID is registered in the network.
62 * @param gtuId String; the GTU ID to search for
63 * @return whether the network contains a GTU with this ID
64 */
65 boolean containsGtuId(String gtuId);
66
67 }