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