View Javadoc
1   package org.opentrafficsim.core.perception;
2   
3   import java.util.Set;
4   
5   import org.opentrafficsim.core.gtu.GTU;
6   
7   /**
8    * The Model package guarantees that objects that are used in an OTS study such as GTUs are retrievable. In a spatial model, for
9    * instance, objects need to be able to find each other. The model interface guarantees access to a number of important objects
10   * in the study.
11   * <p>
12   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
14   * </p>
15   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
16   * initial version Dec 10, 2015 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19   */
20  public interface PerceivableContext
21  {
22      /**
23       * Get a descriptive Id of the perceivable context (e.g., useful for debugging purposes).
24       * @return the id of the context
25       */
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 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 the GTU to add
44       */
45      void addGTU(GTU gtu);
46  
47      /**
48       * Remove a GTU from the network.
49       * @param 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 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 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  }