View Javadoc
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-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
15   * </p>
16   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
17   * initial version Dec 10, 2015 <br>
18   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20   */
21  public interface PerceivableContext extends Identifiable
22  {
23      /**
24       * Get a descriptive Id of the perceivable context (e.g., useful for debugging purposes).
25       * @return the id of the context
26       */
27      @Override
28      String getId();
29  
30      /**
31       * Get an overview of the GTUs in the model. The set returned is a defensive copy.
32       * @return a set of GTUs as registered in the current model.
33       */
34      Set<GTU> getGTUs();
35  
36      /**
37       * Get a GTU in the model.
38       * @param gtuId the id of the GTU
39       * @return a GTU as registered in the current model, or null when the id could not be found.
40       */
41      GTU getGTU(String gtuId);
42  
43      /**
44       * Add a GTU to the network.
45       * @param gtu the GTU to add
46       */
47      void addGTU(GTU gtu);
48  
49      /**
50       * Remove a GTU from the network.
51       * @param gtu the GTU to remove
52       */
53      void removeGTU(GTU gtu);
54  
55      /**
56       * Test whether a GTU is registered in the network.
57       * @param gtu the GTU to search for
58       * @return whether the network contains this GTU
59       */
60      boolean containsGTU(GTU gtu);
61  
62      /**
63       * Test whether a GTU ID is registered in the network.
64       * @param gtuId the GTU ID to search for
65       * @return whether the network contains a GTU with this ID
66       */
67      boolean containsGtuId(String gtuId);
68  
69  }